From f22e8ee7d8f2aed4750dca3c47498d93cf4f1857 Mon Sep 17 00:00:00 2001 From: Yi Chen Date: Mon, 28 Apr 2025 16:07:57 +0800 Subject: [PATCH] [CELEBORN-1985][HELM] Add new values master.envFrom and worker.envFrom ### What changes were proposed in this pull request? - Add new value `master.envFrom` - Add new value `worker.envFrom` ### Why are the changes needed? Users are allowed to populate container environment variables from ConfigMap/Secret sources. ### Does this PR introduce _any_ user-facing change? Yes, new values are added. ### How was this patch tested? Run Helm unit tests by `helm unittest charts/celeborn --file "tests/**/*_test.yaml" --strict --debug`. Closes #3233 from ChenYi015/helm/env-from. Authored-by: Yi Chen Signed-off-by: Cheng Pan --- .../templates/master/statefulset.yaml | 4 ++++ .../templates/worker/statefulset.yaml | 4 ++++ .../tests/master/statefulset_test.yaml | 24 +++++++++++++++++++ .../tests/worker/statefulset_test.yaml | 24 +++++++++++++++++++ charts/celeborn/values.yaml | 18 ++++++++++++++ 5 files changed, 74 insertions(+) diff --git a/charts/celeborn/templates/master/statefulset.yaml b/charts/celeborn/templates/master/statefulset.yaml index 96835392d..0ec4e4614 100644 --- a/charts/celeborn/templates/master/statefulset.yaml +++ b/charts/celeborn/templates/master/statefulset.yaml @@ -88,6 +88,10 @@ spec: env: {{- toYaml . | nindent 8 }} {{- end }} + {{- with .Values.master.envFrom }} + envFrom: + {{- toYaml . | nindent 8 }} + {{- end }} volumeMounts: - name: {{ include "celeborn.fullname" . }}-volume mountPath: /opt/celeborn/conf diff --git a/charts/celeborn/templates/worker/statefulset.yaml b/charts/celeborn/templates/worker/statefulset.yaml index 9b7db194b..9bab89751 100644 --- a/charts/celeborn/templates/worker/statefulset.yaml +++ b/charts/celeborn/templates/worker/statefulset.yaml @@ -91,6 +91,10 @@ spec: env: {{- toYaml . | nindent 8 }} {{- end }} + {{- with .Values.worker.envFrom }} + envFrom: + {{- toYaml . | nindent 8 }} + {{- end }} volumeMounts: - mountPath: /opt/celeborn/conf name: {{ include "celeborn.fullname" . }}-volume diff --git a/charts/celeborn/tests/master/statefulset_test.yaml b/charts/celeborn/tests/master/statefulset_test.yaml index 41833ef5e..7d09af67e 100644 --- a/charts/celeborn/tests/master/statefulset_test.yaml +++ b/charts/celeborn/tests/master/statefulset_test.yaml @@ -101,6 +101,30 @@ tests: key: test-key optional: false + - it: Should add environment variable sources if `master.envFrom` is set + set: + master: + envFrom: + - configMapRef: + name: test-configmap + optional: false + - secretRef: + name: test-secret + optional: false + asserts: + - contains: + path: spec.template.spec.containers[0].envFrom + content: + configMapRef: + name: test-configmap + optional: false + - contains: + path: spec.template.spec.containers[0].envFrom + content: + secretRef: + name: test-secret + optional: false + - it: Should use the specified resources if `master.resources` is set set: master: diff --git a/charts/celeborn/tests/worker/statefulset_test.yaml b/charts/celeborn/tests/worker/statefulset_test.yaml index 1030f374b..ba2f63a50 100644 --- a/charts/celeborn/tests/worker/statefulset_test.yaml +++ b/charts/celeborn/tests/worker/statefulset_test.yaml @@ -101,6 +101,30 @@ tests: key: test-key optional: false + - it: Should add environment variable sources if `worker.envFrom` is set + set: + worker: + envFrom: + - configMapRef: + name: test-configmap + optional: false + - secretRef: + name: test-secret + optional: false + asserts: + - contains: + path: spec.template.spec.containers[0].envFrom + content: + configMapRef: + name: test-configmap + optional: false + - contains: + path: spec.template.spec.containers[0].envFrom + content: + secretRef: + name: test-secret + optional: false + - it: Should use the specified resources if `worker.resources` is set set: worker: diff --git a/charts/celeborn/values.yaml b/charts/celeborn/values.yaml index 61f69c0d6..9733be018 100644 --- a/charts/celeborn/values.yaml +++ b/charts/celeborn/values.yaml @@ -155,6 +155,15 @@ master: - name: TZ value: Asia/Shanghai + # -- Environment variable sources for Celeborn master containers. + envFrom: + # - configMapRef: + # name: celeborn-configmap + # optional: false + # - secretRef: + # name: celeborn-secret + # optional: false + # -- Resources for Celeborn master containers. resources: # requests: @@ -223,6 +232,15 @@ worker: - name: TZ value: Asia/Shanghai + # -- Environment variable sources for Celeborn worker containers. + envFrom: + # - configMapRef: + # name: celeborn-configmap + # optional: false + # - secretRef: + # name: celeborn-secret + # optional: false + # -- Resources for Celeborn worker containers. resources: # requests: