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

nicholasjiang 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 22336992a [CELEBORN-2214] Add extraInitContainers for worker in helm
22336992a is described below

commit 22336992ac4828a5957dff7f414a74993422d047
Author: Ping Zhang <[email protected]>
AuthorDate: Thu Dec 11 10:55:47 2025 +0800

    [CELEBORN-2214] Add extraInitContainers for worker in helm
    
    ### What changes were proposed in this pull request?
    
    Allow users to define more initContainers in the worker statefulset
    
    ### Why are the changes needed?
    
    This feature lets users define additional initContainers—for example, to 
wait for underlying NVMe disks to become ready.
    On AKS LSv3 nodes, the local NVMe devices require setup steps (in our case, 
a DaemonSet mounts them under /mnt). By supporting extraInitContainers, we can 
delay starting the Celeborn workers until the NVMe disks are fully mounted.
    
    ### Does this PR resolve a correctness bug?
    
    No
    
    ### Does this PR introduce _any_ user-facing change?
    
    No
    
    ### How was this patch tested?
    
    helm tests:
    
    ```
    ❯ helm unittest . --file "tests/**/*_test.yaml" --strict --debug
    
    ### Chart [ celeborn ] .
    
     PASS  Test Celeborn configmap  tests/configmap_test.yaml
     PASS  Test Celeborn role       tests/role_test.yaml
     PASS  Test Celeborn rolebinding        tests/rolebinding_test.yaml
     PASS  Test Celeborn service account    tests/serviceaccount_test.yaml
     PASS  Test Celeborn master pod monitor tests/master/podmonitor_test.yaml
     PASS  Test Celeborn master priority class      
tests/master/priorityclass_test.yaml
     PASS  Test Celeborn master service     tests/master/service_test.yaml
     PASS  Test Celeborn master statefulset tests/master/statefulset_test.yaml
     PASS  Test Celeborn worker pod monitor tests/worker/podmonitor_test.yaml
     PASS  Test Celeborn worker priority class      
tests/worker/priorityclass_test.yaml
     PASS  Test Celeborn worker service     tests/worker/service_test.yaml
     PASS  Test Celeborn worker statefulset tests/worker/statefulset_test.yaml
    
    Charts:      1 passed, 1 total
    Test Suites: 12 passed, 12 total
    Tests:       77 passed, 77 total
    Snapshot:    0 passed, 0 total
    Time:        125.416ms
    ```
    
    Closes #3550 from pingzh/dev/pingz-worker.extraInitContainers-CELEBORN-2214.
    
    Lead-authored-by: Ping Zhang <[email protected]>
    Co-authored-by: Ping Zhang <[email protected]>
    Signed-off-by: SteNicholas <[email protected]>
---
 charts/celeborn/templates/worker/statefulset.yaml  |  9 +++++--
 charts/celeborn/tests/worker/statefulset_test.yaml | 30 ++++++++++++++++++++++
 charts/celeborn/values.yaml                        |  3 +++
 3 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/charts/celeborn/templates/worker/statefulset.yaml 
b/charts/celeborn/templates/worker/statefulset.yaml
index a74571c62..a3f73c96a 100644
--- a/charts/celeborn/templates/worker/statefulset.yaml
+++ b/charts/celeborn/templates/worker/statefulset.yaml
@@ -54,8 +54,13 @@ spec:
       {{- end }}
       {{- end }}
       {{- end }}
-      {{- if $paths }}
+      {{- if or .Values.worker.extraInitContainers $paths }}
       initContainers:
+      {{- end }}
+      {{- with .Values.worker.extraInitContainers }}
+      {{- toYaml . | nindent 6 }}
+      {{- end }}
+      {{- if $paths }}
       - name: chown-celeborn-worker-volume
         image: {{ include "celeborn.image" . }}
         {{- with .Values.image.pullPolicy }}
@@ -78,7 +83,7 @@ spec:
         {{- end }}
         securityContext:
           runAsUser: 0
-        {{- end }}
+      {{- end }}
       containers:
       - name: {{ .Chart.Name }}
         image: {{ include "celeborn.image" . }}
diff --git a/charts/celeborn/tests/worker/statefulset_test.yaml 
b/charts/celeborn/tests/worker/statefulset_test.yaml
index e70dbfe3d..9be591fbf 100644
--- a/charts/celeborn/tests/worker/statefulset_test.yaml
+++ b/charts/celeborn/tests/worker/statefulset_test.yaml
@@ -486,3 +486,33 @@ tests:
                   storage: 200Gi
                 limits:
                   storage: 200Gi
+
+  - it: Should add extra init containers when `worker.extraInitContainers` is 
set
+    template: worker/statefulset.yaml
+    set:
+      worker:
+        volumeMounts: []
+        extraInitContainers:
+          - name: custom-init
+            image: busybox:1.36
+            command:
+              - sh
+              - -c
+              - echo "hello celeborn"
+    asserts:
+      - equal:
+          path: spec.template.spec.initContainers[0].name
+          value: custom-init
+      - equal:
+          path: spec.template.spec.initContainers[0].command[2]
+          value: echo "hello celeborn"
+
+  - it: Should not have initContainers when no volumes and extraInitContainers
+    template: worker/statefulset.yaml
+    set:
+      worker:
+        volumeMounts: []
+        extraInitContainers: []
+    asserts:
+      - notExists:
+          path: spec.template.spec.initContainers
diff --git a/charts/celeborn/values.yaml b/charts/celeborn/values.yaml
index ca57650d5..963742a6c 100644
--- a/charts/celeborn/values.yaml
+++ b/charts/celeborn/values.yaml
@@ -280,6 +280,9 @@ worker:
     # runAsGroup: 10006
     # fsGroup: 10006
 
+  # Add additional init containers into workers (templated).
+  extraInitContainers: []
+
   # --Volumes for Celeborn worker pods.
   volumes:
   - name: disk1

Reply via email to