diff --git a/charts/common/Chart.yaml b/charts/common/Chart.yaml index 5f5fad8..614af97 100644 --- a/charts/common/Chart.yaml +++ b/charts/common/Chart.yaml @@ -15,4 +15,4 @@ type: library # 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.3.1 +version: 0.4.0 diff --git a/charts/common/templates/_envFromRef.yaml b/charts/common/templates/_envFromRef.yaml index 57eb3c9..fab3758 100644 --- a/charts/common/templates/_envFromRef.yaml +++ b/charts/common/templates/_envFromRef.yaml @@ -1,10 +1,20 @@ {{- define "common.envFromRef.tpl" -}} -{{- if or (or (or (.Values.vars) (.Values.secretEnabled)) .Values.sealedSecrets) .Values.secretName -}} +{{- if or (or (or (or (or (.Values.vars) (.Values.secretEnabled)) .Values.sealedSecrets) .Values.secretName) .Values.existingConfigMaps) .Values.existingSecrets -}} envFrom: &envFrom {{- if .Values.vars }} - configMapRef: name: {{ template "common.robustName" .Release.Name }} {{- end }} +{{- range .Values.existingSecrets }} + - secretRef: + name: {{ .name }} + optional: {{ .optional | default false }} +{{- end }} +{{- range .Values.existingConfigMaps }} + - configMapRef: + name: {{ .name }} + optional: {{ .optional | default false }} +{{- end }} {{- if .Values.secretEnabled }} - secretRef: name: {{ include "common.robustName" $.Release.Name }} diff --git a/charts/cron-job/Chart.lock b/charts/cron-job/Chart.lock index dea9c02..8309305 100644 --- a/charts/cron-job/Chart.lock +++ b/charts/cron-job/Chart.lock @@ -1,6 +1,6 @@ dependencies: - name: common repository: file://../common - version: 0.3.1 -digest: sha256:64689b29ef8b2262efbd5d49bccf40f798698d426dcfdc7c632aaf183a8cc681 -generated: "2023-08-18T08:34:24.144108449+02:00" + version: 0.4.0 +digest: sha256:d4eccd332ada7362f429e04b82022f5605a02e2d3aa7b9fdf8adaf4f6c9e03eb +generated: "2023-10-20T10:53:13.982995773+02:00" diff --git a/charts/cron-job/Chart.yaml b/charts/cron-job/Chart.yaml index 3267c1c..c0c2cfd 100644 --- a/charts/cron-job/Chart.yaml +++ b/charts/cron-job/Chart.yaml @@ -19,5 +19,5 @@ version: 0.58.0 dependencies: - name: common - version: 0.3.1 + version: 0.4.0 repository: file://../common diff --git a/charts/cron-job/charts/common-0.3.1.tgz b/charts/cron-job/charts/common-0.3.1.tgz deleted file mode 100644 index 5fb517d..0000000 Binary files a/charts/cron-job/charts/common-0.3.1.tgz and /dev/null differ diff --git a/charts/cron-job/charts/common-0.4.0.tgz b/charts/cron-job/charts/common-0.4.0.tgz new file mode 100644 index 0000000..25e1fd4 Binary files /dev/null and b/charts/cron-job/charts/common-0.4.0.tgz differ diff --git a/charts/onechart/Chart.lock b/charts/onechart/Chart.lock index f5151d6..57a2876 100644 --- a/charts/onechart/Chart.lock +++ b/charts/onechart/Chart.lock @@ -1,6 +1,6 @@ dependencies: - name: common repository: file://../common - version: 0.3.1 -digest: sha256:64689b29ef8b2262efbd5d49bccf40f798698d426dcfdc7c632aaf183a8cc681 -generated: "2023-08-18T08:31:18.469039683+02:00" + version: 0.4.0 +digest: sha256:d4eccd332ada7362f429e04b82022f5605a02e2d3aa7b9fdf8adaf4f6c9e03eb +generated: "2023-10-20T10:52:47.237955041+02:00" diff --git a/charts/onechart/Chart.yaml b/charts/onechart/Chart.yaml index 2f9539f..cefae42 100644 --- a/charts/onechart/Chart.yaml +++ b/charts/onechart/Chart.yaml @@ -19,5 +19,5 @@ version: 0.58.0 dependencies: - name: common - version: 0.3.1 + version: 0.4.0 repository: file://../common diff --git a/charts/onechart/charts/common-0.3.1.tgz b/charts/onechart/charts/common-0.3.1.tgz deleted file mode 100644 index 5fb517d..0000000 Binary files a/charts/onechart/charts/common-0.3.1.tgz and /dev/null differ diff --git a/charts/onechart/charts/common-0.4.0.tgz b/charts/onechart/charts/common-0.4.0.tgz new file mode 100644 index 0000000..25e1fd4 Binary files /dev/null and b/charts/onechart/charts/common-0.4.0.tgz differ diff --git a/charts/onechart/templates/deployment.yaml b/charts/onechart/templates/deployment.yaml index 6a73480..e9b1ae0 100644 --- a/charts/onechart/templates/deployment.yaml +++ b/charts/onechart/templates/deployment.yaml @@ -138,7 +138,7 @@ spec: - -c - {{ .Values.sidecar.command | quote }} {{- end }} - {{- if or (or (.Values.vars) (.Values.secretEnabled)) .Values.sealedSecrets }} + {{- if or (or (or (or (or (.Values.vars) (.Values.secretEnabled)) .Values.sealedSecrets) .Values.secretName) .Values.existingConfigMaps) .Values.existingSecrets }} envFrom: *envFrom {{- end }} {{- if or (or (.Values.volumes) (.Values.sealedFileSecrets)) .Values.fileSecrets }} diff --git a/charts/onechart/tests/deployment_configmap_test.yaml b/charts/onechart/tests/deployment_configmap_test.yaml index 0869615..dbb869b 100644 --- a/charts/onechart/tests/deployment_configmap_test.yaml +++ b/charts/onechart/tests/deployment_configmap_test.yaml @@ -16,5 +16,23 @@ tests: name: release-name - it: Should not reference configmap if vars are not set asserts: - - isNull: + - isNull: + path: spec.template.spec.containers[0].envFrom + + - it: Should reference to existing configmaps + set: + existingConfigMaps: + - name: firstcm + optional: true + - name: secondcm + optional: true + asserts: + - contains: path: spec.template.spec.containers[0].envFrom + content: + configMapRef: + name: firstcm + optional: true + configMapRef: + name: secondcm + optional: true diff --git a/charts/onechart/tests/deployment_secret_test.yaml b/charts/onechart/tests/deployment_secret_test.yaml index 5dfc580..64d3ef2 100644 --- a/charts/onechart/tests/deployment_secret_test.yaml +++ b/charts/onechart/tests/deployment_secret_test.yaml @@ -31,3 +31,20 @@ tests: content: secretRef: name: release-name + - it: Should reference to existing secrets + set: + existingSecrets: + - name: firstsecret + optional: true + - name: secondsecret + optional: true + asserts: + - contains: + path: spec.template.spec.containers[0].envFrom + content: + secretRef: + name: firstsecret + optional: true + secretRef: + name: secondsecret + optional: true