[DCAE-HV-VES] Move to use strimzi kafka tpl
[oom.git] / kubernetes / dcaegen2-services / common / dcaegen2-services-common / templates / _deployment.tpl
index 3b68ad5..6713031 100644 (file)
@@ -60,11 +60,19 @@ the the literal string "An example value".
 - name: {{ $envName }}
   value: {{ tpl $envValue $global | quote }}
       {{- else }}
-        {{ if or (not $envValue.secretUid) (not $envValue.key) }}
-          {{ fail (printf "Env %s definition is not a string and does not contain secretUid or key fields" $envName) }}
-        {{- end }}
+        {{- if and (hasKey $envValue "externalSecret") ($envValue.externalSecret) }}
+- name: {{ $envName }}
+  valueFrom:
+    secretKeyRef:
+      name: {{ tpl $envValue.externalSecretUid $global | quote }}
+      key: {{ tpl $envValue.key $global | quote }}
+        {{- else }}
+          {{ if or (not $envValue.secretUid) (not $envValue.key) }}
+            {{ fail (printf "Env %s definition is not a string and does not contain secretUid or key fields" $envName) }}
+          {{- end }}
 - name: {{ $envName }}
   {{- include "common.secret.envFromSecretFast" (dict "global" $global "uid" $envValue.secretUid "key" $envValue.key) | indent 2 }}
+        {{- end }}
       {{- end -}}
     {{- end }}
   {{- end }}