File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
stable/yugaware/templates Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -80,3 +80,19 @@ Validate Nginx SSL protocols
8080 { {- .Values.tls.sslProtocols -} }
8181 { {- end -} }
8282{ {- end -} }
83+
84+ { {/*
85+ Get or generate PG password
86+ Source - https://github.com/helm/charts/issues/5167#issuecomment-843962731
87+ */} }
88+ { {- define " getOrGeneratePassword" } }
89+ { {- $len := (default 8 .Length) | int -} }
90+ { {- $obj := (lookup " v1" .Kind .Namespace .Name).data -} }
91+ { {- if $obj } }
92+ { {- index $obj .Key -} }
93+ { {- else if (eq (lower .Kind) " secret" ) -} }
94+ { {- randAlphaNum $len | b64enc -} }
95+ { {- else -} }
96+ { {- randAlphaNum $len -} }
97+ { {- end -} }
98+ { {- end } }
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ metadata:
1111 heritage : {{ .Values.helm2Legacy | ternary "Tiller" (.Release.Service | quote) }}
1212data :
1313 postgres_user : " postgres"
14- postgres_password : " {{ b64enc (randAlphaNum 8 ) }}"
14+ postgres_password : " {{ include " getOrGeneratePassword" (dict "Namespace" .Release.Namespace "Kind" "ConfigMap" "Name" (printf "%s%s" .Release.Name "-yugaware-global-config") "Key" "postgres_password" ) }}"
1515 postgres_db : " yugaware"
1616 app_secret : " {{ b64enc (randAlphaNum 64) }}"
1717
You can’t perform that action at this time.
0 commit comments