mirror of
https://github.com/truecharts/library-charts.git
synced 2026-07-05 11:16:22 -03:00
use old pg database password when available
This commit is contained in:
@@ -26,11 +26,21 @@
|
||||
{{- include "tc.v1.common.class.cnpg.pooler" $ -}}
|
||||
{{- end }}
|
||||
|
||||
{{- $basename := include "tc.v1.common.lib.chart.names.fullname" $ -}}
|
||||
{{- $fetchname := printf "%s-dbcreds" $basename -}}
|
||||
{{- $olddbprevious1 := lookup "v1" "Secret" .Release.Namespace $fetchname }}
|
||||
{{- $olddbprevious2 := lookup "v1" "Secret" .Release.Namespace "dbcreds" }}
|
||||
|
||||
|
||||
{{/* Inject the required secrets */}}
|
||||
{{- $dbPass := "" }}
|
||||
{{- $dbprevious := lookup "v1" "Secret" $.Release.Namespace ( printf "%s-user" $cnpgValues.name ) }}
|
||||
{{- if $dbprevious }}
|
||||
{{- $dbPass = ( index $dbprevious.data "user-password" ) | b64dec }}
|
||||
{{- else if $olddbprevious1 }}
|
||||
{{- $dbPass = ( index $olddbprevious1.data "postgresql-password" ) | b64dec }}
|
||||
{{- else if $olddbprevious2 }}
|
||||
{{- $dbPass = ( index $olddbprevious2.data "postgresql-password" ) | b64dec }}
|
||||
{{- else }}
|
||||
{{- $dbPass = $cnpgValues.password | default ( randAlphaNum 62 ) }}
|
||||
{{- end }}
|
||||
|
||||
Reference in New Issue
Block a user