diff --git a/charts/common/templates/_.environment.tpl b/charts/common/templates/_.environment.tpl index 49e39d1c..6320e179 100644 --- a/charts/common/templates/_.environment.tpl +++ b/charts/common/templates/_.environment.tpl @@ -1,27 +1,9 @@ {{/* Renders an object that contains a list of key/value properties that can be transformed into environement variables Usage: -{{ include "common.environment.render" . }} +{{ include "common.environment.render" (dict "env" .Values.path.to.the.env "context" $) }} */}} {{- define "common.environment.render" -}} -{{- $defaultSecret := include "common.names.secret" . }} -{{- range $key, $value := .Values.env }} -- name: {{ $key | snakecase | upper}} - {{- if kindIs "map" $value }} - valueFrom: - secretKeyRef: - name: {{ $value.secret | default $defaultSecret }} - key: {{ $value.key | default (kebabcase $key) }} - {{- else }} - value: {{ include "common.tplvalues.render" (dict "value" $value "context" $) | quote }} - {{- end }} -{{- end }} -{{- end -}} - - -{{/* -*/}} -{{- define "common.environment.renderImpl" -}} {{- $defaultSecret := include "common.names.secret" .context }} {{- range $key, $value := .env }} - name: {{ $key | snakecase | upper}} diff --git a/charts/common/templates/_envsubstConfig.tpl b/charts/common/templates/_envsubstConfig.tpl index 1e47d1c4..6cccbf87 100644 --- a/charts/common/templates/_envsubstConfig.tpl +++ b/charts/common/templates/_envsubstConfig.tpl @@ -1,7 +1,7 @@ {{/* Renders an object that contains a list of key/value properties that can be transformed into environement variables Usage: -{{ include "common.environment.render" . }} +{{ include "common.envsubstConfig.renderInitContainer" . }} */}} {{- define "common.envsubstConfig.renderInitContainer" -}} - name: envsubst-config @@ -28,7 +28,7 @@ Usage: - '{}' - ';' env: - {{- include "common.environment.renderImpl" (dict "env" .args.env "context" .context) | indent 4 }} + {{- include "common.environment.render" (dict "env" .args.env "context" .context) | indent 4 }} volumeMounts: - mountPath: /templated name: envsubst-template-config @@ -40,7 +40,7 @@ Usage: {{/* Renders an object that contains a list of key/value properties that can be transformed into environement variables Usage: -{{ include "common.environment.render" . }} +{{ include "common.envsubstConfig.renderVolume" . }} */}} {{- define "common.envsubstConfig.renderVolume" -}} - name: envsubst-template-config diff --git a/charts/common/templates/_kdk-deployment.yaml b/charts/common/templates/_kdk-deployment.yaml index dc15a68b..185ae963 100644 --- a/charts/common/templates/_kdk-deployment.yaml +++ b/charts/common/templates/_kdk-deployment.yaml @@ -48,7 +48,7 @@ spec: name: {{ .Values.distribution.redisUrl.secret | default (include "common.names.secret" .) }} key: {{ .Values.distribution.redisUrl.key | default "redis-url" }} {{- end }} - {{- include "common.environment.render" . | indent 12 }} + {{- include "common.environment.render" (dict "env" .Values.env "context" $) | indent 12 }} ports: - name: {{ include "common.names.name" . }} containerPort: 8081 diff --git a/charts/common/templates/_krawler-cronjob.yaml b/charts/common/templates/_krawler-cronjob.yaml index cafdc76d..a9d3321e 100644 --- a/charts/common/templates/_krawler-cronjob.yaml +++ b/charts/common/templates/_krawler-cronjob.yaml @@ -29,7 +29,7 @@ spec: env: - name: CRON value: "" - {{- include "common.environment.render" . | indent 16 }} + {{- include "common.environment.render" (dict "env" .Values.env "context" $) | indent 16 }} {{- if .Values.volumeMounts }} volumeMounts: {{- include "common.tplvalues.render" ( dict "value" .Values.volumeMounts "context" $ ) | nindent 14 }} diff --git a/charts/express-gateway/templates/deployment.yaml b/charts/express-gateway/templates/deployment.yaml index d9b8bb90..bb83d7dc 100644 --- a/charts/express-gateway/templates/deployment.yaml +++ b/charts/express-gateway/templates/deployment.yaml @@ -36,7 +36,7 @@ spec: - name: HTTP_PROXY - name: HTTPS_PROXY - name: NO_PROXY - {{- include "common.environment.render" . | indent 12 }} + {{- include "common.environment.render" (dict "env" .Values.env "context" $) | indent 12 }} ports: - name: {{ include "common.names.name" . }} containerPort: 8080 diff --git a/charts/k2/templates/deployment.yaml b/charts/k2/templates/deployment.yaml index bc3d4a27..b1a161f7 100644 --- a/charts/k2/templates/deployment.yaml +++ b/charts/k2/templates/deployment.yaml @@ -26,7 +26,7 @@ spec: image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: - {{- include "common.environment.render" . | indent 12 }} + {{- include "common.environment.render" (dict "env" .Values.env "context" $) | indent 12 }} ports: - name: {{ include "common.names.name" . }} containerPort: 8080 diff --git a/charts/kapture/templates/deployment.yaml b/charts/kapture/templates/deployment.yaml index e7837111..85a31698 100644 --- a/charts/kapture/templates/deployment.yaml +++ b/charts/kapture/templates/deployment.yaml @@ -26,7 +26,7 @@ spec: image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: - {{- include "common.environment.render" . | indent 12 }} + {{- include "common.environment.render" (dict "env" .Values.env "context" $) | indent 12 }} ports: - name: {{ include "common.names.name" . }} containerPort: 3000 diff --git a/charts/mongo-express/templates/deployment.yaml b/charts/mongo-express/templates/deployment.yaml index 54433ec3..b0c56ad8 100644 --- a/charts/mongo-express/templates/deployment.yaml +++ b/charts/mongo-express/templates/deployment.yaml @@ -26,7 +26,7 @@ spec: image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: - {{- include "common.environment.render" . | indent 12 }} + {{- include "common.environment.render" (dict "env" .Values.env "context" $) | indent 12 }} ports: - name: {{ include "common.names.name" . }} containerPort: 8081 diff --git a/charts/redis-commander/templates/deployment.yaml b/charts/redis-commander/templates/deployment.yaml index 40551ad1..7eec9781 100644 --- a/charts/redis-commander/templates/deployment.yaml +++ b/charts/redis-commander/templates/deployment.yaml @@ -26,7 +26,7 @@ spec: image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: - {{- include "common.environment.render" . | indent 12 }} + {{- include "common.environment.render" (dict "env" .Values.env "context" $) | indent 12 }} ports: - name: {{ include "common.names.name" . }} containerPort: 8081