diff options
-rw-r--r-- | kubernetes/common/common/templates/_secret.yaml | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/kubernetes/common/common/templates/_secret.yaml b/kubernetes/common/common/templates/_secret.yaml index 0aff3a647b..55cb9bb9c8 100644 --- a/kubernetes/common/common/templates/_secret.yaml +++ b/kubernetes/common/common/templates/_secret.yaml @@ -115,10 +115,13 @@ type: Opaque */}} {{- define "common.secret.getSecretName" -}} {{- $global := .global }} - {{- $targetName := include "common.secret._genName" (dict "global" $global "uid" .uid "name" .name) }} + {{- $name := tpl (default "" .name) $global }} + {{- $uid := .uid }} + {{- $targetName := default (include "common.secret._genName" (dict "global" $global "uid" .uid "name" .name)) $name}} {{- range $secret := $global.Values.secrets }} - {{- $currName := include "common.secret._genName" (dict "global" $global "uid" $secret.uid "name" $secret.name) }} - {{- if eq $currName $targetName }} + {{- $givenName := tpl (default "" $secret.name) $global }} + {{- $currName := default (include "common.secret._genName" (dict "global" $global "uid" $secret.uid "name" $secret.name)) $givenName }} + {{- if or (eq $uid $secret.uid) (eq $currName $targetName) }} {{- $externalSecret := tpl (default "" $secret.externalSecret) $global }} {{- default $currName $externalSecret }} {{- end }} |