Skip to content

Commit

Permalink
Fix postgres password issue in quickstart
Browse files Browse the repository at this point in the history
  • Loading branch information
t94j0 committed Apr 24, 2024
1 parent ac1c453 commit 3f1a6aa
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
24 changes: 19 additions & 5 deletions helm/quickstart/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,29 @@ data:

{{- $existingSecret := (lookup "v1" "Secret" .Release.Namespace .Values.postgres.secretName) | default dict }}
{{- $existingSecretData := (get $existingSecret "data") | default dict }}
{{- $postgresPassword := (get $existingSecretData "postgres-password") | default (randAlphaNum 24 | b64enc) }}
{{- $postgresPassword := (get $existingSecretData "postgres-password") }}
{{- if not $postgresPassword}}
{{- if .Values.postgres.password }}
{{- $postgresPassword = .Values.postgres.password | b64enc }}
{{- else }}
{{- $postgresPassword = randAlphaNum 32 | b64enc }}
{{- end }}
{{- end }}
postgres-password: {{ $postgresPassword | quote }}

pgadmin-email: {{ default "nemesis@nemesis.com" .Values.postgres.pgadminEmail | b64enc }}

{{- $existingPGAdminSecret := (lookup "v1" "Secret" .Release.Namespace .Values.postgres.secretName) | default dict }}
{{- $existingPGAdminSecretData := (get $existingPGAdminSecret "data") | default dict }}
{{- $pgAdminPassword := (get $existingPGAdminSecretData "pgagmin-password") | default (randAlphaNum 24 | b64enc) }}
pgadmin-password: {{ $pgAdminPassword | quote }}
{{- $existingSecret := (lookup "v1" "Secret" .Release.Namespace .Values.postgres.secretName) | default dict }}
{{- $existingSecretData := (get $existingSecret "data") | default dict }}
{{- $pgadminPassword := (get $existingSecretData "postgres-password") }}
{{- if not $pgadminPassword}}
{{- if .Values.postgres.password }}
{{- $pgadminPassword = .Values.postgres.password | b64enc }}
{{- else }}
{{- $pgadminPassword = randAlphaNum 32 | b64enc }}
{{- end }}
{{- end }}
pgadmin-password: {{ $pgadminPassword | quote }}
---
apiVersion: v1
kind: Secret
Expand Down
1 change: 1 addition & 0 deletions helm/quickstart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ dashboard:
postgres:
secretName: postgres-creds
username: "nemesis"
password:
pgadminEmail: "nemesis@nemesis.com"
# Add a value to the password field to set a static password
pgadminPassword:
Expand Down

0 comments on commit 3f1a6aa

Please sign in to comment.