apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: monthly-backup-womenactivists-lib-unb-ca
  namespace: prod
  labels:
    app: drupal
    tier: backup
spec:
  schedule: "59 03 20 * *"
  startingDeadlineSeconds: 480
  concurrencyPolicy: Forbid
  jobTemplate:
    metadata:
      name: monthly-backup-womenactivists-lib-unb-ca
      labels:
        app: drupal
        tier: backup
    spec:
      template:
        spec:
          nodeSelector:
            deployenv: dev
          containers:
            -
              name: monthly-backup-womenactivists-lib-unb-ca
              args: ["monthly"]
              env:
                -
                  name: DEPLOY_ENV
                  value: prod
                -
                  name: MYSQL_HOSTNAME
                  value: drupal-mysql-lib-unb-ca
                -
                  name: MYSQL_PORT
                  value: "3306"
                -
                  name: MYSQL_DATABASE
                  value: womacti_db
                -
                  name: MYSQL_USER_NAME
                  value: root
                -
                  name: MYSQL_USER_PASSWORD
                  valueFrom:
                    secretKeyRef:
                      name: mysql
                      key: root-password
                -
                  name: RSNAPSHOT_RETAIN_HOURLY
                  value: "0"
                -
                  name: RSNAPSHOT_RETAIN_DAILY
                  value: "0"
                -
                  name: RSNAPSHOT_RETAIN_WEEKLY
                  value: "0"
              image: "ghcr.io/unb-libraries/mysql-backup:latest"
              imagePullPolicy: Always
              volumeMounts:
                -
                  mountPath: /data
                  name: backup-persistent-storage
          priorityClassName: backup-priority-services
          imagePullSecrets:
            -
              name: github-container-registry-auth
          restartPolicy: Never
          volumes:
            -
              name: backup-persistent-storage
              persistentVolumeClaim:
                claimName: backup-womenactivists-lib-unb-ca
