From fee6d352d5c379a1e7499cdadde5ce6a9b5e7f7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ege=20G=C3=BCne=C5=9F?= Date: Wed, 2 Apr 2025 18:11:16 +0300 Subject: [PATCH 1/2] K8SPG-710: Add field to enable/disable backups --- charts/pg-db/README.md | 1 + charts/pg-db/templates/cluster.yaml | 2 ++ charts/pg-db/values.yaml | 1 + 3 files changed, 4 insertions(+) diff --git a/charts/pg-db/README.md b/charts/pg-db/README.md index 25ca2676..7c3b2cb4 100644 --- a/charts/pg-db/README.md +++ b/charts/pg-db/README.md @@ -126,6 +126,7 @@ The chart can be customized using the following configurable parameters: | `instances.tablespaceVolumes.dataVolumeClaimSpec.accessModes` | The Kubernetes PersistentVolumeClaim access modes for the tablespace volume | `{}` | | `instances.tablespaceVolumes.dataVolumeClaimSpec.resources.requests.storage` | The Kubernetes storage requests for the tablespace volume | `""` | | | +| `backups.enabled` | Enable backups in PerconaPGCluster | `true` | | `backups.trackLatestRestorableTime` | Enable background worker to track commit timestamps and set latest restorable time to latest successful backup | `true` | | `backups.pgbackrest.metadata.labels` | Set labels for pgbackrest | `test-label:test` | | `backups.pgbackrest.configuration` | Name of the Kubernetes Secret object with custom pgBackRest configuration, which will be added to the pgBackRest configuration generated by the Operator | `[]` | diff --git a/charts/pg-db/templates/cluster.yaml b/charts/pg-db/templates/cluster.yaml index f9aeb8f0..e975d19d 100644 --- a/charts/pg-db/templates/cluster.yaml +++ b/charts/pg-db/templates/cluster.yaml @@ -364,6 +364,7 @@ spec: customClusterName: {{ .Values.pmm.customClusterName }} postgresParams: {{ .Values.pmm.postgresParams}} +{{ if or (not (hasKey .Values.backups "enabled")) (.Values.backups.enabled) }} backups: trackLatestRestorableTime: {{ .Values.backups.trackLatestRestorableTime }} pgbackrest: @@ -500,6 +501,7 @@ spec: {{ .Values.backups.pgbackrest.restore.tolerations | toYaml | indent 10 }} {{- end }} {{- end }} +{{- end }} {{- if .Values.patroni }} patroni: diff --git a/charts/pg-db/values.yaml b/charts/pg-db/values.yaml index 20e9f58f..cfc243d7 100644 --- a/charts/pg-db/values.yaml +++ b/charts/pg-db/values.yaml @@ -333,6 +333,7 @@ proxy: # pool_mode: transaction backups: + enabled: true trackLatestRestorableTime: true pgbackrest: # metadata: From c80d51b4d0f65312b7357900d2cf2d791594319f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ege=20G=C3=BCne=C5=9F?= Date: Fri, 4 Apr 2025 13:44:34 +0300 Subject: [PATCH 2/2] set backups.enabled --- charts/pg-db/templates/cluster.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/charts/pg-db/templates/cluster.yaml b/charts/pg-db/templates/cluster.yaml index e975d19d..297c242c 100644 --- a/charts/pg-db/templates/cluster.yaml +++ b/charts/pg-db/templates/cluster.yaml @@ -364,8 +364,10 @@ spec: customClusterName: {{ .Values.pmm.customClusterName }} postgresParams: {{ .Values.pmm.postgresParams}} -{{ if or (not (hasKey .Values.backups "enabled")) (.Values.backups.enabled) }} backups: +{{ if (hasKey .Values.backups "enabled") }} + enabled: {{ .Values.backups.enabled }} +{{- end }} trackLatestRestorableTime: {{ .Values.backups.trackLatestRestorableTime }} pgbackrest: image: {{ .Values.backups.pgbackrest.image }} @@ -501,7 +503,6 @@ spec: {{ .Values.backups.pgbackrest.restore.tolerations | toYaml | indent 10 }} {{- end }} {{- end }} -{{- end }} {{- if .Values.patroni }} patroni: