From fcc29bc65a5c87ed943a5d4d8459de8741b285e4 Mon Sep 17 00:00:00 2001 From: bozorgmehr96 <49644578+bozorgmehr96@users.noreply.github.com> Date: Tue, 17 Dec 2024 15:57:12 +0330 Subject: [PATCH] Fix ArgoCD diff on postgresql keys (#441) Signed-off-by: Mohammad Bozorgmehr Signed-off-by: Itay Grudev Co-authored-by: Mohammad Bozorgmehr Co-authored-by: Itay Grudev --- charts/cluster/templates/_bootstrap.tpl | 2 ++ charts/cluster/templates/cluster.yaml | 28 ++++++++++++++++++------- 2 files changed, 23 insertions(+), 7 deletions(-) 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" }} diff --git a/charts/cluster/templates/cluster.yaml b/charts/cluster/templates/cluster.yaml index a39841757..58a641405 100644 --- a/charts/cluster/templates/cluster.yaml +++ b/charts/cluster/templates/cluster.yaml @@ -24,12 +24,16 @@ spec: postgresGID: {{ include "cluster.postgresGID" . }} storage: size: {{ .Values.cluster.storage.size }} + {{- if not (empty .Values.cluster.storage.storageClass) }} storageClass: {{ .Values.cluster.storage.storageClass }} -{{- if .Values.cluster.walStorage.enabled }} + {{- 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 }} + {{- end }} {{- with .Values.cluster.resources }} resources: {{- toYaml . | nindent 4 }} @@ -43,7 +47,9 @@ spec: {{- toYaml . | nindent 4 }} {{- end }} + {{- if .Values.cluster.priorityClassName }} priorityClassName: {{ .Values.cluster.priorityClassName }} + {{- end }} primaryUpdateMethod: {{ .Values.cluster.primaryUpdateMethod }} primaryUpdateStrategy: {{ .Values.cluster.primaryUpdateStrategy }} @@ -59,6 +65,7 @@ spec: {{ end }} enablePDB: {{ .Values.cluster.enablePDB }} postgresql: + {{- if or (eq .Values.type "timescaledb") (not (empty .Values.cluster.postgresql.shared_preload_libraries)) }} shared_preload_libraries: {{- if eq .Values.type "timescaledb" }} - timescaledb @@ -66,20 +73,27 @@ spec: {{- with .Values.cluster.postgresql.shared_preload_libraries }} {{- toYaml . | nindent 6 }} {{- end }} - {{- with .Values.cluster.postgresql }} + {{- end }} + {{- 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 }} + {{- if not (empty .Values.cluster.roles) }} managed: {{- with .Values.cluster.roles }} roles: {{- toYaml . | nindent 6 }} {{ end }} + {{- end }} {{- with .Values.cluster.serviceAccountTemplate }} serviceAccountTemplate: