k8s-manifests/backups/base/backup-cronjob.yaml

51 lines
1.8 KiB
YAML
Raw Normal View History

2025-02-07 13:15:20 +01:00
apiVersion: batch/v1
kind: CronJob
metadata:
name: backup
spec:
schedule: "0 0 * * *"
jobTemplate:
spec:
2025-02-07 13:21:37 +01:00
template:
spec:
2025-02-07 15:33:39 +01:00
volumes:
- name: backup-storage
emptyDir: {}
2025-02-07 13:21:37 +01:00
restartPolicy: Never
containers:
- name: backup-container
image: docker.sunet.se/drive/duplicity:bookworm-slim-1
2025-02-07 15:33:39 +01:00
command: ["duplicity"]
args: ["/backup_storage", "rclone://destination:$(BUCKET)", "--no-encryption", "--full-if-older-than", "1M" ]
2025-02-07 13:21:37 +01:00
env:
- name: RCLONE_CONFIG_DESTINATION_ACL
value: private
- name: RCLONE_CONFIG_DESTINATION_TYPE
value: s3
- name: RCLONE_CONFIG_DESTINATION_ENDPOINT
value: s3.sto3.safedc.net
- name: RCLONE_CONFIG_DESTINATION_PROVIDER
value: Ceph
2025-02-07 15:33:39 +01:00
volumeMounts:
- name: backup-storage
mountPath: /backup_storage
mountPropagation: HostToContainer
- name: mount-container
image: rclone/rclone:1.69.0
args: ["mount", "--allow-non-empty", "--daemon", "source:$(BUCKET)", "/backup_storage"]
securityContext:
privileged: true
env:
2025-02-07 13:21:37 +01:00
- name: RCLONE_CONFIG_SOURCE_ACL
value: private
- name: RCLONE_CONFIG_SOURCE_TYPE
value: s3
- name: RCLONE_CONFIG_SOURCE_ENDPOINT
value: s3.sto4.safedc.net
- name: RCLONE_CONFIG_SOURCE_PROVIDER
value: Ceph
2025-02-07 15:33:39 +01:00
volumeMounts:
- name: backup-storage
mountPath: /backup_storage
mountPropagation: Bidirectional