apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: celery-beat 
  name:  celery-beat
  namespace: notification-canada-ca
spec:
  replicas: 1
  revisionHistoryLimit: 5
  selector:
    matchLabels:
      app: celery-beat 
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: celery-beat
    spec:
      initContainers:
        - name: init-postgres
          image: alpine
          command:
            [
              "sh",
              "-c",
              "until nslookup $(POSTGRES_HOST); do echo waiting for postgres; sleep 2; done;",
            ]
      containers:
        - image: api
          imagePullPolicy: Always
          name: celery-beat
          env:
            - name: ADMIN_BASE_URL
              value: https://$(BASE_DOMAIN)
            - name: ADMIN_CLIENT_SECRET
              value: '$(ADMIN_CLIENT_SECRET)'
            - name: AWS_REGION
              value: '$(AWS_REGION)'
            - name: AWS_ACCESS_KEY_ID
              value: '$(AWS_ACCESS_KEY_ID)'
            - name: AWS_SECRET_ACCESS_KEY
              value: '$(AWS_SECRET_ACCESS_KEY)'
            - name: BULK_SEND_TEST_SERVICE_ID
              value: '$(BULK_SEND_TEST_SERVICE_ID)'
            - 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_HOST
              value: '$(MLWR_HOST)'
            - name: MLWR_USER
              value: '$(MLWR_USER)'
            - name: MLWR_KEY
              value: '$(MLWR_KEY)'
            - name: NEW_RELIC_LICENSE_KEY
              value: '$(NEW_RELIC_LICENSE_KEY)'
            - name: NEW_RELIC_APP_NAME
              value: 'notification-celery-beat-production'
            - name: NEW_RELIC_DISTRIBUTED_TRACING_ENABLED
              value: 'true'
            - 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://redis.notification-canada-ca.svc.cluster.local:6379
            - 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: STATSD_HOST
              value: cloudwatch-agent-statsd.notification-canada-ca.svc.cluster.local
            - name: TWILIO_ACCOUNT_SID
              value: '$(TWILIO_ACCOUNT_SID)'
            - name: TWILIO_AUTH_TOKEN
              value: '$(TWILIO_AUTH_TOKEN)'
            - name: TWILIO_FROM_NUMBER
              value: '$(TWILIO_FROM_NUMBER)'
          command: ["/bin/sh"]
          args: ["-c", "sh /app/scripts/run_celery_beat.sh"]
          resources: {}
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
status: {}
