apiVersion: batch/v1
kind: CronJob
metadata:
  name: post-to-cicd2021-registration-status
spec:
  # Execute every 10:00 JST but this configure is written by UTC
  schedule: "0 1 * * *"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
            - name: dreamkast
              image: 607167088920.dkr.ecr.ap-northeast-1.amazonaws.com/dreamkast-ecs:main
              command:
                - /bin/sh
                - -c
                - bundle exec rake util:post_number_of_registrants_to_slack
              env:
                - name: SLACK_WEBHOOK_URL
                  valueFrom:
                    secretKeyRef:
                      name: dreamkast-secret
                      key: SLACK_WEBHOOK_URL
                - name: CONFERENCE_ABBR
                  value: "o11y2022"
                - name: RAILS_ENV
                  value: "production"
                - name: MYSQL_HOST
                  value: "dreamkast-prd-rds.c6eparu1hmbv.ap-northeast-1.rds.amazonaws.com"
                - name: MYSQL_DATABASE
                  value: "dreamkast"
                - name: REDIS_URL
                  value: "redis://drr7wdanp39n8i1.bp6loy.ng.0001.apne1.cache.amazonaws.com:6379"
                - name: SENTRY_DSN
                  value: "https://443f0535beb64cd8b2e995d001e0903b@o414348.ingest.sentry.io/5350644"
                - name: S3_BUCKET
                  value: "dreamkast-prd-bucket"
                - name: S3_REGION
                  value: ap-northeast-1
                - name: DREAMKAST_NAMESPACE
                  valueFrom:
                    fieldRef:
                      fieldPath: metadata.namespace
                - name: RAILS_MASTER_KEY
                  valueFrom:
                    secretKeyRef:
                      name: rails-app-secret
                      key: rails-app-secret
                - name: MYSQL_USER
                  valueFrom:
                    secretKeyRef:
                      name: db-secret
                      key: username
                - name: MYSQL_PASSWORD
                  valueFrom:
                    secretKeyRef:
                      name: db-secret
                      key: password
                - name: AUTH0_CLIENT_ID
                  valueFrom:
                    secretKeyRef:
                      name: dreamkast-secret
                      key: AUTH0_CLIENT_ID
                - name: AUTH0_CLIENT_SECRET
                  valueFrom:
                    secretKeyRef:
                      name: dreamkast-secret
                      key: AUTH0_CLIENT_SECRET
                - name: AUTH0_DOMAIN
                  valueFrom:
                    secretKeyRef:
                      name: dreamkast-secret
                      key: AUTH0_DOMAIN
          restartPolicy: OnFailure
