apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    description: Lykke-Service-Csharp-Host
  labels:
    app: csharp-host
    tier: Service
  name: csharp-host
  namespace: org-services
spec:
  revisionHistoryLimit: 1
  minReadySeconds: 10
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 1
      maxSurge: 1
  replicas: 1
  selector:
    matchLabels:
      app: csharp-host
  template:
    metadata:
      labels:
        app: csharp-host
      name: csharp-host
    spec:
      containers:
      - name: csharp-host
        image: openvasporg/$dockerImage
        lifecycle:
          postStart:
            exec:
             command:
             - /bin/sh
             - -c
             - "cp /config/appsettings.json /app/appsettings.json"
        imagePullPolicy: Always
        ports:
        - containerPort: 80
#        readinessProbe:
#          httpGet:
#            path: /api/isalive
#            port: 80
#          initialDelaySeconds: 60
#          periodSeconds: 10
#        livenessProbe:
#          httpGet:
#            path: /api/isalive
#            port: 80
#          initialDelaySeconds: 60
#          periodSeconds: 20
        resources:
          requests:
            memory: 128Mi
            cpu: 40m
          limits:
            memory: 256Mi
            cpu: 100m
        env:
        - name: BuildNumber
          value: '$version'
        - name: ENV_INFO
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        volumeMounts:
        - name: workdir
          mountPath: /config
      initContainers:
      - name: install
        image: busybox
        command: ["/bin/sh","-c"]
        args: ["wget --output-document=appsettings.json http://consul-ui.internal.svc.cluster.local/v1/kv/host-1/settings?raw; cp appsettings.json /work-dir"]
        volumeMounts:
        - name: workdir
          mountPath: "/work-dir"
      volumes:
      - name: workdir
        emptyDir: {}
