Fix NATS app chart to use existing secret credentials when present

Signed-off-by: Isaiah Olson <isaiah@olson-network.com>
This commit is contained in:
Isaiah Olson
2025-11-05 01:08:13 -06:00
parent 5b96190be8
commit 1e8a9ee980

View File

@@ -1,6 +1,14 @@
{{- $cozyConfig := lookup "v1" "ConfigMap" "cozy-system" "cozystack" }}
{{- $clusterDomain := (index $cozyConfig.data "cluster-domain") | default "cozy.local" }}
{{- $existingSecret := lookup "v1" "Secret" .Release.Namespace (printf "%s-credentials" .Release.Name) }}
{{- $passwords := dict }}
{{- with (index $existingSecret "data") }}
{{- range $k, $v := . }}
{{- $_ := set $passwords $k (b64dec $v) }}
{{- end }}
{{- end }}
{{- range $user, $u := .Values.users }}
{{- if $u.password }}
{{- $_ := set $passwords $user $u.password }}