apiVersion: apps/v1
kind: Deployment
metadata:
  name: ${IMAGE_NAME}
  labels:
    app: ${IMAGE_NAME}
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: ${IMAGE_NAME}
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: ${IMAGE_NAME}
    spec:
      containers:
      - name: ${IMAGE_NAME}
        image: us.gcr.io/${GCP_PROJECT}/${IMAGE_NAME}:${CIRCLE_SHA1}
        ports:
        - containerPort: 8080
        imagePullPolicy: IfNotPresent
        livenessProbe:
          failureThreshold: 3
          httpGet:
            path: /healthz
            port: 8080
            scheme: HTTP
          initialDelaySeconds: 10
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 5

        readinessProbe:
          failureThreshold: 3
          httpGet:
            path: /healthz
            port: 8080
            scheme: HTTP
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 1
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - name: bot-config
          mountPath: /data/symphony/config.json
          subPath: config.json
        - name: bot-key
          mountPath: /data/symphony/rsa
          readOnly: true
        - name: logs
          mountPath: /data/symphony/logs
      volumes:
      - name: bot-config
        configMap:
          name: ${IMAGE_NAME}-config
      - name: bot-key
        secret:
          secretName: ${IMAGE_NAME}-dev-rsa
          items:
          - key: private-key.pkcs8
            path: private-key.pkcs8
      - name: logs
        emptyDir: {}
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
