diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index f6249b399..ed9863cc1 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -56,8 +56,8 @@ app: "{{ template "harbor.name" . }}" {{/* Helper for printing values from existing secrets*/}} {{- define "harbor.secretKeyHelper" -}} - {{- if and (not (empty .data)) (hasKey .data .key) }} - {{- index .data .key | b64dec -}} + {{- if and (not (empty (.data | default dict ))) (hasKey (.data | default dict ) .key) }} + {{- index (.data | default dict ) .key | b64dec -}} {{- end -}} {{- end -}} @@ -112,8 +112,8 @@ app: "{{ template "harbor.name" . }}" {{- define "harbor.database.rawPassword" -}} {{- if eq .Values.database.type "internal" -}} {{- $existingSecret := lookup "v1" "Secret" .Release.Namespace (include "harbor.database" .) -}} - {{- if and (not (empty $existingSecret)) (hasKey $existingSecret.data "POSTGRES_PASSWORD") -}} - {{- .Values.database.internal.password | default (index $existingSecret.data "POSTGRES_PASSWORD" | b64dec) -}} + {{- if and (not (empty $existingSecret)) (hasKey ($existingSecret.data | default dict) "POSTGRES_PASSWORD") -}} + {{- .Values.database.internal.password | default (index ($existingSecret.data | default dict) "POSTGRES_PASSWORD" | b64dec) -}} {{- else -}} {{- .Values.database.internal.password -}} {{- end -}}