[bitnami/postgresql] Don't put postgresql-postgres-password in secret when not needed (#5635)

* Don't put postgresql-postgres-password in secret when not needed

When only using the "postgres" user, the secret gets updated every helm upgrade with a
random string. When using with argocd (and maybe other gitops tools) there are always
changes until you put a dummy value into postgresqlPostgresPassword.

Use the same conditional as in statefulset.yaml:
~~~
{{- if not (eq (include "postgresql.username" .) "postgres")  }}
  # (..)
- name: POSTGRES_POSTGRES_PASSWORD
  valueFrom:
    secretKeyRef:
      name: {{ template "postgresql.secretName" . }}
      key: postgresql-postgres-password
{{- end }}
{{- end }}
~~~

* Use same conditional for readreplicas

In PR #4380 we forgot to also change the 2nd statefulset for the readreplicas
This commit is contained in:
Marco Kilchhofer
2021-03-03 12:24:44 +01:00
committed by GitHub
parent c733816381
commit db08f68c1b
3 changed files with 4 additions and 2 deletions

View File

@@ -26,4 +26,4 @@ name: postgresql
sources:
- https://github.com/bitnami/bitnami-docker-postgresql
- https://www.postgresql.org/
version: 10.3.7
version: 10.3.8

View File

@@ -11,7 +11,9 @@ metadata:
namespace: {{ .Release.Namespace }}
type: Opaque
data:
{{- if not (eq (include "postgresql.username" .) "postgres") }}
postgresql-postgres-password: {{ include "postgresql.postgres.password" . | b64enc | quote }}
{{- end }}
postgresql-password: {{ include "postgresql.password" . | b64enc | quote }}
{{- if .Values.replication.enabled }}
postgresql-replication-password: {{ include "postgresql.replication.password" . | b64enc | quote }}

View File

@@ -176,7 +176,7 @@ spec:
value: {{ template "common.names.fullname" . }}
- name: POSTGRES_MASTER_PORT_NUMBER
value: {{ include "postgresql.port" . | quote }}
{{- if and (not (eq .Values.postgresqlUsername "postgres")) (or .Values.postgresqlPostgresPassword (include "postgresql.useExistingSecret" .)) }}
{{- if not (eq (include "postgresql.username" .) "postgres") }}
{{- if .Values.usePasswordFile }}
- name: POSTGRES_POSTGRES_PASSWORD_FILE
value: "/opt/bitnami/postgresql/secrets/postgresql-postgres-password"