Add cronjob
This commit is contained in:
parent
d054334edd
commit
05e94f10f0
4 changed files with 93 additions and 0 deletions
47
backups/base/backup-cronjob.yaml
Normal file
47
backups/base/backup-cronjob.yaml
Normal file
|
@ -0,0 +1,47 @@
|
|||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: backup
|
||||
spec:
|
||||
schedule: "0 0 * * *"
|
||||
jobTemplate:
|
||||
spec:
|
||||
volumes:
|
||||
- name: backup-storage
|
||||
emptyDir: {}
|
||||
restartPolicy: Never
|
||||
containers:
|
||||
- name: backup-container
|
||||
image: docker.sunet.se/drive/duplicity:bookworm-slim-1
|
||||
args: ["backup", "/backup_storage", "destination:${BUCKET}"]
|
||||
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
|
||||
volumeMounts:
|
||||
- name: backup-storage
|
||||
mountPath: /backup_storage
|
||||
mountPropagation: HostToContainer
|
||||
- name: mount-container
|
||||
image: rclone/rclone:1.69.0
|
||||
securityContext:
|
||||
privileged: true
|
||||
args: ["mount", "source:${BUCKET}", "/backup_storage"]
|
||||
env:
|
||||
- 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
|
||||
volumeMounts:
|
||||
- name: backup-storage
|
||||
mountPath: /backup_storage
|
||||
mountPropagation: Bidirectional
|
2
backups/base/kustomization.yaml
Normal file
2
backups/base/kustomization.yaml
Normal file
|
@ -0,0 +1,2 @@
|
|||
resources:
|
||||
- backup-cronjob.yaml
|
37
backups/overlays/test/xrootd/backup-cronjob.yaml
Normal file
37
backups/overlays/test/xrootd/backup-cronjob.yaml
Normal file
|
@ -0,0 +1,37 @@
|
|||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: backup
|
||||
spec:
|
||||
schedule: "0 14 * * *"
|
||||
jobTemplate:
|
||||
spec:
|
||||
containers:
|
||||
- name: backup-container
|
||||
env:
|
||||
- name: BUCKET
|
||||
value: "xrootd-test-mirror"
|
||||
- name: RCLONE_CONFIG_DESTINATION_ACCESS_KEY_ID
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: xrootd-secret
|
||||
key: "destination-access-key-id"
|
||||
- name: RCLONE_CONFIG_DESTINATION_SECRET_ACCESS_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: xrootd-secret
|
||||
key: "destination-secret-access-key"
|
||||
- name: mount-container
|
||||
env:
|
||||
- name: BUCKET
|
||||
value: "xrootd-test"
|
||||
- name: RCLONE_CONFIG_SOURCE_ACCESS_KEY_ID
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: xrootd-secret
|
||||
key: "source-access-key-id"
|
||||
- name: RCLONE_CONFIG_SOURCE_SECRET_ACCESS_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: xrootd-secret
|
||||
key: "source-secret-access-key"
|
7
backups/overlays/test/xrootd/kustomization.yaml
Normal file
7
backups/overlays/test/xrootd/kustomization.yaml
Normal file
|
@ -0,0 +1,7 @@
|
|||
apiVersion: 'kustomize.config.k8s.io/v1beta1'
|
||||
kind: Kustomization
|
||||
bases:
|
||||
- ../../../base
|
||||
patchesStrategicMerge:
|
||||
- backup-cronjob.yaml
|
||||
|
Loading…
Add table
Reference in a new issue