[bitnami/postgresql-ha] Don't render empty keys from templates (#16576)

* Don't render empty keys from templates

Signed-off-by: Trey Hoffman <treyhoffman@outlook.com>

* Fix if/end closing when preventing empty keys from being rendered

Signed-off-by: Trey Hoffman <treyhoffman@outlook.com>

* Reduce to a single condition

Co-authored-by: Miguel Ruiz <miruiz@vmware.com>
Signed-off-by: Trey Hoffman <tgh19@pitt.edu>

* Close volumeMounts conditional after all items are listed

Signed-off-by: Trey Hoffman <treyhoffman@outlook.com>

* Fix indentation

Signed-off-by: Trey Hoffman <treyhoffman@outlook.com>

* Add missing .Values.pgpool.usePasswordFile and improve readability

Signed-off-by: Trey Hoffman <treyhoffman@outlook.com>

* Improve readability

Signed-off-by: Trey Hoffman <treyhoffman@outlook.com>

* Avoid rendering empty key for customMetrics volumeMounts

Signed-off-by: Trey Hoffman <treyhoffman@outlook.com>

* Improve readability of large or statement

Signed-off-by: Trey Hoffman <treyhoffman@outlook.com>

* Use single line or statement

Signed-off-by: Trey Hoffman <treyhoffman@outlook.com>

* Update bitnami/postgresql-ha/templates/postgresql/statefulset.yaml

Co-authored-by: Miguel Ruiz <miruiz@vmware.com>
Signed-off-by: Trey Hoffman <tgh19@pitt.edu>

---------

Signed-off-by: Trey Hoffman <treyhoffman@outlook.com>
Signed-off-by: Trey Hoffman <tgh19@pitt.edu>
Co-authored-by: Miguel Ruiz <miruiz@vmware.com>
This commit is contained in:
Trey Hoffman
2023-06-14 02:37:53 -04:00
committed by GitHub
parent bed6ebf253
commit 7e3eeb9625
3 changed files with 13 additions and 1 deletions

View File

@@ -80,6 +80,7 @@ spec:
{{- end }}
hostNetwork: {{ .Values.postgresql.hostNetwork }}
hostIPC: {{ .Values.postgresql.hostIPC }}
{{- if or .Values.postgresql.tls.enabled .Values.postgresql.initContainers .Values.postgresql.extraInitContainers (and .Values.volumePermissions.enabled (or (or (not (empty .Values.postgresql.extendedConf)) (not (empty .Values.postgresql.extendedConfCM))) .Values.persistence.enabled)) }}
initContainers:
{{- if .Values.postgresql.tls.enabled }}
- name: init-chmod-tls
@@ -131,6 +132,7 @@ spec:
{{- if or .Values.postgresql.initContainers .Values.postgresql.extraInitContainers }}
{{- include "common.tplvalues.render" ( dict "value" (coalesce .Values.postgresql.initContainers .Values.postgresql.extraInitContainers) "context" $ ) | nindent 8 }}
{{- end }}
{{- end }}
containers:
- name: postgresql
image: {{ include "postgresql-ha.postgresql.image" . }}
@@ -524,6 +526,7 @@ spec:
{{- if .Values.metrics.resources }}
resources: {{- toYaml .Values.metrics.resources | nindent 12 }}
{{- end }}
{{- if or .Values.postgresql.usePasswordFile .Values.metrics.customMetrics }}
volumeMounts:
{{- if .Values.postgresql.usePasswordFile }}
- name: password
@@ -533,6 +536,9 @@ spec:
- name: custom-metrics
mountPath: /conf
readOnly: true
{{- end }}
{{- end }}
{{- if .Values.metrics.customMetrics }}
{{- if .Values.diagnosticMode.enabled }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
{{- end }}