From 689e11a3c02277e4f407aaa76c771e45565afe34 Mon Sep 17 00:00:00 2001 From: Michal Skwierczynski Date: Thu, 4 Jun 2026 13:17:09 +0200 Subject: [PATCH 1/3] Added possibility to specify custom secret name to be passed --- charts/dotnet-core/Chart.yaml | 2 +- charts/dotnet-core/templates/deployment.yaml | 5 ++++- charts/dotnet-core/values.yaml | 6 ++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/charts/dotnet-core/Chart.yaml b/charts/dotnet-core/Chart.yaml index 8c8ac37..8a6df19 100644 --- a/charts/dotnet-core/Chart.yaml +++ b/charts/dotnet-core/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 description: EcoVadis Helm chart for .Net Core app name: charts-dotnet-core type: application -version: 4.9.0 +version: 4.10.0 dependencies: - name: charts-core version: "2.8.0" diff --git a/charts/dotnet-core/templates/deployment.yaml b/charts/dotnet-core/templates/deployment.yaml index 1f5b2f7..3ea87b0 100644 --- a/charts/dotnet-core/templates/deployment.yaml +++ b/charts/dotnet-core/templates/deployment.yaml @@ -173,7 +173,7 @@ spec: {{- end }} {{- end }} - {{- if or .Values.global.envVarsEnabled .Values.global.secEnvVarsEnabled }} + {{- if or .Values.global.envVarsEnabled .Values.global.secEnvVarsEnabled .Values.global.extraEnvFrom }} envFrom: {{- if .Values.global.envVarsEnabled }} - configMapRef: @@ -183,6 +183,9 @@ spec: - secretRef: name: "{{ include "charts-dotnet-core.fullname" . }}-secure" {{- end }} + {{- if .Values.global.extraEnvFrom }} + {{- toYaml .Values.global.extraEnvFrom | nindent 12 }} + {{- end }} {{- end }} env: - name: POD_NAME diff --git a/charts/dotnet-core/values.yaml b/charts/dotnet-core/values.yaml index 6fda5cd..51e5058 100644 --- a/charts/dotnet-core/values.yaml +++ b/charts/dotnet-core/values.yaml @@ -169,6 +169,12 @@ global: secEnvVarsEnabled: true secEnvVars: {} + extraEnvFrom: [] + # - secretRef: + # name: my-existing-secret + # - configMapRef: + # name: my-existing-configmap + appConfigFilesEnabled: true appConfigFiles: globPattern: "**.json" From 6c868a0c01659afffaad13860c311ca0cffbca98 Mon Sep 17 00:00:00 2001 From: Michal Skwierczynski Date: Mon, 8 Jun 2026 11:15:07 +0200 Subject: [PATCH 2/3] added test --- .../templates/tests/deployment_test.py | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/charts/dotnet-core/templates/tests/deployment_test.py b/charts/dotnet-core/templates/tests/deployment_test.py index 14c38f3..2267632 100644 --- a/charts/dotnet-core/templates/tests/deployment_test.py +++ b/charts/dotnet-core/templates/tests/deployment_test.py @@ -648,6 +648,88 @@ def test_topology_spread_constraint_overwritten(self): ], jmespath.search("spec.template.spec.topologySpreadConstraints", docs[0])) + def test_should_add_extra_env_from_with_secret_ref(self): + docs = render_chart( + values={ + "global": { + "envVarsEnabled": False, + "secEnvVarsEnabled": False, + "extraEnvFrom": [ + { + "secretRef": { + "name": "my-existing-secret" + } + } + ] + } + }, + name=".", + show_only=["templates/deployment.yaml"] + ) + self.assertEqual( + "my-existing-secret", + jmespath.search( + "spec.template.spec.containers[0].envFrom[0].secretRef.name", docs[0]) + ) + + def test_should_add_extra_env_from_with_config_map_ref(self): + docs = render_chart( + values={ + "global": { + "envVarsEnabled": False, + "secEnvVarsEnabled": False, + "extraEnvFrom": [ + { + "configMapRef": { + "name": "my-existing-configmap" + } + } + ] + } + }, + name=".", + show_only=["templates/deployment.yaml"] + ) + self.assertEqual( + "my-existing-configmap", + jmespath.search( + "spec.template.spec.containers[0].envFrom[0].configMapRef.name", docs[0]) + ) + + def test_should_add_extra_env_from_alongside_existing_refs(self): + docs = render_chart( + values={ + "global": { + "envVarsEnabled": True, + "secEnvVarsEnabled": True, + "extraEnvFrom": [ + { + "secretRef": { + "name": "my-existing-secret" + } + } + ] + } + }, + name=".", + show_only=["templates/deployment.yaml"] + ) + self.assertEqual( + "release-name-charts-dotnet-core", + jmespath.search( + "spec.template.spec.containers[0].envFrom[0].configMapRef.name", docs[0]) + ) + self.assertEqual( + "release-name-charts-dotnet-core-secure", + jmespath.search( + "spec.template.spec.containers[0].envFrom[1].secretRef.name", docs[0]) + ) + self.assertEqual( + "my-existing-secret", + jmespath.search( + "spec.template.spec.containers[0].envFrom[2].secretRef.name", docs[0]) + ) + def test_fileshare_mount(self): share_name = "files" From 02fba4cc2255bdbd85a0718be224eea6c4844198 Mon Sep 17 00:00:00 2001 From: Michal Skwierczynski Date: Mon, 8 Jun 2026 11:17:54 +0200 Subject: [PATCH 3/3] fixed name --- charts/dotnet-core/templates/tests/deployment_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/dotnet-core/templates/tests/deployment_test.py b/charts/dotnet-core/templates/tests/deployment_test.py index 2267632..b58a401 100644 --- a/charts/dotnet-core/templates/tests/deployment_test.py +++ b/charts/dotnet-core/templates/tests/deployment_test.py @@ -715,12 +715,12 @@ def test_should_add_extra_env_from_alongside_existing_refs(self): show_only=["templates/deployment.yaml"] ) self.assertEqual( - "release-name-charts-dotnet-core", + "RELEASE-NAME-charts-dotnet-core", jmespath.search( "spec.template.spec.containers[0].envFrom[0].configMapRef.name", docs[0]) ) self.assertEqual( - "release-name-charts-dotnet-core-secure", + "RELEASE-NAME-charts-dotnet-core-secure", jmespath.search( "spec.template.spec.containers[0].envFrom[1].secretRef.name", docs[0]) )