summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBorislav Glozman <Borislav.Glozman@amdocs.com>2020-02-02 13:11:09 +0000
committerGerrit Code Review <gerrit@onap.org>2020-02-02 13:11:09 +0000
commit8a4eb36da4b949d45ddd0f283d50c41276dba681 (patch)
treeaf21a0b31c910392993e09c26ef27691be00e525
parentd0783be2aa4422d3946623791653f1e2091f0983 (diff)
parentb9c30534d9af126401e1d038de0d4cf6d78b001e (diff)
Merge "[COMMON] Allow to search secret by uid even if name is Overridden"
-rw-r--r--kubernetes/common/common/templates/_secret.yaml9
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 }}