Merge "[COMMON] Optimize common secret template"
authorKrzysztof Opasiak <k.opasiak@samsung.com>
Wed, 25 Mar 2020 12:25:49 +0000 (12:25 +0000)
committerGerrit Code Review <gerrit@onap.org>
Wed, 25 Mar 2020 12:25:49 +0000 (12:25 +0000)
17 files changed:
kubernetes/common/common/templates/_secret.tpl [moved from kubernetes/common/common/templates/_secret.yaml with 58% similarity]
kubernetes/common/common/templates/_serviceMesh.tpl
kubernetes/common/dgbuilder/templates/configmap.yaml
kubernetes/common/dgbuilder/templates/deployment.yaml
kubernetes/common/dgbuilder/templates/secrets.yaml
kubernetes/common/dgbuilder/templates/service.yaml
kubernetes/common/mariadb-galera/templates/backup/cronjob.yaml
kubernetes/common/mariadb-galera/templates/configmap.yaml
kubernetes/common/mariadb-galera/templates/pv.yaml
kubernetes/common/mariadb-galera/templates/secrets.yaml
kubernetes/common/mariadb-galera/templates/service.yaml
kubernetes/common/mariadb-galera/templates/statefulset.yaml
kubernetes/common/network-name-gen/templates/deployment.yaml
kubernetes/common/network-name-gen/templates/secrets.yaml
kubernetes/common/network-name-gen/templates/service.yaml
kubernetes/common/postgres/templates/_deployment.tpl
kubernetes/common/postgres/templates/secrets.yaml

@@ -78,6 +78,38 @@ type: Opaque
   {{- end }}
 {{- end -}}
 
+{{/*
+  For internal use only!
+
+  Pick a value based on "user input" and generation policy.
+
+  The template takes below arguments:
+    - .global: environment (.)
+    - .secretName: name of the secret where the value will be placed
+    - .secretEnv: map of values which configures this secret. This can contain below keys:
+        - value: Value of secret key provided by user (can be a template inside a string)
+        - policy: What to do if value is missing or empty. Possible options are:
+            - generate: Generate a new password deriving it from master password
+            - required: Fail the deployment if value has not been provided
+          Defaults to generate.
+        - name: Name of the key to which this value should be assigned
+*/}}
+{{- define "common.secret._valueFast" -}}
+  {{- $global := .global }}
+  {{- $name := .secretName }}
+  {{- $secretEnv := .secretEnv }}
+  {{- $value := $secretEnv.value }}
+  {{- $policy := default "generate" $secretEnv.policy }}
+
+  {{- if $value }}
+    {{- $value | quote }}
+  {{- else if eq $policy "generate" }}
+    {{- include "common.createPassword" (dict "dot" $global "uid" $name) | quote }}
+  {{- else }}
+    {{- fail (printf "Value for %s secret %s key not provided" $name $secretEnv.name) }}
+  {{- end }}
+{{- end -}}
+
 
 {{/*
   Generate a secret name based on provided name or UID.
@@ -100,6 +132,14 @@ type: Opaque
   {{- default (printf "%s-%s" $fullname $uid) $name }}
 {{- end -}}
 
+{{- define "common.secret.genNameFast" -}}
+  {{- $global := .global }}
+  {{- $uid := (default "" .uid) }}
+  {{- $name := (default "" .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 -}}
+
 {{/*
   Get the real secret name by UID or name, based on the configuration provided by user.
   User may decide to not create a new secret but reuse existing one for this deployment
@@ -122,8 +162,8 @@ type: Opaque
   {{- $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 }}
     {{- $currUID := tpl (default "" $secret.uid) $global }}
+    {{- $givenName := tpl (default "" $secret.name) $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 }}
@@ -132,6 +172,37 @@ type: Opaque
   {{- end }}
 {{- end -}}
 
+{{- define "common.secret.getSecretNameFast" -}}
+  {{- $global := .global }}
+  {{- include "common.secret.buildCache" $global }}
+  {{- $secretsCache := $global.Values._secretsCache }}
+  {{- $uid := tpl .uid $global }}
+  {{- $secret := index $secretsCache $uid }}
+  {{- $secret.realName }}
+{{- end -}}
+
+{{- define "common.secret.buildCache" -}}
+  {{- $global := . }}
+  {{- if not $global.Values._secretsCache }}
+    {{- $secretCache := dict }}
+    {{- range $secret := .Values.secrets }}
+      {{- $entry := dict }}
+      {{- $uid := tpl (default "" $secret.uid) $global }}
+      {{- $keys := keys $secret }}
+      {{- range $key := (without $keys "annotations" )}}
+        {{- $_ := set $entry $key (tpl (index $secret $key) $global) }}
+      {{- end }}
+      {{- if $secret.annotations }}
+        {{- $_ := set $entry "annotations" $secret.annotations }}
+      {{- 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 -}}
+
 {{/*
   Convenience template which can be used to easily set the value of environment variable
   to the value of a key in a secret.
@@ -159,6 +230,14 @@ valueFrom:
     key: {{ $key }}
 {{- end -}}
 
+{{- define "common.secret.envFromSecretFast" -}}
+  {{- $key := .key }}
+valueFrom:
+  secretKeyRef:
+    name: {{ include "common.secret.getSecretNameFast" . }}
+    key: {{ $key }}
+{{- end -}}
+
 {{/*
   Define secrets to be used by chart.
   Every secret has a type which is one of:
@@ -285,3 +364,131 @@ stringData:
     {{- end }}
   {{- end }}
 {{- end -}}
+
+{{/*
+  Define secrets to be used by chart.
+  Every secret has a type which is one of:
+    - generic:
+        Generic secret template that allows to input some raw data (from files).
+        File Input can be passed as list of files (filePaths) or as a single string
+        (filePath)
+    - genericKV:
+        Type of secret which allows you to define a list of key value pairs.
+        The list is assiged to envs value. Every item may define below items:
+          - name:
+              Identifier of this value within secret
+          - value:
+              String that defines a value associated with given key.
+              This can be a simple string or a template.
+          - policy:
+              Defines what to do if value is not provided by the user.
+              Available options are:
+                - generate:
+                    Generate a value by derriving it from master password
+                - required:
+                    Fail the deployment
+    - password:
+        Type of secret that holds only the password.
+        Only two items can be defined for this type:
+          - password:
+              Equivalent of value field from genericKV
+          - policy:
+              The same meaning as for genericKV policy field
+    - basicAuth:
+        Type of secret that holds both username and password.
+        Below fields are available:
+          - login:
+              The value for login key.
+              This can be a simple string or a template.
+              Providing a value for login is always required.
+          - password:
+              The value for password key.
+              This can be a simple string or a template.
+          - passwordPolicy:
+              The same meaning as the policy field in genericKV.
+              Only the policy for password can be set.
+
+  Every secret can be identified using:
+    - uid:
+        A string to be appended to the chart fullname to generate a secret name.
+    - name:
+        Overrides default secret name generation and allows to set immutable
+        and globaly unique name
+    - annotations:
+        List of annotations to be used while defining a secret
+
+  To allow sharing a secret between the components and allow to pre-deploy secrets
+  before ONAP deployment it is possible to use already existing secret instead of
+  creating a new one. For this purpose externalSecret field can be used. If value of
+  this field is evaluated to true no new secret is created, only the name of the
+  secret is aliased to the external one.
+
+  Example usage:
+    secrets.yaml:
+      {{ include "common.secretFast" . }}
+
+    values.yaml:
+      mysqlLogin: "root"
+
+      mysqlExternalSecret: "some-other-secret-name"
+
+      secrets:
+        - uid: "mysql"
+          externalSecret: '{{ tpl .Values.passExternalSecret . }}'
+          type: basicAuth
+          login: '{{ .Values.mysqlLogin }}'
+          mysqlPassword: '{{ .Values.mysqlPassword }}'
+          passwordPolicy: generate
+
+    In the above example new secret is not going to be created.
+    Already existing one (some-other-secret-name) is going to be used.
+    To force creating a new one, just make sure that mysqlExternalSecret
+    is not set.
+
+*/}}
+{{- define "common.secretFast" -}}
+  {{- $global := . }}
+  {{- include "common.secret.buildCache" $global }}
+  {{- range $secret := .Values._secretsCache }}
+    {{- $uid := $secret.uid }}
+    {{- $externalSecret := $secret.externalSecret }}
+    {{- if not $externalSecret }}
+      {{- $name := $secret.realName }}
+      {{- $annotations := default "" $secret.annotations }}
+      {{- $type := default "generic" $secret.type }}
+---
+      {{ include "common.secret._header" (dict "global" $global "name" $name "annotations" $annotations) }}
+
+      {{- if eq $type "generic" }}
+data:
+        {{- range $curFilePath := $secret.filePaths }}
+          {{ tpl ($global.Files.Glob $curFilePath).AsSecrets $global | indent 2 }}
+        {{- end }}
+        {{- if $secret.filePath }}
+          {{ tpl ($global.Files.Glob $secret.filePath).AsSecrets $global | indent 2 }}
+        {{- end }}
+      {{- else if eq $type "genericKV" }}
+stringData:
+        {{- if $secret.envs }}
+          {{- range $secretEnv := $secret.envs }}
+            {{- $valueDesc := (dict "global" $global "secretName" $name "secretEnv" $secretEnv) }}
+    {{ $secretEnv.name }}: {{ include "common.secret._valueFast" $valueDesc }}
+          {{- end }}
+        {{- end }}
+      {{- else if eq $type "password" }}
+        {{- $secretEnv := (dict "policy" (default "generate" $secret.policy) "name" "password" "value" $secret.password) }}
+        {{- $valueDesc := (dict "global" $global "secretName" $name "secretEnv" $secretEnv) }}
+stringData:
+  password: {{ include "common.secret._valueFast" $valueDesc }}
+      {{- else if eq $type "basicAuth" }}
+stringData:
+        {{- $secretEnv := (dict "policy" "required" "name" "login" "value" $secret.login) }}
+        {{- $valueDesc := (dict "global" $global "secretName" $name "secretEnv" $secretEnv) }}
+  login: {{ include "common.secret._valueFast" $valueDesc }}
+        {{- $secretEnv := (dict "policy" (default "generate" $secret.passwordPolicy) "name" "password" "value" $secret.password) }}
+        {{- $valueDesc := (dict "global" $global "secretName" $name "secretEnv" $secretEnv) }}
+  password: {{ include "common.secret._valueFast" $valueDesc }}
+      {{- end }}
+    {{- end }}
+  {{- end }}
+{{- end -}}
index 6b6a26f..4457762 100644 (file)
@@ -1,4 +1,4 @@
-{/*
+{{/*
 # Copyright © 2020 Amdocs, Bell Canada, Orange
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
index 828818c..05699e6 100644 (file)
@@ -1,3 +1,4 @@
+{{/*
 # Copyright © 2018 AT&T, Amdocs, Bell Canada
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -11,6 +12,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+*/}}
 
 apiVersion: v1
 kind: ConfigMap
index b3f0ab0..e1fac77 100644 (file)
@@ -1,3 +1,4 @@
+{{/*
 # Copyright © 2018 AT&T, Amdocs, Bell Canada
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -11,6 +12,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+*/}}
 
 apiVersion: extensions/v1beta1
 kind: Deployment
@@ -38,25 +40,25 @@ spec:
         - "cd /config-input && for PFILE in `ls -1 .`; do envsubst <${PFILE} >/config/${PFILE}; done"
         env:
         - name: DB_USER
-          {{- include "common.secret.envFromSecret" (dict "global" . "uid" "db-user-creds" "key" "login") | indent 10 }}
+          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "login") | indent 10 }}
         - name: DB_PASSWORD
-          {{- include "common.secret.envFromSecret" (dict "global" . "uid" "db-user-creds" "key" "password") | indent 10 }}
+          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "password") | indent 10 }}
         - name: HTTP_USER
-          {{- include "common.secret.envFromSecret" (dict "global" . "uid" "http-user-creds" "key" "login") | indent 10 }}
+          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "http-user-creds" "key" "login") | indent 10 }}
         - name: HTTP_PASSWORD
-          {{- include "common.secret.envFromSecret" (dict "global" . "uid" "http-user-creds" "key" "password") | indent 10 }}
+          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "http-user-creds" "key" "password") | indent 10 }}
         - name: HTTP_ADMIN_USER
-          {{- include "common.secret.envFromSecret" (dict "global" . "uid" "admin-creds" "key" "login") | indent 10 }}
+          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "admin-creds" "key" "login") | indent 10 }}
         - name: HTTP_ADMIN_PASSWORD
-          {{- include "common.secret.envFromSecret" (dict "global" . "uid" "admin-creds" "key" "password") | indent 10 }}
+          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "admin-creds" "key" "password") | indent 10 }}
         - name: HTTP_NODE_USER
-          {{- include "common.secret.envFromSecret" (dict "global" . "uid" "node-creds" "key" "login") | indent 10 }}
+          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "node-creds" "key" "login") | indent 10 }}
         - name: HTTP_NODE_PASSWORD
-          {{- include "common.secret.envFromSecret" (dict "global" . "uid" "node-creds" "key" "password") | indent 10 }}
+          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "node-creds" "key" "password") | indent 10 }}
         - name: REST_CONF_USER
-          {{- include "common.secret.envFromSecret" (dict "global" . "uid" "restconf-creds" "key" "login") | indent 10 }}
+          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restconf-creds" "key" "login") | indent 10 }}
         - name: REST_CONF_PASSWORD
-          {{- include "common.secret.envFromSecret" (dict "global" . "uid" "restconf-creds" "key" "password") | indent 10 }}
+          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restconf-creds" "key" "password") | indent 10 }}
         volumeMounts:
         - mountPath: /config-input
           name: config-input
index c9a409f..4b48499 100644 (file)
@@ -1,3 +1,4 @@
+{{/*
 # Copyright © 2018 AT&T, Amdocs, Bell Canada
 # Copyright © 2020 Samsung Electronics
 #
@@ -12,5 +13,6 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+*/}}
 
-{{ include "common.secret" . }}
+{{ include "common.secretFast" . }}
index 7a8f752..bfe8b0a 100644 (file)
@@ -1,3 +1,4 @@
+{{/*
 # Copyright © 2018 AT&T, Amdocs, Bell Canada
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -11,6 +12,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+*/}}
 
 apiVersion: v1
 kind: Service
index c9e2ffe..29d9674 100644 (file)
@@ -86,7 +86,7 @@ spec:
               echo "Backup Successful!!!"
             env:
             - name: DB_PASS
-              {{- include "common.secret.envFromSecret" (dict "global" . "uid" (include "common.mariadb.secret.rootPassUID" .) "key" "password") | indent 14}}
+              {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" (include "common.mariadb.secret.rootPassUID" .) "key" "password") | indent 14}}
             volumeMounts:
             - name: backup-dir
               mountPath: /backup
@@ -96,7 +96,7 @@ spec:
             imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
             env:
             - name: MYSQL_ROOT_PASSWORD
-              {{- include "common.secret.envFromSecret" (dict "global" . "uid" (include "common.mariadb.secret.rootPassUID" .) "key" "password") | indent 14}}
+              {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" (include "common.mariadb.secret.rootPassUID" .) "key" "password") | indent 14}}
             command:
             - /bin/bash
             - -c
index f143c3b..e7bb701 100644 (file)
@@ -1,3 +1,4 @@
+{{/*
 # Copyright © 2018 Amdocs, Bell Canada
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -11,6 +12,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+*/}}
 
 {{- if .Values.externalConfig }}
 apiVersion: v1
index 6e53a95..579b347 100644 (file)
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 */}}
+
 {{- $global := . }}
 {{- if and $global.Values.persistence.enabled (not $global.Values.persistence.existingClaim) }}
 {{- if eq "True" (include "common.needPV" .) -}}
index 3f8eb0b..27c9a3a 100644 (file)
@@ -1,3 +1,4 @@
+{{/*
 # Copyright © 2018 Amdocs, Bell Canada
 # Copyright © 2019 Samsung Electronics
 #
@@ -12,4 +13,6 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-{{ include "common.secret" . }}
+*/}}
+
+{{ include "common.secretFast" . }}
index 71d1b0f..69d8999 100644 (file)
@@ -1,3 +1,4 @@
+{{/*
 # Copyright © 2018 Amdocs, Bell Canada
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -11,6 +12,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+*/}}
 
 apiVersion: v1
 kind: Service
index a6260fa..7157e33 100644 (file)
@@ -1,3 +1,4 @@
+{{/*
 # Copyright © 2019 Amdocs, Bell Canada, Orange, Samsung Electronics
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -11,6 +12,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+*/}}
 
 apiVersion: apps/v1beta1
 kind: StatefulSet
@@ -61,13 +63,13 @@ spec:
                   apiVersion: v1
                   fieldPath: metadata.namespace
             - name: MYSQL_USER
-              {{- include "common.secret.envFromSecret" (dict "global" . "uid" (include "common.mariadb.secret.userCredentialsUID" .) "key" "login") | indent 14}}
+              {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" (include "common.mariadb.secret.userCredentialsUID" .) "key" "login") | indent 14}}
             - name: MYSQL_PASSWORD
-              {{- include "common.secret.envFromSecret" (dict "global" . "uid" (include "common.mariadb.secret.userCredentialsUID" .) "key" "password") | indent 14}}
+              {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" (include "common.mariadb.secret.userCredentialsUID" .) "key" "password") | indent 14}}
             - name: MYSQL_DATABASE
               value: {{ default "" .Values.config.mysqlDatabase | quote }}
             - name: MYSQL_ROOT_PASSWORD
-              {{- include "common.secret.envFromSecret" (dict "global" . "uid" (include "common.mariadb.secret.rootPassUID" .) "key" "password") | indent 14}}
+              {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" (include "common.mariadb.secret.rootPassUID" .) "key" "password") | indent 14}}
           ports:
           - containerPort: {{ .Values.service.internalPort }}
             name: {{ .Values.service.portName }}
index a6d18e7..3e9e849 100644 (file)
@@ -1,3 +1,4 @@
+{{/*
 # Copyright (C) 2018  AT&T Intellectual Property.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -11,6 +12,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+*/}}
 
 apiVersion: extensions/v1beta1
 kind: Deployment
@@ -61,9 +63,9 @@ spec:
         - name: SPRING_PROFILE
           value: "{{ .Values.config.springProfile }}"
         - name: NENG_DB_USER
-          {{- include "common.secret.envFromSecret" (dict "global" . "uid" "neng-db-secret" "key" "login") | indent 10}}
+          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "neng-db-secret" "key" "login") | indent 10}}
         - name: NENG_DB_PASS
-          {{- include "common.secret.envFromSecret" (dict "global" . "uid" "neng-db-secret" "key" "password") | indent 10}}
+          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "neng-db-secret" "key" "password") | indent 10}}
         - name: NENG_DB_URL
           value: jdbc:mysql://{{ include "common.mariadbService" . }}:{{ include "common.mariadbPort" . }}/{{ index .Values "mariadb-galera" "config" "mysqlDatabase" }}
         - name: POL_CLIENT_AUTH
index d5bdce3..61b83d7 100644 (file)
@@ -1,3 +1,4 @@
+{{/*
 # Copyright (c) 2018 Bell Canada
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -11,8 +12,9 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+*/}}
 
-{{ include "common.secret" . }}
+{{ include "common.secretFast" . }}
 ---
 apiVersion: v1
 data:
index a4c5b05..753448c 100644 (file)
@@ -1,3 +1,4 @@
+{{/*
 # Copyright (C) 2018  AT&T Intellectual Property.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -11,6 +12,8 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+*/}}
+
 apiVersion: v1
 kind: Service
 metadata:
index 361e648..e3ac669 100644 (file)
@@ -49,15 +49,15 @@ spec:
         - name: PG_PRIMARY_USER
           value: primaryuser
         - name: PG_PRIMARY_PASSWORD
-          {{- include "common.secret.envFromSecret" (dict "global" $dot "uid" (include "common.postgres.secret.primaryPasswordUID" .) "key" "password") | indent 10 }}
+          {{- include "common.secret.envFromSecretFast" (dict "global" $dot "uid" (include "common.postgres.secret.primaryPasswordUID" .) "key" "password") | indent 10 }}
         - name: PG_USER
-          {{- include "common.secret.envFromSecret" (dict "global" $dot "uid" (include "common.postgres.secret.userCredentialsUID" .) "key" "login") | indent 10 }}
+          {{- include "common.secret.envFromSecretFast" (dict "global" $dot "uid" (include "common.postgres.secret.userCredentialsUID" .) "key" "login") | indent 10 }}
         - name: PG_PASSWORD
-          {{- include "common.secret.envFromSecret" (dict "global" $dot "uid" (include "common.postgres.secret.userCredentialsUID" .) "key" "password") | indent 10 }}
+          {{- include "common.secret.envFromSecretFast" (dict "global" $dot "uid" (include "common.postgres.secret.userCredentialsUID" .) "key" "password") | indent 10 }}
         - name: PG_DATABASE
           value: "{{ $dot.Values.config.pgDatabase }}"
         - name: PG_ROOT_PASSWORD
-          {{- include "common.secret.envFromSecret" (dict "global" $dot "uid" (include "common.postgres.secret.rootPassUID" .) "key" "password") | indent 10 }}
+          {{- include "common.secret.envFromSecretFast" (dict "global" $dot "uid" (include "common.postgres.secret.rootPassUID" .) "key" "password") | indent 10 }}
         volumeMounts:
         - mountPath: /config-input/setup.sql
           name: config
@@ -116,15 +116,15 @@ spec:
         - name: PG_PRIMARY_PORT
           value: "{{ $dot.Values.service.internalPort }}"
         - name: PG_PRIMARY_PASSWORD
-          {{- include "common.secret.envFromSecret" (dict "global" $dot "uid" (include "common.postgres.secret.primaryPasswordUID" .) "key" "password") | indent 10 }}
+          {{- include "common.secret.envFromSecretFast" (dict "global" $dot "uid" (include "common.postgres.secret.primaryPasswordUID" .) "key" "password") | indent 10 }}
         - name: PG_USER
-          {{- include "common.secret.envFromSecret" (dict "global" $dot "uid" (include "common.postgres.secret.userCredentialsUID" .) "key" "login") | indent 10 }}
+          {{- include "common.secret.envFromSecretFast" (dict "global" $dot "uid" (include "common.postgres.secret.userCredentialsUID" .) "key" "login") | indent 10 }}
         - name: PG_PASSWORD
-          {{- include "common.secret.envFromSecret" (dict "global" $dot "uid" (include "common.postgres.secret.userCredentialsUID" .) "key" "password") | indent 10 }}
+          {{- include "common.secret.envFromSecretFast" (dict "global" $dot "uid" (include "common.postgres.secret.userCredentialsUID" .) "key" "password") | indent 10 }}
         - name: PG_DATABASE
           value: "{{ $dot.Values.config.pgDatabase }}"
         - name: PG_ROOT_PASSWORD
-          {{- include "common.secret.envFromSecret" (dict "global" $dot "uid" (include "common.postgres.secret.rootPassUID" .) "key" "password") | indent 10 }}
+          {{- include "common.secret.envFromSecretFast" (dict "global" $dot "uid" (include "common.postgres.secret.rootPassUID" .) "key" "password") | indent 10 }}
         volumeMounts:
         - name: config
           mountPath: /pgconf/pool_hba.conf
index 4c68015..c4cde05 100644 (file)
@@ -13,4 +13,4 @@
 # # See the License for the specific language governing permissions and
 # # limitations under the License.
 */}}
-{{ include "common.secret" . }}
+{{ include "common.secretFast" . }}