apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    name: mail
  name: mail
spec:
  progressDeadlineSeconds: 2147483647
  replicas: 1
  revisionHistoryLimit: 0
  selector:
    matchLabels:
      name: mail
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      labels:
        name: mail
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: type
                    operator: In
                    values:
                      - apps
      containers:
        - args:
            - start
          env:
            - name: PORT
              value: "3500"
            - name: NODE_ENV
              value: staging
            - name: NODE_PATH
              value: app/src
            - name: QUEUE_PROVIDER
              value: redis
            - name: QUEUE_NAME
              value: mail_staging
            - name: QUEUE_URL
              valueFrom:
                secretKeyRef:
                  key: REDIS_URI
                  name: dbsecrets
            - name: SPARKPOST_API_KEY
              valueFrom:
                secretKeyRef:
                  key: SPARKPOST_API_KEY
                  name: mssecrets
          image: gfwdockerhub/mail
          imagePullPolicy: Always
          livenessProbe:
            failureThreshold: 3
            httpGet:
              path: /healthcheck
              port: 3500
              scheme: HTTP
            initialDelaySeconds: 30
            periodSeconds: 15
            successThreshold: 1
            timeoutSeconds: 5
          name: mail
          ports:
            - containerPort: 3500
              protocol: TCP
          readinessProbe:
            failureThreshold: 3
            httpGet:
              path: /healthcheck
              port: 3500
              scheme: HTTP
            initialDelaySeconds: 30
            periodSeconds: 15
            successThreshold: 1
            timeoutSeconds: 5
          resources:
            limits:
              cpu: "1"
              memory: 512M
            requests:
              cpu: 250m
              memory: 256M
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      imagePullSecrets:
        - name: regcred
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
