diff --git a/infrastructure/backup/base/cronjob.yaml b/infrastructure/backup/base/cronjob.yaml index 9c341e0..a38edeb 100644 --- a/infrastructure/backup/base/cronjob.yaml +++ b/infrastructure/backup/base/cronjob.yaml @@ -15,6 +15,17 @@ spec: hostname: restic-k3s-pod # used by restic to identify the host containers: + # run after completion of initContainers + - name: ntfy-command-send + image: curl + command: ["curl"] + args: + - "-H" + - "Title: $(cat /proc/sys/kernel/hostname)" + - "-d" + - "Restic operation to gdrive finished" + - "https://ntfy.kluster.moll.re/backup" + initContainers: - name: restic-base-container image: restic/restic:latest command: diff --git a/infrastructure/backup/overlays/backup/restic-commands.yaml b/infrastructure/backup/overlays/backup/restic-commands.yaml index 6b9a3bb..920f054 100644 --- a/infrastructure/backup/overlays/backup/restic-commands.yaml +++ b/infrastructure/backup/overlays/backup/restic-commands.yaml @@ -10,7 +10,7 @@ spec: spec: template: spec: - containers: + initContainers: - name: restic-base-container args: # >- strips newlines diff --git a/infrastructure/backup/overlays/prune/restic-commands.yaml b/infrastructure/backup/overlays/prune/restic-commands.yaml index c6f4fbd..fc02123 100644 --- a/infrastructure/backup/overlays/prune/restic-commands.yaml +++ b/infrastructure/backup/overlays/prune/restic-commands.yaml @@ -10,7 +10,7 @@ spec: spec: template: spec: - containers: + initContainers: - name: restic-base-container args: # >- strips newlines diff --git a/kluster-deployments/backup/backup.application.yaml b/kluster-deployments/backup/backup.application.yaml new file mode 100644 index 0000000..0b57998 --- /dev/null +++ b/kluster-deployments/backup/backup.application.yaml @@ -0,0 +1,18 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: restic-backup-application + namespace: argocd +spec: + project: default + source: + repoURL: https://github.com/moll-re/k3s-infra.git + targetRevision: HEAD + path: infrastructure/backup/overlays/backup + destination: + server: https://kubernetes.default.svc + namespace: backup + syncPolicy: + automated: + prune: true + selfHeal: true \ No newline at end of file diff --git a/kluster-deployments/backup/kustomization.yaml b/kluster-deployments/backup/kustomization.yaml new file mode 100644 index 0000000..26df15e --- /dev/null +++ b/kluster-deployments/backup/kustomization.yaml @@ -0,0 +1,5 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - backup.application.yaml + - prune.application.yaml diff --git a/kluster-deployments/backup/prune.application.yaml b/kluster-deployments/backup/prune.application.yaml new file mode 100644 index 0000000..6187bc1 --- /dev/null +++ b/kluster-deployments/backup/prune.application.yaml @@ -0,0 +1,18 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: restic-prune-application + namespace: argocd +spec: + project: default + source: + repoURL: https://github.com/moll-re/k3s-infra.git + targetRevision: HEAD + path: infrastructure/backup/overlays/prune + destination: + server: https://kubernetes.default.svc + namespace: backup + syncPolicy: + automated: + prune: true + selfHeal: true \ No newline at end of file diff --git a/kluster-deployments/kustomization.yaml b/kluster-deployments/kustomization.yaml index 1ece445..c48c076 100644 --- a/kluster-deployments/kustomization.yaml +++ b/kluster-deployments/kustomization.yaml @@ -11,3 +11,4 @@ resources: - immich/ - homeassistant/ - ntfy/ + - backup/