Use dig function to check for existing secret in NATS app template and prevent nil indexing

Signed-off-by: Isaiah Olson <isaiah@olson-network.com>
This commit is contained in:
Isaiah Olson
2025-11-05 18:12:05 -06:00
parent 1e8a9ee980
commit 627022972d

View File

@@ -3,7 +3,7 @@
{{- $existingSecret := lookup "v1" "Secret" .Release.Namespace (printf "%s-credentials" .Release.Name) }}
{{- $passwords := dict }}
{{- with (index $existingSecret "data") }}
{{- with (dig "data" (dict) $existingSecret) }}
{{- range $k, $v := . }}
{{- $_ := set $passwords $k (b64dec $v) }}
{{- end }}