---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: fbis-ccf
spec:
  replicas: 2
  selector:
    matchLabels:
      name: fbis-ccf
  template:
    metadata:
      labels:
        name: fbis-ccf
        app: fbis-ccf
        service: fbis-ccf
    spec:
      containers:
        - name: fbis-ccf
          image: quay.io/ukhomeofficedigital/sas-fbis-ccf:{{.DRONE_COMMIT_SHA}}
          imagePullPolicy: Always
          securityContext:
            runAsNonRoot: true
          ports:
            - containerPort: 8080
          envFrom:
            - configMapRef:
                name: fbis-ccf-configmap
          env:
            - name: REDIS_PORT
              value: "6379"
            - name: REDIS_HOST
              value: redis
            - name: NOTIFY_KEY
              valueFrom:
                secretKeyRef:
                  name: fbis-notify-key
                  key: fbis-notify-key
            - name: SESSION_SECRET
              valueFrom:
                secretKeyRef:
                  name: redis
                  key: session_secret
            - name: SRC_CASEWORK_EMAIL
              valueFrom:
                secretKeyRef:
                  name: fbis-casework-email
                  key: fbis-casework-email
            - name: FEEDBACK_EMAIL
              valueFrom:
                secretKeyRef:
                  name: feedback-email
                  key: feedback-email
          livenessProbe:
            httpGet:
              path: /healthz/ping
              port: 8080
            initialDelaySeconds: 10
            periodSeconds: 10
          readinessProbe:
            httpGet:
              path: /healthz/readiness
              port: 8080
            initialDelaySeconds: 15
            periodSeconds: 5
          resources:
            requests:
              cpu: "50m"
              memory: "200Mi"
            limits:
              cpu: "400m"
              memory: "400Mi"
          volumeMounts:
            - mountPath: /public
              name: public
      volumes:
        - name: public
          emptyDir: {}
        - name: configmap
          configMap:
            name: configmap
