diff --git a/charts/cnpg-cluster/templates/backup-cron.yaml b/charts/cnpg-cluster/templates/backup-cron.yaml index 2bfb576..b3fce94 100644 --- a/charts/cnpg-cluster/templates/backup-cron.yaml +++ b/charts/cnpg-cluster/templates/backup-cron.yaml @@ -6,7 +6,7 @@ metadata: app: cnpg-backup-s3-client name: backup-cron spec: - schedule: "0 0 * * *" + schedule: {{ or .Values.backup.sqlDumpSchedule .Values.backup.schedule "0 0 * * *" }} concurrencyPolicy: Forbid jobTemplate: spec: diff --git a/charts/cnpg-cluster/tests/__snapshot__/cnpg-cluster_test.yaml.snap b/charts/cnpg-cluster/tests/__snapshot__/cnpg-cluster_test.yaml.snap index 4182239..e37b0b7 100644 --- a/charts/cnpg-cluster/tests/__snapshot__/cnpg-cluster_test.yaml.snap +++ b/charts/cnpg-cluster/tests/__snapshot__/cnpg-cluster_test.yaml.snap @@ -45,7 +45,7 @@ cluster with enabled backup and recovery: securityContext: allowPrivilegeEscalation: false restartPolicy: Never - schedule: 0 0 * * * + schedule: 4 5 6 * * 0 2: | backup: barmanObjectStore: diff --git a/charts/cnpg-cluster/tests/cnpg-cluster_test.yaml b/charts/cnpg-cluster/tests/cnpg-cluster_test.yaml index ead76fc..fcb4712 100644 --- a/charts/cnpg-cluster/tests/cnpg-cluster_test.yaml +++ b/charts/cnpg-cluster/tests/cnpg-cluster_test.yaml @@ -52,6 +52,10 @@ tests: equal: path: spec.schedule value: "1 2 3 * * 0" + - template: backup-cron.yaml + equal: + path: spec.schedule + value: "4 5 6 * * 0" - template: backup-cron.yaml hasDocuments: count: 1 diff --git a/charts/cnpg-cluster/tests/values/backup.yaml b/charts/cnpg-cluster/tests/values/backup.yaml index f39573c..6471eb2 100644 --- a/charts/cnpg-cluster/tests/values/backup.yaml +++ b/charts/cnpg-cluster/tests/values/backup.yaml @@ -1,6 +1,7 @@ backup: enabled: true schedule: "1 2 3 * * 0" + sqlDumpSchedule: "4 5 6 * * 0" barmanObjectStore: destinationPath: s3://backups/ endpointURL: http://minio:9000 diff --git a/charts/cnpg-cluster/values.yaml b/charts/cnpg-cluster/values.yaml index 013d14d..71fe110 100644 --- a/charts/cnpg-cluster/values.yaml +++ b/charts/cnpg-cluster/values.yaml @@ -75,6 +75,9 @@ backup: # this cron format has the seconds on the left schedule: "0 0 0 * * 0" + # -- Schedule the SQL dump backups, for instance every Sunday + sqlDumpSchedule: "0 0 0 * * 0" + # -- RetentionPolicy is the retention policy to be used for backups and WALs (i.e. '60d'). # The retention policy is expressed in the form of XXu where XX is a positive integer and # u is in [dwm] - days, weeks, months.