diff --git a/charts/postgres-cluster/Chart.yaml b/charts/postgres-cluster/Chart.yaml index 5028378..800a294 100644 --- a/charts/postgres-cluster/Chart.yaml +++ b/charts/postgres-cluster/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: postgres-cluster -version: 6.17.3 +version: 6.18.0 description: Cloudnative-pg Cluster keywords: - database diff --git a/charts/postgres-cluster/README.md b/charts/postgres-cluster/README.md index 9aef8c0..97c6a4b 100644 --- a/charts/postgres-cluster/README.md +++ b/charts/postgres-cluster/README.md @@ -1,6 +1,6 @@ # postgres-cluster -![Version: 6.17.3](https://img.shields.io/badge/Version-6.17.3-informational?style=flat-square) ![AppVersion: v1.28.0](https://img.shields.io/badge/AppVersion-v1.28.0-informational?style=flat-square) +![Version: 6.18.0](https://img.shields.io/badge/Version-6.18.0-informational?style=flat-square) ![AppVersion: v1.28.0](https://img.shields.io/badge/AppVersion-v1.28.0-informational?style=flat-square) Cloudnative-pg Cluster diff --git a/charts/postgres-cluster/templates/_bootstrap.tpl b/charts/postgres-cluster/templates/_bootstrap.tpl index 5c38327..4c18908 100644 --- a/charts/postgres-cluster/templates/_bootstrap.tpl +++ b/charts/postgres-cluster/templates/_bootstrap.tpl @@ -23,7 +23,7 @@ bootstrap: {{- else if eq .Values.mode "recovery" -}} bootstrap: -{{- if eq .Values.recovery.method "pgBaseBackup" }} + {{- if eq .Values.recovery.method "pgBaseBackup" }} pg_basebackup: source: pgBaseBackupSource {{ with .Values.recovery.pgBaseBackup.database }} @@ -36,10 +36,8 @@ bootstrap: secret: {{- toYaml . | nindent 6 }} {{- end }} -externalClusters: - {{- include "cluster.externalSourceCluster" (list "pgBaseBackupSource" .Values.recovery.pgBaseBackup.source) | nindent 2 }} -{{- else if eq .Values.recovery.method "import" }} + {{- else if eq .Values.recovery.method "import" }} initdb: {{- with .Values.cluster.initdb }} {{- with (omit . "owner" "import" "postInitApplicationSQL") }} @@ -82,10 +80,8 @@ externalClusters: pgRestoreExtraOptions: {{- . | toYaml | nindent 8 }} {{- end }} -externalClusters: - {{- include "cluster.externalSourceCluster" (list "importSource" .Values.recovery.import.source) | nindent 2 }} -{{- else if eq .Values.recovery.method "backup" }} + {{- else if eq .Values.recovery.method "backup" }} recovery: {{- with .Values.recovery.backup.pitrTarget.time }} recoveryTarget: @@ -100,7 +96,7 @@ externalClusters: backup: name: {{ .Values.recovery.backup.backupName }} -{{- else if eq .Values.recovery.method "objectStore" }} + {{- else if eq .Values.recovery.method "objectStore" }} recovery: {{- with .Values.recovery.objectStore.pitrTarget.time }} recoveryTarget: @@ -114,19 +110,9 @@ externalClusters: {{- end }} source: {{ include "cluster.recoveryServerName" . }} -externalClusters: - - name: {{ include "cluster.recoveryServerName" . }} - plugin: - name: barman-cloud.cloudnative-pg.io - enabled: true - isWALArchiver: false - parameters: - barmanObjectName: "{{ include "cluster.name" . }}-{{ .Values.recovery.objectStore.name }}" - serverName: {{ include "cluster.recoveryServerName" . }} - -{{- else }} - {{ fail "Invalid recovery mode!" }} -{{- end }} + {{- else }} + {{ fail "Invalid recovery mode!" }} + {{- end }} {{- else }} {{ fail "Invalid cluster mode!" }} diff --git a/charts/postgres-cluster/templates/_external_clusters.tpl b/charts/postgres-cluster/templates/_external_clusters.tpl new file mode 100644 index 0000000..9e6b503 --- /dev/null +++ b/charts/postgres-cluster/templates/_external_clusters.tpl @@ -0,0 +1,24 @@ +{{- define "cluster.externalClusters" -}} +externalClusters: +{{- if eq .Values.mode "standalone" }} +{{- else if eq .Values.mode "recovery" }} + {{- if eq .Values.recovery.method "pgBaseBackup" }} + - name: pgBaseBackupSource + {{- include "cluster.externalSourceCluster" .Values.recovery.pgBaseBackup.source | nindent 4 }} + {{- else if eq .Values.recovery.method "import" }} + - name: importSource + {{- include "cluster.externalSourceCluster" .Values.recovery.import.source | nindent 4 }} + {{- else if eq .Values.recovery.method "objectStore" }} + - name: {{ include "cluster.recoveryServerName" . }} + plugin: + name: barman-cloud.cloudnative-pg.io + enabled: true + isWALArchiver: false + barmanObjectStore: + barmanObjectName: "{{ include "cluster.name" . }}-{{ .Values.recovery.objectStore.name }}" + serverName: {{ include "cluster.recoveryServerName" . }} + {{- end }} +{{- else }} + {{ fail "Invalid cluster mode!" }} +{{- end }} +{{ end }} diff --git a/charts/postgres-cluster/templates/cluster.yaml b/charts/postgres-cluster/templates/cluster.yaml index 613ee7b..4a024b4 100644 --- a/charts/postgres-cluster/templates/cluster.yaml +++ b/charts/postgres-cluster/templates/cluster.yaml @@ -148,3 +148,4 @@ spec: {{- end }} {{ include "cluster.bootstrap" . | nindent 2 }} + {{ include "cluster.externalClusters" . | nindent 2 }}