|
92 | 92 | {{- end -}}
|
93 | 93 |
|
94 | 94 | {{- define "gitlab.root_password" -}}
|
95 |
| -{{- print (randAlphaNum 10) -}} |
| 95 | +{{- $secretName := (printf "%v-credentials" .Values.gitlab.app_name) -}} |
| 96 | +{{- $password := default (randAlphaNum 10) .Values.gitlab.credentials.root_password }} |
| 97 | +{{- if not .Values.gitlab.credentials.root_password }} |
| 98 | +{{- $existingSecret := (lookup "v1" "Secret" .Values.gitlab.namespace $secretName) }} |
| 99 | +{{- if $existingSecret }} |
| 100 | +{{- $password = index $existingSecret.data "root_password" | b64dec }} |
| 101 | +{{- end -}} |
| 102 | +{{- end -}} |
| 103 | +{{- print $password -}} |
96 | 104 | {{- end -}}
|
97 | 105 |
|
98 | 106 | {{- define "gitlab.postgres.user" -}}
|
99 |
| -{{- print (randAlphaNum 10) -}} |
| 107 | +{{- $secretName := (printf "%v-credentials" .Values.gitlab.app_name) -}} |
| 108 | +{{- $username := default (randAlphaNum 10) .Values.gitlab.credentials.postgres_user }} |
| 109 | +{{- if not .Values.gitlab.credentials.postgres_user }} |
| 110 | +{{- $existingSecret := (lookup "v1" "Secret" .Values.gitlab.namespace $secretName) }} |
| 111 | +{{- if $existingSecret }} |
| 112 | +{{- $username = index $existingSecret.data "postgres_user" | b64dec }} |
| 113 | +{{- end -}} |
| 114 | +{{- end -}} |
| 115 | +{{- print $username -}} |
100 | 116 | {{- end -}}
|
101 | 117 |
|
102 | 118 | {{- define "gitlab.postgres.password" -}}
|
103 |
| -{{- print (randAlphaNum 10) -}} |
| 119 | +{{- $secretName := (printf "%v-credentials" .Values.gitlab.app_name) -}} |
| 120 | +{{- $password := default (randAlphaNum 10) .Values.gitlab.credentials.postgres_password }} |
| 121 | +{{- if not .Values.gitlab.credentials.postgres_password }} |
| 122 | +{{- $existingSecret := (lookup "v1" "Secret" .Values.gitlab.namespace $secretName) }} |
| 123 | +{{- if $existingSecret }} |
| 124 | +{{- $password = index $existingSecret.data "postgres_password" | b64dec }} |
| 125 | +{{- end -}} |
| 126 | +{{- end -}} |
| 127 | +{{- print $password -}} |
104 | 128 | {{- end -}}
|
105 | 129 |
|
106 | 130 | {{- define "gitlab.postgres.admin_password" -}}
|
107 |
| -{{- print (randAlphaNum 10) -}} |
| 131 | +{{- $secretName := (printf "%v-credentials" .Values.gitlab.app_name) -}} |
| 132 | +{{- $password := default (randAlphaNum 10) .Values.gitlab.credentials.postgres_admin_password }} |
| 133 | +{{- if not .Values.gitlab.credentials.postgres_admin_password }} |
| 134 | +{{- $existingSecret := (lookup "v1" "Secret" .Values.gitlab.namespace $secretName) }} |
| 135 | +{{- if $existingSecret }} |
| 136 | +{{- $password = index $existingSecret.data "postgres_admin_password" | b64dec }} |
| 137 | +{{- end -}} |
| 138 | +{{- end -}} |
| 139 | +{{- print $password -}} |
108 | 140 | {{- end -}}
|
0 commit comments