---
apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: velero-minio-b2-sync
  namespace: system-velero
  labels:
    app: velero-minio-b2-sync
spec:
  schedule: "0 */12 * * *"

  concurrencyPolicy: Forbid
  failedJobsHistoryLimit: 3
  successfulJobsHistoryLimit: 3

  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: rclone
            image: rclone/rclone:1.54
            env:
            - name: TZ
              value: "Europe/Amsterdam"
            command: ['rclone']
            args:
            - "-v"
            - "--config"
            - "/config/rclone.conf"
            - "sync"
            - "--ignore-errors"
            - "--fast-list"
            - "--transfers"
            - "24"
            - "--checkers"
            - "24"
            - "--bwlimit"
            - "25M"
            - "minio:velero"
            - "b2-velero-crypt:/"
            volumeMounts:
            - mountPath: /config/rclone.conf
              name: config
              subPath: rclone.conf
              readOnly: true

          restartPolicy: OnFailure

          volumes:
          - name: config
            secret:
              secretName: velero-minio-b2-sync-config
