kind: Deployment
apiVersion: apps/v1
metadata:
  name: air-cohorts-<PRODUCT>-prod
  namespace: airlytics
  labels:
    app: air-cohorts-<PRODUCT>-prod
  annotations:
    deployment.kubernetes.io/revision: '3'
spec:
  replicas: 1
  selector:
    matchLabels:
      app: air-cohorts-<PRODUCT>-prod
  template:
    metadata:
      labels:
        app: air-cohorts-<PRODUCT>-prod
    spec:
      nodeSelector:
        pod-type: <POD_TYPE>
      containers:
        - name: air-cohorts
          image: <IMAGE_STORE_SERVER>/airlytics/air-cohorts:latest
          ports:
            - containerPort: 8081
              name: web
              protocol: TCP
          env:
            - name: AIRLYTICS_ENVIRONMENT
              value: 'PROD'
            - name: AIRLYTICS_PRODUCT
              value: '<PRODUCT>'
            - name: AIRLYTICS_DEPLOYMENT
              valueFrom:
                configMapKeyRef:
                  name: airlytics-deployments-config
                  key: airlytics.deployment
            - name: DB_URL
              value: 'jdbc:postgresql://<DB_SERVER>:5432/users?currentSchema=product'
            - name: DB_USER_NAME
              value: 'airlytics_cohorts'
            - name: DB_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: userdb-secret
                  key: airlytics-cohorts
            - name: RO_DB_URL
              value: 'jdbc:postgresql://<RO_DB_SERVER>:5432/users?currentSchema=product'
            - name: RO_DB_USER_NAME
              value: 'airlytics_cohorts'
            - name: RO_DB_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: userdb-secret
                  key: airlytics-cohorts
            - name: AIRLOCK_KEY
              valueFrom:
                secretKeyRef:
                  name: airlock-api-secret
                  key: airlock-key
            - name: AIRLOCK_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: airlock-api-secret
                  key: airlock-password
          livenessProbe:
            httpGet:
              path: /healthcheck/is-alive
              port: web
            initialDelaySeconds: 30
            periodSeconds: 30
          readinessProbe:
            httpGet:
              path: /healthcheck/is-ready
              port: web
            initialDelaySeconds: 30
            periodSeconds: 30
          resources:
            limits:
              memory: 4Gi
            requests:
              memory: 4Gi
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          imagePullPolicy: Always
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
      dnsPolicy: ClusterFirst
      securityContext: {}
      schedulerName: default-scheduler
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 25%
      maxSurge: 25%
  revisionHistoryLimit: 10
  progressDeadlineSeconds: 600