From d4801ccf507eb0c2177a4b4d89c612b4fbed40ce Mon Sep 17 00:00:00 2001 From: Felix Delattre Date: Thu, 5 Dec 2024 10:41:38 +0100 Subject: [PATCH] Made envVars handle secrets. --- helm-chart/eoapi/Chart.yaml | 2 +- helm-chart/eoapi/templates/services/configmap.yaml | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/helm-chart/eoapi/Chart.yaml b/helm-chart/eoapi/Chart.yaml index dbd48fa7..919f504d 100644 --- a/helm-chart/eoapi/Chart.yaml +++ b/helm-chart/eoapi/Chart.yaml @@ -15,7 +15,7 @@ kubeVersion: ">=1.23.0-0" # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: "0.5.0" +version: "0.5.1" # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/helm-chart/eoapi/templates/services/configmap.yaml b/helm-chart/eoapi/templates/services/configmap.yaml index 92be1d35..55ef8cf9 100644 --- a/helm-chart/eoapi/templates/services/configmap.yaml +++ b/helm-chart/eoapi/templates/services/configmap.yaml @@ -7,8 +7,22 @@ metadata: name: {{ $serviceName }}-envvar-configmap-{{ $.Release.Name }} data: {{- range $envKey, $envValue := index $v "settings" "envVars" }} + {{- if (eq (kindOf $envValue) "map") }} + {{- if (index $envValue "valueFrom") }} + {{- if (index $envValue "valueFrom" "secretKeyRef") }} + {{ upper $envKey }}: + valueFrom: + secretKeyRef: + name: {{ index $envValue "valueFrom" "secretKeyRef" "name" }} + key: {{ index $envValue "valueFrom" "secretKeyRef" "key" }} + {{- else }} {{ upper $envKey }}: "{{ $envValue }}" {{- end }} + {{- else }} + {{ upper $envKey }}: "{{ $envValue }}" + {{- end }} + {{- end }} + {{- end }} --- {{/* END: if index $v "enabled" */}} {{- end }}