---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: encapi
  namespace: encapi
  annotations:
    configmap.reloader.stakater.com/auto: "true"
spec:
  replicas: 2
  selector:
    matchLabels:
      app: encapi
  strategy:
    rollingUpdate:
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: encapi
    spec:
      automountServiceAccountToken: true
      containers:
        - name: encapi
          image: artifactapi.k8s.syd1.au.unkin.net/docker-internal/encapi:v0.1.1
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 8000
              name: http
              protocol: TCP
          envFrom:
            # DBHOST/DBNAME/DBPORT/DBUSER/DBSSL/LISTEN_ADDR
            - configMapRef:
                name: encapi-env
                optional: false
            # DBPASS + ENCAPI_WRITE_TOKEN (seeded in Vault, see cutover notes)
            - secretRef:
                name: environment
                optional: false
          livenessProbe:
            httpGet:
              path: /healthz
              port: http
            initialDelaySeconds: 15
            periodSeconds: 30
            timeoutSeconds: 5
            failureThreshold: 3
          readinessProbe:
            httpGet:
              path: /healthz
              port: http
            initialDelaySeconds: 5
            periodSeconds: 5
            timeoutSeconds: 5
            failureThreshold: 3
          resources:
            requests:
              cpu: 50m
              memory: 64Mi
            limits:
              cpu: 500m
              memory: 256Mi
      restartPolicy: Always
