apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: database-backup
spec:
  schedule: "20 * * * *"
  successfulJobsHistoryLimit: 10
  failedJobsHistoryLimit: 5
  concurrencyPolicy: Replace
  jobTemplate:
    spec:
      template:
        spec:
          restartPolicy: Never
          imagePullSecrets:
            - name: registrypullsecret
          securityContext:
            fsGroup: 1234
          containers:
          - image: databack/mysql-backup
            name: database-backup
            env:
            - name: DB_DUMP_TARGET
              value: ${DB_DUMP_TARGET}
            - name: DB_USER
              value: root
            - name: RUN_ONCE
              value: "1"
            - name: DB_SERVER
              value: rosterviewer-database-service
            - name: DB_PORT
              value: "3306"
            - name: DB_NAMES
              value: rosterviewer
            - name: AWS_ACCESS_KEY_ID
              value: ${AWS_ACCESS_KEY_ID}
            - name: AWS_SECRET_ACCESS_KEY 
              value: ${AWS_SECRET_ACCESS_KEY}
            - name: AWS_DEFAULT_REGION 
              value: ${AWS_DEFAULT_REGION}
            - name: AWS_ENDPOINT_URL
              value: ${AWS_ENDPOINT_URL}
