From 0d463642fb112a01a92e41abc27fe8332aa5bd2a Mon Sep 17 00:00:00 2001 From: Krzysztof Opasiak Date: Wed, 22 Sep 2021 20:44:49 +0200 Subject: [COMMON] Fix genericKV cache generation Make sure that the envs sections gets tpl and cached properly. Issue-ID: OOM-1 Signed-off-by: Krzysztof Opasiak Change-Id: I4064bdf3204a61a30b7296503c99e7931bae8cd2 --- kubernetes/common/common/templates/_secret.tpl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'kubernetes/common') diff --git a/kubernetes/common/common/templates/_secret.tpl b/kubernetes/common/common/templates/_secret.tpl index 2490debffb..9d284de500 100644 --- a/kubernetes/common/common/templates/_secret.tpl +++ b/kubernetes/common/common/templates/_secret.tpl @@ -193,7 +193,7 @@ type: Opaque {{- $entry := dict }} {{- $uid := tpl (default "" $secret.uid) $global }} {{- $keys := keys $secret }} - {{- range $key := (without $keys "annotations" "filePaths" )}} + {{- range $key := (without $keys "annotations" "filePaths" "envs" )}} {{- $_ := set $entry $key (tpl (index $secret $key) $global) }} {{- end }} {{- if $secret.annotations }} @@ -213,12 +213,21 @@ type: Opaque {{- $_ := set $entry "filePaths" $secret.filePaths }} {{- end }} {{- end }} + {{- if $secret.envs }} + {{- $envsCache := (list) }} + {{- range $env := $secret.envs }} + {{- $tplValue := tpl (default "" $env.value) $global }} + {{- $envsCache = append $envsCache (dict "name" $env.name "policy" $env.policy "value" $tplValue) }} + {{- end }} + {{- $_ := set $entry "envs" $envsCache }} + {{- end }} {{- $realName := default (include "common.secret.genNameFast" (dict "global" $global "uid" $uid "name" $entry.name) ) $entry.externalSecret }} {{- $_ := set $entry "realName" $realName }} {{- $_ := set $secretCache $uid $entry }} {{- end }} {{- $_ := set $global.Values "_secretsCache" $secretCache }} {{- end }} + {{- end -}} {{/* -- cgit 1.2.3-korg