proper backup config
This commit is contained in:
8
infrastructure/backup/cronjobs-overlays/applying.md
Normal file
8
infrastructure/backup/cronjobs-overlays/applying.md
Normal file
@@ -0,0 +1,8 @@
|
||||
```
|
||||
k kustomize backup/overlays/backup | k apply -f -
|
||||
> secret/restic-credentials-backup created
|
||||
> cronjob.batch/restic-backblaze-backup created
|
||||
k kustomize backup/overlays/prune | k apply -f -
|
||||
> secret/restic-credentials-prune created
|
||||
> cronjob.batch/restic-backblaze-prune created
|
||||
```
|
@@ -0,0 +1,24 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
namespace: backup
|
||||
# nameSuffix: -backup
|
||||
resources:
|
||||
- ../../cronjobs-base
|
||||
# - ./restic-commands.yaml
|
||||
|
||||
|
||||
# patch the cronjob args field:
|
||||
patches:
|
||||
- path: restic-commands.yaml
|
||||
target:
|
||||
kind: CronJob
|
||||
name: restic-rclone-gdrive
|
||||
- target:
|
||||
kind: CronJob
|
||||
name: restic-rclone-gdrive
|
||||
# replace the name of the cronjob
|
||||
patch: |-
|
||||
- op: replace
|
||||
path: /metadata/name
|
||||
value: restic-gdrive-backup
|
@@ -0,0 +1,30 @@
|
||||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: restic-gdrive-backup
|
||||
spec:
|
||||
schedule: "0 2 * * *"
|
||||
# at 2:00, every day
|
||||
|
||||
jobTemplate:
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
initContainers:
|
||||
- name: restic-base-container
|
||||
args:
|
||||
# >- strips newlines
|
||||
# -r $(RESTIC_REPOSITORY) not needed, bc set as env var
|
||||
- >-
|
||||
restic backup
|
||||
--verbose=2
|
||||
/data
|
||||
--exclude=s3/
|
||||
&&
|
||||
restic
|
||||
list snapshots
|
||||
containers:
|
||||
- name: ntfy-command-send
|
||||
env:
|
||||
- name: OPERATION
|
||||
value: "Restic backup to gdrive"
|
@@ -0,0 +1,22 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
namespace: backup
|
||||
resources:
|
||||
- ../../cronjobs-base
|
||||
|
||||
|
||||
# patch the cronjob args field:
|
||||
patches:
|
||||
- path: restic-commands.yaml
|
||||
target:
|
||||
kind: CronJob
|
||||
name: restic-rclone-gdrive
|
||||
- target:
|
||||
kind: CronJob
|
||||
name: restic-rclone-gdrive
|
||||
# replace the name of the cronjob
|
||||
patch: |-
|
||||
- op: replace
|
||||
path: /metadata/name
|
||||
value: restic-gdrive-prune
|
@@ -0,0 +1,29 @@
|
||||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: restic-gdrive-prune
|
||||
spec:
|
||||
schedule: "0 0 1/15 * *"
|
||||
# at midnight, the first and 15. of every month
|
||||
|
||||
jobTemplate:
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
initContainers:
|
||||
- name: restic-base-container
|
||||
args:
|
||||
# >- strips newlines
|
||||
# RESTIC_ARGS Can be for instance: --verbose --dry-run
|
||||
# RESTIC_REPOSITORY is set in the secret
|
||||
- >-
|
||||
restic forget
|
||||
-r $(RESTIC_REPOSITORY)
|
||||
--verbose=2
|
||||
--keep-daily 7 --keep-weekly 5
|
||||
--prune
|
||||
containers:
|
||||
- name: ntfy-command-send
|
||||
env:
|
||||
- name: OPERATION
|
||||
value: "Restic prune on gdrive"
|
Reference in New Issue
Block a user