{{- if and .Values.postgresql.enabled .Values.postgresql.backup.enabled }} apiVersion: postgresql.cnpg.io/v1 kind: ScheduledBackup metadata: name: {{ .Values.postgresql.clusterName }}-scheduled-backup namespace: {{ .Release.Namespace }} labels: {{- include "caduser.labels" . | nindent 4 }} spec: # Run an immediate backup when the ScheduledBackup is created immediate: {{ .Values.postgresql.backup.schedule.immediate }} # Schedule backups using cron expression schedule: {{ .Values.postgresql.backup.schedule.cron | quote }} # Use Barman Cloud plugin for backups method: plugin # Configure the Barman Cloud plugin pluginConfiguration: name: barman-cloud.cloudnative-pg.io parameters: barmanObjectName: {{ .Values.postgresql.clusterName }} # Reference to the PostgreSQL cluster cluster: name: {{ .Values.postgresql.clusterName }} # Set the cluster as the owner of the backup resources backupOwnerReference: cluster {{- end }}