apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: celery
    # profile: fargate
  name:  celery
  namespace: notification-canada-ca
spec:
  replicas: 1
  revisionHistoryLimit: 5
  selector:
    matchLabels:
      app: celery
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: celery
        # profile: fargate
    spec:
      containers:
        - image: api
          imagePullPolicy: Always
          name: celery
          env:
            - name: ADMIN_BASE_URL
              value: https://$(BASE_DOMAIN)
            - name: ADMIN_CLIENT_SECRET
              value: '$(ADMIN_CLIENT_SECRET)'
            - name: ALLOW_HTML_SERVICE_IDS
              value: '$(ALLOW_HTML_SERVICE_IDS)'
            - name: API_HOST_NAME
              value: 'http://api.notification-canada-ca.svc.cluster.local:6011'
            - name: ASSET_UPLOAD_BUCKET_NAME
              value: '$(ASSET_UPLOAD_BUCKET_NAME)'
            - name: AWS_PINPOINT_REGION
              value: '$(AWS_PINPOINT_REGION)'
            - name: AWS_REGION
              value: '$(AWS_REGION)'
            - name: BULK_SEND_TEST_SERVICE_ID
              value: '$(BULK_SEND_TEST_SERVICE_ID)'
            - name: CSV_UPLOAD_BUCKET_NAME
              value: '$(CSV_UPLOAD_BUCKET_NAME)'
            - name: DANGEROUS_SALT
              value: '$(DANGEROUS_SALT)'
            - name: DOCUMENT_DOWNLOAD_API_HOST
              value: 'http://document-download-api.notification-canada-ca.svc.cluster.local:7000'
            - name: FIDO2_DOMAIN
              value: '$(BASE_DOMAIN)'
            - name: HC_EN_SERVICE_ID
              value: '$(HC_EN_SERVICE_ID)'
            - name: HC_FR_SERVICE_ID
              value: '$(HC_FR_SERVICE_ID)'
            - name: MLWR_USER
              value: '$(MLWR_USER)'
            - name: MLWR_KEY
              value: '$(MLWR_KEY)'
            - name: NOTIFY_EMAIL_DOMAIN
              value: '$(BASE_DOMAIN)'
            - name: NOTIFY_ENVIRONMENT
              value: '$(ENVIRONMENT)'
            - name: NOTIFICATION_QUEUE_PREFIX
              value: 'eks-notification-canada-ca'
            - name: REDIS_URL
              value: '$(REDIS_URL)'
            - name: REDIS_ENABLED
              value: '1'
            - name: SECRET_KEY
              value: '$(SECRET_KEY)'
            - name: SENDGRID_API_KEY
              value: '$(SENDGRID_API_KEY)'
            - name: SQLALCHEMY_DATABASE_URI
              value: '$(POSTGRES_SQL)'
            - name: SQLALCHEMY_DATABASE_READER_URI
              value: '$(SQLALCHEMY_DATABASE_READER_URI)'
            - name: STATSD_HOST
              valueFrom:
                fieldRef:
                  fieldPath: spec.nodeName
            - name: TWILIO_ACCOUNT_SID
              value: '$(TWILIO_ACCOUNT_SID)'
            - name: TWILIO_AUTH_TOKEN
              value: '$(TWILIO_AUTH_TOKEN)'
            - name: TWILIO_FROM_NUMBER
              value: '$(TWILIO_FROM_NUMBER)'
            - name: AWS_US_TOLL_FREE_NUMBER
              value: '$(AWS_US_TOLL_FREE_NUMBER)'
            - name: SENTRY_URL
              value: '$(SENTRY_URL)'
            - name: NEW_RELIC_APP_NAME
              value: 'notification-celery-$(ENVIRONMENT)'
            - name: NEW_RELIC_DISTRIBUTED_TRACING_ENABLED
              value: 'true'
            - name: NEW_RELIC_LICENSE_KEY
              value: '$(NEW_RELIC_LICENSE_KEY)'
            - name: NEW_RELIC_MONITOR_MODE
              value: '$(NEW_RELIC_MONITOR_MODE)'
          command: ["/bin/sh"]
          args: ["-c", "sh /app/scripts/run_celery.sh"]
          resources:
            requests:
              cpu: "100m"
              memory: "500Mi"
            limits:
              cpu: "550m"
              memory: "600Mi"
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
status: {}
