apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: export-data
spec:
  jobTemplate:
    metadata:
      name: export-data
    spec:
      template:
        spec:
          containers:
          - command:
            - /bin/bash
            - /opt/export-files.sh
            - http://restserver:7880
            - /data
            image: quay.io/tobru/tools:latest
            name: export-data
            env:
            - name: SKIP_FILE
              value: "y"
            - name: DS_USER
              valueFrom:
                secretKeyRef:
                  name: backup-creds
                  key: user
            - name: DS_PASS
              valueFrom:
                secretKeyRef:
                  name: backup-creds
                  key: pass
            - name: SKIP_FILE
              value: y
            volumeMounts:
            - name: script
              mountPath: /opt
            - name: data
              mountPath: /data
          restartPolicy: OnFailure
          volumes:
          - name: script
            configMap:
              name: file-backup-script
          - name: data
            persistentVolumeClaim:
              claimName: backup-data
  schedule: '15 0 * * *'
