aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes
diff options
context:
space:
mode:
authorBorislav Glozman <Borislav.Glozman@amdocs.com>2020-02-02 13:15:51 +0000
committerGerrit Code Review <gerrit@onap.org>2020-02-02 13:15:51 +0000
commitc3cb0527a0400d82668f660bb1126d10dbb77370 (patch)
treed02d12889797e0cb9cb0250a3a3442d7bab53fd0 /kubernetes
parent7336084fc365977b9588add74d1009fd039b46c3 (diff)
parentfd6676f06becc509961d8a9a06b60168e4884349 (diff)
Merge "[COMMON] Expose common.secret.genName template"
Diffstat (limited to 'kubernetes')
-rw-r--r--kubernetes/common/common/templates/_secret.yaml19
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 }}