From 39eaa6b317c2696a3bd63b750f170906ff844500 Mon Sep 17 00:00:00 2001 From: mikutas <23391543+mikutas@users.noreply.github.com> Date: Tue, 4 Apr 2023 18:45:27 +0900 Subject: [PATCH] feat: Environment variables from ConfigMap resolves #724 --- templates/_helpers.tpl | 10 ++++++++++ templates/server-statefulset.yaml | 1 + values.yaml | 5 +++++ 3 files changed, 16 insertions(+) diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index dcfcbb8b8..a96f03e4d 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -896,6 +896,16 @@ Inject extra environment populated by secrets, if populated {{- end -}} {{- end -}} +{{- define "vault.extraEnvironmentVarsFromConfigMap" -}} +{{- if .extraEnvironmentVarsFromConfigMap -}} +envFrom: +{{- range .extraEnvironmentVarsFromConfigMap }} + - configMapRef: + name: {{ . }} +{{- end -}} +{{- end -}} +{{- end -}} + {{/* Scheme for health check and local endpoint */}} {{- define "vault.scheme" -}} {{- if .Values.global.tlsDisable -}} diff --git a/templates/server-statefulset.yaml b/templates/server-statefulset.yaml index d7a34acb6..4a988863d 100644 --- a/templates/server-statefulset.yaml +++ b/templates/server-statefulset.yaml @@ -137,6 +137,7 @@ spec: {{ template "vault.envs" . }} {{- include "vault.extraEnvironmentVars" .Values.server | nindent 12 }} {{- include "vault.extraSecretEnvironmentVars" .Values.server | nindent 12 }} + {{- include "vault.extraEnvironmentVarsFromConfigMap" .Values.server | nindent 10 }} volumeMounts: {{ template "vault.mounts" . }} - name: home diff --git a/values.yaml b/values.yaml index 08b1ad1e1..394499f93 100644 --- a/values.yaml +++ b/values.yaml @@ -559,6 +559,11 @@ server: # secretName: vault # secretKey: AWS_SECRET_ACCESS_KEY + # extraEnvironmentVarsFromConfigMap is a list of + extraEnvironmentVarsFromConfigMap: [] + # - my-configmap + # - my-configmap2 + # Deprecated: please use 'volumes' instead. # extraVolumes is a list of extra volumes to mount. These will be exposed # to Vault in the path `/vault/userconfig//`. The value below is