diff options
Diffstat (limited to 'kubernetes/common/common/templates/_secret.yaml')
-rw-r--r-- | kubernetes/common/common/templates/_secret.yaml | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/kubernetes/common/common/templates/_secret.yaml b/kubernetes/common/common/templates/_secret.yaml index 55cb9bb9c8..e24a2e4ba7 100644 --- a/kubernetes/common/common/templates/_secret.yaml +++ b/kubernetes/common/common/templates/_secret.yaml @@ -76,8 +76,6 @@ type: Opaque {{/* - For internal use only! - Generate a secret name based on provided name or UID. If UID is provided then the name is generated by appending this UID right after the chart name. If name is provided, it overrides the name generation algorith @@ -90,11 +88,12 @@ type: Opaque - .name: string that can be used to override default name generation algorithm and provide a custom name for the secret */}} -{{- define "common.secret._genName" -}} +{{- define "common.secret.genName" -}} {{- $global := .global }} {{- $uid := tpl (default "" .uid) $global }} {{- $name := tpl (default "" .name) $global }} - {{- default (printf "%s-%s" (include "common.fullname" $global) $uid) $name }} + {{- $fullname := ne (default "" .chartName) "" | ternary (include "common.fullnameExplicit" (dict "dot" $global "chartName" .chartName)) (include "common.fullname" $global) }} + {{- default (printf "%s-%s" $fullname $uid) $name }} {{- end -}} {{/* @@ -116,12 +115,13 @@ type: Opaque {{- define "common.secret.getSecretName" -}} {{- $global := .global }} {{- $name := tpl (default "" .name) $global }} - {{- $uid := .uid }} - {{- $targetName := default (include "common.secret._genName" (dict "global" $global "uid" .uid "name" .name)) $name}} + {{- $uid := tpl (default "" .uid) $global }} + {{- $targetName := default (include "common.secret.genName" (dict "global" $global "uid" $uid "name" .name)) $name}} {{- range $secret := $global.Values.secrets }} {{- $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) }} + {{- $currUID := tpl (default "" $secret.uid) $global }} + {{- $currName := default (include "common.secret.genName" (dict "global" $global "uid" $currUID "name" $secret.name)) $givenName }} + {{- if or (eq $uid $currUID) (eq $currName $targetName) }} {{- $externalSecret := tpl (default "" $secret.externalSecret) $global }} {{- default $currName $externalSecret }} {{- end }} @@ -237,7 +237,8 @@ valueFrom: {{- define "common.secret" -}} {{- $global := . }} {{- range $secret := .Values.secrets }} - {{- $name := include "common.secret._genName" (dict "global" $global "uid" $secret.uid "name" $secret.name) }} + {{- $uid := tpl (default "" $secret.uid) $global }} + {{- $name := include "common.secret.genName" (dict "global" $global "uid" $uid "name" $secret.name) }} {{- $type := default "generic" $secret.type }} {{- $externalSecret := tpl (default "" $secret.externalSecret) $global }} {{- if not $externalSecret }} |