diff options
author | Krzysztof Opasiak <k.opasiak@samsung.com> | 2020-04-01 09:59:44 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-04-01 09:59:44 +0000 |
commit | bf1af5c0a0caad1830bd2f56dded7d8d7fe35b3e (patch) | |
tree | be5cdd28e4f736e9fdd4c8359db80fb35019958e | |
parent | fb0f5bfaff8ba2b4897247e60a82b4ef28a5ca06 (diff) | |
parent | 5af320fc0c9e5f250e595cfa8daa93835016fca1 (diff) |
Merge "[COMMON] Allow to include filePaths as a reference to variable"
-rw-r--r-- | kubernetes/common/common/templates/_secret.tpl | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/kubernetes/common/common/templates/_secret.tpl b/kubernetes/common/common/templates/_secret.tpl index 78e94eab91..064b0c16af 100644 --- a/kubernetes/common/common/templates/_secret.tpl +++ b/kubernetes/common/common/templates/_secret.tpl @@ -196,7 +196,18 @@ type: Opaque {{- $_ := set $entry "annotations" $secret.annotations }} {{- end }} {{- if $secret.filePaths }} - {{- $_ := set $entry "filePaths" $secret.filePaths }} + {{- if kindIs "string" $secret.filePaths }} + {{- $evaluated := tpl (default "" $secret.filePaths) $global }} + {{- if and $evaluated (ne $evaluated "\"\"") }} + {{- $fstr := printf "val:\n%s" ($evaluated | indent 2) }} + {{- $flist := (index (tpl $fstr $global | fromYaml) "val") }} + {{- $_ := set $entry "filePaths" $flist }} + {{- else }} + {{- $_ := set $entry "filePaths" (list) }} + {{- end }} + {{- else }} + {{- $_ := set $entry "filePaths" $secret.filePaths }} + {{- end }} {{- end }} {{- $realName := default (include "common.secret.genNameFast" (dict "global" $global "uid" $uid "name" $entry.name) ) $entry.externalSecret }} {{- $_ := set $entry "realName" $realName }} @@ -465,6 +476,7 @@ stringData: {{- if eq $type "generic" }} data: {{- range $curFilePath := $secret.filePaths }} + {{- fail (printf "%s" $curFilePath) }} {{ tpl ($global.Files.Glob $curFilePath).AsSecrets $global | indent 2 }} {{- end }} {{- if $secret.filePath }} |