diff --git a/charts/postgres-cluster/Chart.yaml b/charts/postgres-cluster/Chart.yaml index b1a94fc..ed7ff58 100644 --- a/charts/postgres-cluster/Chart.yaml +++ b/charts/postgres-cluster/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: postgres-cluster -version: 6.2.1 +version: 6.3.0 description: Cloudnative-pg Cluster keywords: - database diff --git a/charts/postgres-cluster/README.md b/charts/postgres-cluster/README.md index e017b7a..93c1897 100644 --- a/charts/postgres-cluster/README.md +++ b/charts/postgres-cluster/README.md @@ -1,6 +1,6 @@ # postgres-cluster -![Version: 6.2.1](https://img.shields.io/badge/Version-6.2.1-informational?style=flat-square) ![AppVersion: v1.26.0](https://img.shields.io/badge/AppVersion-v1.26.0-informational?style=flat-square) +![Version: 6.3.0](https://img.shields.io/badge/Version-6.3.0-informational?style=flat-square) ![AppVersion: v1.26.0](https://img.shields.io/badge/AppVersion-v1.26.0-informational?style=flat-square) Cloudnative-pg Cluster @@ -19,16 +19,11 @@ Cloudnative-pg Cluster | Key | Type | Default | Description | |-----|------|---------|-------------| -| backup | object | `{"enabled":true,"method":"objectStore","objectStore":[],"scheduledBackups":[{"backupName":"external","backupOwnerReference":"self","name":"daily-backup","plugin":"barman-cloud.cloudnative-pg.io","schedule":"0 0 */3 * *","suspend":false}]}` | Backup settings | -| backup.enabled | bool | `true` | You need to configure backups manually, so backups are disabled by default. | +| backup | object | `{"enabled":false,"method":"objectStore","objectStore":[],"scheduledBackups":[]}` | Backup settings | +| backup.enabled | bool | `false` | You need to configure backups manually, so backups are disabled by default. | | backup.method | string | `"objectStore"` | Method to create backups, options currently are only objectStore | | backup.objectStore | list | `[]` | Options for object store backups | -| backup.scheduledBackups[0].backupName | string | `"external"` | Name of backup target | -| backup.scheduledBackups[0].backupOwnerReference | string | `"self"` | Backup owner reference | -| backup.scheduledBackups[0].name | string | `"daily-backup"` | Scheduled backup name | -| backup.scheduledBackups[0].plugin | string | `"barman-cloud.cloudnative-pg.io"` | Backup method, can be `barman-cloud.cloudnative-pg.io` (default) | -| backup.scheduledBackups[0].schedule | string | `"0 0 */3 * *"` | Schedule in cron format | -| backup.scheduledBackups[0].suspend | bool | `false` | Temporarily stop scheduled backups from running | +| backup.scheduledBackups | list | `[]` | List of scheduled backups | | cluster | object | `{"additionalLabels":{},"affinity":{"enablePodAntiAffinity":true,"topologyKey":"kubernetes.io/hostname"},"annotations":{},"certificates":{},"enablePDB":true,"enableSuperuserAccess":false,"image":{"repository":"ghcr.io/cloudnative-pg/postgresql","tag":"17.5-1-bullseye"},"imagePullPolicy":"IfNotPresent","imagePullSecrets":[],"initdb":{},"instances":3,"logLevel":"info","monitoring":{"customQueries":[],"customQueriesSecret":[],"disableDefaultQueries":false,"enabled":false,"podMonitor":{"enabled":true,"metricRelabelings":[],"relabelings":[]},"prometheusRule":{"enabled":false,"excludeRules":[]}},"postgresGID":-1,"postgresUID":-1,"postgresql":{"ldap":{},"parameters":{"hot_standby_feedback":"on","max_slot_wal_keep_size":"2000MB","shared_buffers":"128MB"},"pg_hba":[],"pg_ident":[],"shared_preload_libraries":[],"synchronous":{}},"primaryUpdateMethod":"switchover","primaryUpdateStrategy":"unsupervised","priorityClassName":"","resources":{"limits":{"hugepages-2Mi":"256Mi"},"requests":{"cpu":"100m","memory":"256Mi"}},"roles":[],"serviceAccountTemplate":{},"services":{},"storage":{"size":"10Gi","storageClass":""},"superuserSecret":"","walStorage":{"enabled":true,"size":"2Gi","storageClass":""}}` | Cluster settings | | cluster.affinity | object | `{"enablePodAntiAffinity":true,"topologyKey":"kubernetes.io/hostname"}` | Affinity/Anti-affinity rules for Pods. See: https://cloudnative-pg.io/documentation/current/cloudnative-pg.v1/#postgresql-cnpg-io-v1-AffinityConfiguration | | cluster.certificates | object | `{}` | The configuration for the CA and related certificates. See: https://cloudnative-pg.io/documentation/current/cloudnative-pg.v1/#postgresql-cnpg-io-v1-CertificatesConfiguration | diff --git a/charts/postgres-cluster/templates/_helpers.tpl b/charts/postgres-cluster/templates/_helpers.tpl index 343f26a..40306bf 100644 --- a/charts/postgres-cluster/templates/_helpers.tpl +++ b/charts/postgres-cluster/templates/_helpers.tpl @@ -94,3 +94,10 @@ Generate name for recovery object store credentials {{- printf "%s-backup-secret" (include "cluster.name" .) | trunc 63 | trimSuffix "-" -}} {{- end }} {{- end }} + +{{/* +Generate name for backup object store credentials +*/}} +{{- define "cluster.backupCredentials" -}} + {{- printf "%s-backup-secret" (include "cluster.name" .) | trunc 63 | trimSuffix "-" -}} +{{- end }} diff --git a/charts/postgres-cluster/templates/cluster.yaml b/charts/postgres-cluster/templates/cluster.yaml index b48d445..e7ea638 100644 --- a/charts/postgres-cluster/templates/cluster.yaml +++ b/charts/postgres-cluster/templates/cluster.yaml @@ -22,15 +22,12 @@ spec: {{ if or (eq .Values.backup.method "objectStore") (eq .Values.recovery.method "objectStore") }} plugins: {{ end }} - {{ if and (.Values.backup.enabled) (eq .Values.backup.method "objectStore") }} - {{ $context := . -}} - {{ range .Values.backup.objectStore -}} + {{- range $objectStore := .Values.backup.objectStore }} - name: barman-cloud.cloudnative-pg.io - isWALArchiver: {{ .isWALArchiver }} + isWALArchiver: {{ $objectStore.isWALArchiver }} parameters: - barmanObjectName: "{{ include "cluster.name" $context }}-{{ .name }}-backup" - {{ end -}} - {{ end }} + barmanObjectName: "{{ include "cluster.name" $ }}-{{ $objectStore.name }}-backup" + {{- end }} {{ if eq .Values.recovery.method "objectStore" }} - name: barman-cloud.cloudnative-pg.io parameters: diff --git a/charts/postgres-cluster/templates/object-store.yaml b/charts/postgres-cluster/templates/object-store.yaml index 2e3b835..558716c 100644 --- a/charts/postgres-cluster/templates/object-store.yaml +++ b/charts/postgres-cluster/templates/object-store.yaml @@ -27,10 +27,10 @@ spec: {{- if .wal }} wal: compression: {{ .wal.compression | default "snappy" }} - {{- with .wal.encryption }} + {{ with .wal.encryption }} encryption: {{ . }} - {{- end }} - maxParallel: {{ .wal.maxParallel | default 1 }} + {{ end }} + maxParallel: {{ .wal.maxParallel | default "1" }} {{- end }} {{- if .wal }} data: @@ -45,14 +45,14 @@ spec: {{- if .endpointCredentials }} name: {{ .endpointCredentials }} {{- else }} - name: {{- printf "%s-backup-secret" (include "cluster.name" $context) | trunc 63 | trimSuffix "-" -}} + name: {{ include "cluster.recoveryCredentials" $context }} {{- end }} key: ACCESS_KEY_ID secretAccessKey: {{- if .endpointCredentials }} name: {{ .endpointCredentials }} {{- else }} - name: {{- printf "%s-backup-secret" (include "cluster.name" $context) | trunc 63 | trimSuffix "-" -}} + name: {{ include "cluster.recoveryCredentials" $context }} {{- end }} key: ACCESS_SECRET_KEY {{ end -}} diff --git a/charts/postgres-cluster/templates/scheduled-backup.yaml b/charts/postgres-cluster/templates/scheduled-backup.yaml index ad0b6c5..9b5679a 100644 --- a/charts/postgres-cluster/templates/scheduled-backup.yaml +++ b/charts/postgres-cluster/templates/scheduled-backup.yaml @@ -10,15 +10,15 @@ metadata: labels: {{- include "cluster.labels" $context | nindent 4 }} spec: - immediate: true - suspend: {{ .suspend }} - schedule: {{ .schedule | quote }} - backupOwnerReference: {{ .backupOwnerReference }} + immediate: {{ .immediate | default true }} + suspend: {{ .suspend | default false }} + schedule: {{ .schedule | quote | required "Schedule is required" }} + backupOwnerReference: {{ .backupOwnerReference | default "self" }} cluster: name: {{ include "cluster.name" $context }}-cluster method: plugin pluginConfiguration: - name: {{ .plugin }} + name: {{ .plugin | default "barman-cloud.cloudnative-pg.io" }} parameters: barmanObjectName: "{{ include "cluster.name" $context }}-{{ .backupName }}-backup" {{ end -}} diff --git a/charts/postgres-cluster/values.yaml b/charts/postgres-cluster/values.yaml index 6a893ec..cde8a49 100644 --- a/charts/postgres-cluster/values.yaml +++ b/charts/postgres-cluster/values.yaml @@ -418,7 +418,7 @@ recovery: backup: # -- You need to configure backups manually, so backups are disabled by default. - enabled: true + enabled: false # -- Method to create backups, options currently are only objectStore method: objectStore @@ -485,25 +485,30 @@ backup: # # -- Number of data files to be archived or restored in parallel. # jobs: 1 - scheduledBackups: - - - # -- Scheduled backup name - name: daily-backup + # -- List of scheduled backups + scheduledBackups: [] - # -- Schedule in cron format - schedule: "0 0 */3 * *" + # - + # # -- Scheduled backup name + # name: daily-backup - # -- Temporarily stop scheduled backups from running - suspend: false + # # -- Schedule in cron format + # schedule: "0 0 */3 * *" - # -- Backup owner reference - backupOwnerReference: self + # # -- Start backup on deployment + # immediate: false - # -- Backup method, can be `barman-cloud.cloudnative-pg.io` (default) - plugin: barman-cloud.cloudnative-pg.io + # # -- Temporarily stop scheduled backups from running + # suspend: false - # -- Name of backup target - backupName: external + # # -- Backup owner reference + # backupOwnerReference: self + + # # -- Backup method, can be `barman-cloud.cloudnative-pg.io` (default) + # plugin: barman-cloud.cloudnative-pg.io + + # # -- Name of backup target + # backupName: external # -- List of PgBouncer poolers poolers: []