From 0e70266892c79b8d93dccb156130ce1587d96155 Mon Sep 17 00:00:00 2001 From: Mohammad Bozorgmehr Date: Fri, 8 Nov 2024 22:31:32 +0330 Subject: [PATCH 1/6] Fix ArgoCD diff on postgresql keys Signed-off-by: Mohammad Bozorgmehr --- charts/cluster/templates/cluster.yaml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/charts/cluster/templates/cluster.yaml b/charts/cluster/templates/cluster.yaml index 169683fef..eb9beb690 100644 --- a/charts/cluster/templates/cluster.yaml +++ b/charts/cluster/templates/cluster.yaml @@ -59,14 +59,18 @@ spec: {{- with .Values.cluster.postgresql.shared_preload_libraries }} {{- toYaml . | nindent 6 }} {{- end }} - {{- with .Values.cluster.postgresql }} + {{- with .Values.cluster.postgresql.pg_hba }} pg_hba: - {{- toYaml .pg_hba | nindent 6 }} + {{- toYaml . | nindent 6 }} + {{- end }} + {{- with .Values.cluster.postgresql.pg_ident }} pg_ident: - {{- toYaml .pg_ident | nindent 6 }} + {{- toYaml . | nindent 6 }} + {{- end }} + {{- with .Values.cluster.postgresql.parameters }} parameters: - {{- toYaml .parameters | nindent 6 }} - {{ end }} + {{- toYaml . | nindent 6 }} + {{- end }} managed: {{- with .Values.cluster.roles }} From 26b3c44d81e0dd7002596bcb880fe4df1d53d839 Mon Sep 17 00:00:00 2001 From: Mohammad Bozorgmehr Date: Fri, 8 Nov 2024 22:32:41 +0330 Subject: [PATCH 2/6] Add condition to add shared_preload_libraries Signed-off-by: Mohammad Bozorgmehr --- charts/cluster/templates/cluster.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/charts/cluster/templates/cluster.yaml b/charts/cluster/templates/cluster.yaml index eb9beb690..6ac70b4c0 100644 --- a/charts/cluster/templates/cluster.yaml +++ b/charts/cluster/templates/cluster.yaml @@ -52,6 +52,7 @@ spec: name: {{ . }} {{ end }} postgresql: + {{- if or (eq .Values.type "timescaledb") (not (empty .Values.cluster.postgresql.shared_preload_libraries)) }} shared_preload_libraries: {{- if eq .Values.type "timescaledb" }} - timescaledb @@ -59,6 +60,7 @@ spec: {{- with .Values.cluster.postgresql.shared_preload_libraries }} {{- toYaml . | nindent 6 }} {{- end }} + {{- end }} {{- with .Values.cluster.postgresql.pg_hba }} pg_hba: {{- toYaml . | nindent 6 }} From 40a76d3f3fd9322aa1ed72f9714e95578c4f0fc4 Mon Sep 17 00:00:00 2001 From: Mohammad Bozorgmehr Date: Fri, 8 Nov 2024 22:33:57 +0330 Subject: [PATCH 3/6] Wrap postInitApplicationSQL in a if to prevent generating empty keys Signed-off-by: Mohammad Bozorgmehr --- charts/cluster/templates/_bootstrap.tpl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/charts/cluster/templates/_bootstrap.tpl b/charts/cluster/templates/_bootstrap.tpl index aea7d9429..36f5b73cf 100644 --- a/charts/cluster/templates/_bootstrap.tpl +++ b/charts/cluster/templates/_bootstrap.tpl @@ -10,6 +10,7 @@ bootstrap: {{- if .Values.cluster.initdb.owner }} owner: {{ tpl .Values.cluster.initdb.owner . }} {{- end }} + {{- if or (eq .Values.type "postgis") (eq .Values.type "timescaledb") (not (empty .Values.cluster.initdb.postInitApplicationSQL)) }} postInitApplicationSQL: {{- if eq .Values.type "postgis" }} - CREATE EXTENSION IF NOT EXISTS postgis; @@ -24,6 +25,7 @@ bootstrap: {{- printf "- %s" . | nindent 6 }} {{- end -}} {{- end -}} + {{- end }} {{- else if eq .Values.mode "recovery" -}} bootstrap: {{- if eq .Values.recovery.method "pg_basebackup" }} From e82d3322f4c4498ecd8d76de929603d2df407ce6 Mon Sep 17 00:00:00 2001 From: Mohammad Bozorgmehr Date: Fri, 8 Nov 2024 22:34:45 +0330 Subject: [PATCH 4/6] Wrap managed in a if to prevent generating empty keys Signed-off-by: Mohammad Bozorgmehr --- charts/cluster/templates/cluster.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/charts/cluster/templates/cluster.yaml b/charts/cluster/templates/cluster.yaml index 6ac70b4c0..4aaa0bae3 100644 --- a/charts/cluster/templates/cluster.yaml +++ b/charts/cluster/templates/cluster.yaml @@ -74,11 +74,13 @@ spec: {{- toYaml . | nindent 6 }} {{- end }} + {{- if not (empty .Values.cluster.roles) }} managed: {{- with .Values.cluster.roles }} roles: {{- toYaml . | nindent 6 }} {{ end }} + {{- end }} monitoring: enablePodMonitor: {{ and .Values.cluster.monitoring.enabled .Values.cluster.monitoring.podMonitor.enabled }} From b1d7301611973d6f7b40f35c3a3e1563390797c6 Mon Sep 17 00:00:00 2001 From: Mohammad Bozorgmehr Date: Fri, 8 Nov 2024 22:35:26 +0330 Subject: [PATCH 5/6] Wrap priorityClassName in a if to prevent generating empty keys Signed-off-by: Mohammad Bozorgmehr --- charts/cluster/templates/cluster.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/charts/cluster/templates/cluster.yaml b/charts/cluster/templates/cluster.yaml index 4aaa0bae3..4ee3fafd8 100644 --- a/charts/cluster/templates/cluster.yaml +++ b/charts/cluster/templates/cluster.yaml @@ -37,7 +37,9 @@ spec: affinity: {{- toYaml . | nindent 4 }} {{- end }} + {{- if .Values.cluster.priorityClassName }} priorityClassName: {{ .Values.cluster.priorityClassName }} + {{- end }} primaryUpdateMethod: {{ .Values.cluster.primaryUpdateMethod }} primaryUpdateStrategy: {{ .Values.cluster.primaryUpdateStrategy }} From d08bd5a839034737e25c81baffc229381f927de4 Mon Sep 17 00:00:00 2001 From: Mohammad Bozorgmehr Date: Fri, 8 Nov 2024 22:36:32 +0330 Subject: [PATCH 6/6] Wrap storage.storageClass and walStorage.storageClass in if condition Signed-off-by: Mohammad Bozorgmehr --- charts/cluster/templates/cluster.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/charts/cluster/templates/cluster.yaml b/charts/cluster/templates/cluster.yaml index 4ee3fafd8..5d6c19309 100644 --- a/charts/cluster/templates/cluster.yaml +++ b/charts/cluster/templates/cluster.yaml @@ -23,11 +23,15 @@ spec: postgresGID: {{ include "cluster.postgresGID" . }} storage: size: {{ .Values.cluster.storage.size }} + {{- if not (empty .Values.cluster.storage.storageClass) }} storageClass: {{ .Values.cluster.storage.storageClass }} + {{- end }} {{- if .Values.cluster.walStorage.enabled }} walStorage: size: {{ .Values.cluster.walStorage.size }} + {{- if not (empty .Values.cluster.walStorage.storageClass) }} storageClass: {{ .Values.cluster.walStorage.storageClass }} + {{- end }} {{- end }} {{- with .Values.cluster.resources }} resources: