apiVersion: batch/v1
kind: Job
metadata:
  name: backup-database
spec:
  template:
    metadata:
      name: backup-databases
    spec:
      volumes:
        - name: backup-dir
          cephfs:
            monitors:
            - 10.42.1.1:6789
            - 10.42.1.2:6789
            - 10.42.1.3:6789
            user: kube
            path: /backups
            secretRef:
              name: ktel-ceph-user-secret
            readOnly: false
      containers:
      - name: backuper
        image: xetys/open-psql-backup:latest
        imagePullPolicy: Always
        command: ["/back-up.sh"]
        env:
          - name: BACKUP_DIR
            value: /backups
          - name: NAMESPACE
            value: kloud
        volumeMounts:
        - name: backup-dir
          mountPath: /backups
      restartPolicy: Never
      serviceAccount: backuper
  backoffLimit: 4
