---
apiVersion: batch/v1
kind: CronJob
metadata:
  name: gitlab-backup-mirror
  namespace: gitlab
  labels:
    app: gitlab-backup-mirror
    component: job
spec:
  schedule: CRON_TZ=Europe/Zurich 0 2 * * *
  failedJobsHistoryLimit: 1
  successfulJobsHistoryLimit: 1
  concurrencyPolicy: Forbid
  jobTemplate:
    spec:
      template:
        metadata:
          labels:
            app: gitlab-backup-mirror
            component: job
        spec:
          containers:
            - name: gitlab-backup-mirror
              image: ghcr.io/containeroo/mirrio:2.2.0
              env:
                - name: TZ
                  value: Europe/Zurich
                - name: SOURCE_URL
                  value: http://gitlab-minio-svc.gitlab.svc.cluster.local:9000
                - name: SOURCE_BUCKET
                  value: gitlab-backups
                - name: SOURCE_ACCESSKEY
                  valueFrom:
                    secretKeyRef:
                      key: accesskey
                      name: gitlab-minio-secret
                - name: SOURCE_SECRETKEY
                  valueFrom:
                    secretKeyRef:
                      key: secretkey
                      name: gitlab-minio-secret
                - name: DESTINATION_URL
                  value: http://minio.minio.svc.cluster.local:9000
                - name: DESTINATION_BUCKET
                  value: gitlab
                - name: JOB_NAME
                  value: gitlab-backup-mirror
                - name: RETENTION
                  value: 7d0h0m
                - name: PUSHGATEWAY_URL
                  value: http://prometheus-pushgateway.monitoring.svc.cluster.local:9091
              envFrom:
                - secretRef:
                    name: gitlab-backup-mirror
          restartPolicy: Never
          automountServiceAccountToken: false
