Skip to content

Commit eb9b742

Browse files
committed
fix(cluster): ensure externalClusters is always defined during recovery
The _external_clusters.tpl template was modified to ensure that the externalClusters list is always explicitly defined when the cluster is in recovery mode. Previously, if recovery.method did not match pg_basebackup, import, or object_store, the externalClusters key might have been rendered without any associated list items, or possibly not at all depending on template rendering specifics. By repeating externalClusters: within each conditional block and adding an explicit else case that sets externalClusters: [], the template now guarantees a consistent and valid YAML structure for this field, preventing potential issues with YAML parsers expecting an empty list rather than just a key with no values. Signed-off-by: Enrique Hernández Bello <ehernandez@maarlab.com>
1 parent dc20328 commit eb9b742

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

charts/cluster/templates/_external_clusters.tpl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,23 @@
22
{{- if eq .Values.mode "standalone" }}
33
externalClusters: []
44
{{- else if eq .Values.mode "recovery" }}
5-
externalClusters:
65
{{- if eq .Values.recovery.method "pg_basebackup" }}
6+
externalClusters:
77
- name: pgBaseBackupSource
88
{{- include "cluster.externalSourceCluster" .Values.recovery.pgBaseBackup.source | nindent 4 }}
99
{{- else if eq .Values.recovery.method "import" }}
10+
externalClusters:
1011
- name: importSource
1112
{{- include "cluster.externalSourceCluster" .Values.recovery.import.source | nindent 4 }}
1213
{{- else if eq .Values.recovery.method "object_store" }}
14+
externalClusters:
1315
- name: objectStoreRecoveryCluster
1416
barmanObjectStore:
1517
serverName: {{ .Values.recovery.clusterName }}
1618
{{- $d := dict "chartFullname" (include "cluster.fullname" .) "scope" .Values.recovery "secretPrefix" "recovery" -}}
1719
{{- include "cluster.barmanObjectStoreConfig" $d | nindent 4 }}
20+
{{- else }}
21+
externalClusters: []
1822
{{- end }}
1923
{{- else if eq .Values.mode "replica" }}
2024
externalClusters:

0 commit comments

Comments
 (0)