From 9de204737a76a9c203caf9e664ff78141730d435 Mon Sep 17 00:00:00 2001 From: Micke Nordin Date: Fri, 7 Feb 2025 15:44:49 +0100 Subject: [PATCH] Try livenessprobe --- backups/base/backup-cronjob.yaml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/backups/base/backup-cronjob.yaml b/backups/base/backup-cronjob.yaml index 9acb423..73ac4c1 100644 --- a/backups/base/backup-cronjob.yaml +++ b/backups/base/backup-cronjob.yaml @@ -4,6 +4,7 @@ metadata: name: backup spec: schedule: "0 0 * * *" + concurrencyPolicy: Forbid jobTemplate: spec: template: @@ -11,12 +12,14 @@ spec: volumes: - name: backup-storage emptyDir: {} + - name: ipc-storage + emptyDir: {} restartPolicy: Never containers: - name: backup-container image: docker.sunet.se/drive/duplicity:bookworm-slim-1 - command: ["duplicity"] - args: ["/backup_storage", "rclone://destination:$(BUCKET)", "--no-encryption", "--full-if-older-than", "1M" ] + command: ["bash"] + args: [ "-c" "duplicity /backup_storage rclone://destination:$(BUCKET) --no-encryption --full-if-older-than 1M; touch /backup_ipc/stop" ] env: - name: RCLONE_CONFIG_DESTINATION_ACL value: private @@ -30,11 +33,17 @@ spec: - name: backup-storage mountPath: /backup_storage mountPropagation: HostToContainer + - name: backup-storage + mountPath: /backup_ipc + mountPropagation: Bidirectional - name: mount-container image: rclone/rclone:1.69.0 - args: ["mount", "--allow-non-empty", "--daemon", "source:$(BUCKET)", "/backup_storage"] + args: ["mount", "--allow-non-empty", "source:$(BUCKET)", "/backup_storage"] securityContext: privileged: true + livenessProbe: + exec: + command: ["bash", "-c", "if test -f /backup_ipc/stop; then umount /backup_storage; exit 1; fi;"] env: - name: RCLONE_CONFIG_SOURCE_ACL value: private @@ -48,3 +57,6 @@ spec: - name: backup-storage mountPath: /backup_storage mountPropagation: Bidirectional + - name: backup-storage + mountPath: /backup_ipc + mountPropagation: HostToContainer