This is an automated email from the ASF dual-hosted git repository.

rexxiong pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/celeborn.git


The following commit(s) were added to refs/heads/main by this push:
     new 725e3ce9f [CELEBORN-1980][HELM] Split environments into master.env and 
worker.env
725e3ce9f is described below

commit 725e3ce9f76765e14c31e5938fb1057a05fc8280
Author: Yi Chen <[email protected]>
AuthorDate: Mon Apr 28 11:17:31 2025 +0800

    [CELEBORN-1980][HELM] Split environments into master.env and worker.env
    
    ### What changes were proposed in this pull request?
    
    Split `environments` into `master.env` and `worker.env`
    
    ### Why are the changes needed?
    
    - Users are able to configure environment variables for master and worker 
separately.
    - Users can use environment variable source to configure envs( e.g. read 
env from a ConfigMap or Secret).
    
    ### Does this PR introduce _any_ user-facing change?
    
    Yes.
    
    ### How was this patch tested?
    
    Helm unit test by `helm unittest charts/celeborn --file 
"tests/**/*_test.yaml" --strict --debug`.
    
    Closes #3226 from ChenYi015/refactor-helm/env.
    
    Authored-by: Yi Chen <[email protected]>
    Signed-off-by: Shuang <[email protected]>
---
 charts/celeborn/ci/values.yaml                     | 36 +++++++++++++-----
 charts/celeborn/templates/master/statefulset.yaml  |  7 ++--
 charts/celeborn/templates/worker/statefulset.yaml  |  7 ++--
 charts/celeborn/tests/master/statefulset_test.yaml | 43 ++++++++++++++++++++++
 charts/celeborn/tests/worker/statefulset_test.yaml | 43 ++++++++++++++++++++++
 charts/celeborn/values.yaml                        | 34 ++++++++++++-----
 6 files changed, 142 insertions(+), 28 deletions(-)

diff --git a/charts/celeborn/ci/values.yaml b/charts/celeborn/ci/values.yaml
index 9d806f4ce..782097b15 100644
--- a/charts/celeborn/ci/values.yaml
+++ b/charts/celeborn/ci/values.yaml
@@ -82,22 +82,25 @@ celeborn:
   celeborn.application.heartbeat.timeout: 120s
   celeborn.worker.heartbeat.timeout: 120s
 
-# -- Celeborn configurations
-environments:
-  CELEBORN_MASTER_MEMORY: 100m
-  CELEBORN_WORKER_MEMORY: 100m
-  CELEBORN_WORKER_OFFHEAP_MEMORY: 100m
-  CELEBORN_NO_DAEMONIZE: 1
-  TZ: "Asia/Shanghai"
-
 # -- Specifies the DNS policy for Celeborn pods to use
 dnsPolicy: ClusterFirstWithHostNet
 
 # -- Specifies whether to use the host's network namespace
 hostNetwork: true
 
-# -- Resources for Celeborn master containers.
 master:
+  # -- Environment variables for Celeborn master containers.
+  env:
+  - name: CELEBORN_MASTER_MEMORY
+    value: 100m
+  - name: CELEBORN_MASTER_JAVA_OPTS
+    value: -XX:-PrintGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps 
-XX:+PrintGCDateStamps -Xloggc:gc-master.out 
-Dio.netty.leakDetectionLevel=advanced
+  - name: CELEBORN_NO_DAEMONIZE
+    value: "true"
+  - name: TZ
+    value: Asia/Shanghai
+
+  # -- Resources for Celeborn master containers.
   resources:
     requests:
       cpu: 100m
@@ -106,8 +109,21 @@ master:
       cpu: 100m
       memory: 800Mi
 
-# -- Resources for Celeborn worker containers.
 worker:
+  # -- Environment variables for Celeborn worker containers.
+  env:
+  - name: CELEBORN_WORKER_MEMORY
+    value: 100m
+  - name: CELEBORN_WORKER_OFFHEAP_MEMORY
+    value: 100m
+  - name: CELEBORN_WORKER_JAVA_OPTS
+    value: -XX:-PrintGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps 
-XX:+PrintGCDateStamps -Xloggc:gc-worker.out 
-Dio.netty.leakDetectionLevel=advanced
+  - name: CELEBORN_NO_DAEMONIZE
+    value: "true"
+  - name: TZ
+    value: Asia/Shanghai
+
+  # -- Resources for Celeborn worker containers.
   resources:
     requests:
       cpu: 100m
diff --git a/charts/celeborn/templates/master/statefulset.yaml 
b/charts/celeborn/templates/master/statefulset.yaml
index 92d64c9ec..d48fd030a 100644
--- a/charts/celeborn/templates/master/statefulset.yaml
+++ b/charts/celeborn/templates/master/statefulset.yaml
@@ -84,11 +84,10 @@ spec:
         - containerPort: {{ get .Values.celeborn "celeborn.master.http.port" | 
default 9098 }}
           name: metrics
           protocol: TCP
+        {{- with .Values.master.env }}
         env:
-        {{- range $key, $val := .Values.environments }}
-        - name: {{ $key }}
-          value: {{ $val | quote }}
-        {{- end}}
+        {{- 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 59d3d4f34..737f1a99e 100644
--- a/charts/celeborn/templates/worker/statefulset.yaml
+++ b/charts/celeborn/templates/worker/statefulset.yaml
@@ -87,11 +87,10 @@ spec:
         - containerPort: {{ get .Values.celeborn "celeborn.worker.http.port" | 
default 9096 }}
           name: metrics
           protocol: TCP
+        {{- with .Values.worker.env }}
         env:
-        {{- range $key, $val := .Values.environments }}
-        - name: {{ $key }}
-          value: {{ $val | quote }}
-        {{- end}}
+        {{- 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 5bc2d30a2..09fd89661 100644
--- a/charts/celeborn/tests/master/statefulset_test.yaml
+++ b/charts/celeborn/tests/master/statefulset_test.yaml
@@ -58,6 +58,49 @@ tests:
           path: spec.template.spec.containers[0].imagePullPolicy
           value: Always
 
+  - it: Should add environment variables if `master.env` is set
+    set:
+      master:
+        env:
+          - name: test-env-name-1
+            value: test-env-value-1
+          - name: test-env-name-2
+            valueFrom:
+              configMapKeyRef:
+                name: test-configmap
+                key: test-key
+                optional: false
+          - name: test-env-name-3
+            valueFrom:
+              secretKeyRef:
+                name: test-secret
+                key: test-key
+                optional: false
+    asserts:
+      - contains:
+          path: spec.template.spec.containers[0].env
+          content:
+            name: test-env-name-1
+            value: test-env-value-1
+      - contains:
+          path: spec.template.spec.containers[0].env
+          content:
+            name: test-env-name-2
+            valueFrom:
+              configMapKeyRef:
+                name: test-configmap
+                key: test-key
+                optional: false
+      - contains:
+          path: spec.template.spec.containers[0].env
+          content:
+            name: test-env-name-3
+            valueFrom:
+              secretKeyRef:
+                name: test-secret
+                key: test-key
+                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 8973d2d19..b6e651b10 100644
--- a/charts/celeborn/tests/worker/statefulset_test.yaml
+++ b/charts/celeborn/tests/worker/statefulset_test.yaml
@@ -58,6 +58,49 @@ tests:
           path: spec.template.spec.containers[0].imagePullPolicy
           value: Always
 
+  - it: Should add environment variables if `worker.env` is set
+    set:
+      worker:
+        env:
+          - name: test-env-name-1
+            value: test-env-value-1
+          - name: test-env-name-2
+            valueFrom:
+              configMapKeyRef:
+                name: test-configmap
+                key: test-key
+                optional: false
+          - name: test-env-name-3
+            valueFrom:
+              secretKeyRef:
+                name: test-secret
+                key: test-key
+                optional: false
+    asserts:
+      - contains:
+          path: spec.template.spec.containers[0].env
+          content:
+            name: test-env-name-1
+            value: test-env-value-1
+      - contains:
+          path: spec.template.spec.containers[0].env
+          content:
+            name: test-env-name-2
+            valueFrom:
+              configMapKeyRef:
+                name: test-configmap
+                key: test-key
+                optional: false
+      - contains:
+          path: spec.template.spec.containers[0].env
+          content:
+            name: test-env-name-3
+            valueFrom:
+              secretKeyRef:
+                name: test-secret
+                key: test-key
+                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 f70918f54..cb191056e 100644
--- a/charts/celeborn/values.yaml
+++ b/charts/celeborn/values.yaml
@@ -123,16 +123,6 @@ celeborn:
   celeborn.application.heartbeat.timeout: 120s
   celeborn.worker.heartbeat.timeout: 120s
 
-# -- Celeborn environment variables
-environments:
-  CELEBORN_MASTER_MEMORY: 2g
-  CELEBORN_MASTER_JAVA_OPTS: "-XX:-PrintGC -XX:+PrintGCDetails 
-XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -Xloggc:gc-master.out 
-Dio.netty.leakDetectionLevel=advanced"
-  CELEBORN_WORKER_MEMORY: 2g
-  CELEBORN_WORKER_OFFHEAP_MEMORY: 12g
-  CELEBORN_WORKER_JAVA_OPTS: "-XX:-PrintGC -XX:+PrintGCDetails 
-XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -Xloggc:gc-worker.out 
-Dio.netty.leakDetectionLevel=advanced"
-  CELEBORN_NO_DAEMONIZE: true
-  TZ: "Asia/Shanghai"
-
 # -- Specifies the DNS policy for Celeborn pods to use
 dnsPolicy: ClusterFirst
 
@@ -173,6 +163,17 @@ master:
     # key1: value1
     # key2: value2
 
+  # -- Environment variables for Celeborn master containers.
+  env:
+  - name: CELEBORN_MASTER_MEMORY
+    value: 2g
+  - name: CELEBORN_MASTER_JAVA_OPTS
+    value: -XX:-PrintGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps 
-XX:+PrintGCDateStamps -Xloggc:gc-master.out 
-Dio.netty.leakDetectionLevel=advanced
+  - name: CELEBORN_NO_DAEMONIZE
+    value: "true"
+  - name: TZ
+    value: Asia/Shanghai
+
   # -- Resources for Celeborn master containers.
   resources:
     # requests:
@@ -219,6 +220,19 @@ worker:
     # key1: value1
     # key2: value2
 
+  # -- Environment variables for Celeborn worker containers.
+  env:
+  - name: CELEBORN_WORKER_MEMORY
+    value: 2g
+  - name: CELEBORN_WORKER_OFFHEAP_MEMORY
+    value: 12g
+  - name: CELEBORN_WORKER_JAVA_OPTS
+    value: -XX:-PrintGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps 
-XX:+PrintGCDateStamps -Xloggc:gc-worker.out 
-Dio.netty.leakDetectionLevel=advanced
+  - name: CELEBORN_NO_DAEMONIZE
+    value: "true"
+  - name: TZ
+    value: Asia/Shanghai
+
   # -- Resources for Celeborn worker containers.
   resources:
     # requests:

Reply via email to