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

SteNicholas 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 ae8cdcab2c [CELEBORN-2518][HELM] Add extraInitContainers for master in 
helm
ae8cdcab2c is described below

commit ae8cdcab2cd5239382d5a6dbf667a68e05b45df0
Author: strelok89 <[email protected]>
AuthorDate: Sun Nov 8 12:43:02 2026 +0800

    [CELEBORN-2518][HELM] Add extraInitContainers for master in helm
    
    ### What changes were proposed in this pull request?
    
    Add `master.extraInitContainers` to the Helm chart, mirroring 
`worker.extraInitContainers` (CELEBORN-2214). Extra init containers are 
rendered before the built-in `chown-celeborn-master-volume` init container.
    
    ### Why are the changes needed?
    
    The master statefulset has no way to add init containers today, while the 
worker statefulset does. A common need is staging extra jars on the master 
classpath without building a custom image. For example, a custom 
`ConfigService` implementation selected through 
`celeborn.dynamicConfig.store.backend`: an init container copies the jar into 
an `emptyDir`, and the master container mounts it into `master-jars`.
    
    Running extra init containers first matters for that case. If a mount of a 
file that is not yet in the volume is set up by an earlier container, the 
kubelet creates a directory at that path instead.
    
    ### Does this PR resolve a correctness bug?
    
    No.
    
    ### Does this PR introduce _any_ user-facing change?
    
    Yes, a new optional chart value `master.extraInitContainers`, default `[]`. 
Rendered manifests are unchanged when it is not set.
    
    ### How was this patch tested?
    
    New helm unit tests in `tests/master/statefulset_test.yaml`: extra init 
containers rendered, ordered before the chown init container, and no 
`initContainers` key when neither is present.
    
    ```
    helm unittest . --file "tests/**/*_test.yaml" --strict
    
    Charts:      1 passed, 1 total
    Test Suites: 13 passed, 13 total
    Tests:       137 passed, 137 total
    ```
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Closes #3917 from strelok89/CELEBORN-master-extraInitContainers.
    
    Authored-by: strelok89 <[email protected]>
    Signed-off-by: Nicholas Jiang <[email protected]>
---
 charts/celeborn/templates/master/statefulset.yaml  |  7 +++-
 charts/celeborn/tests/master/statefulset_test.yaml | 45 ++++++++++++++++++++++
 charts/celeborn/values.yaml                        |  5 ++-
 3 files changed, 55 insertions(+), 2 deletions(-)

diff --git a/charts/celeborn/templates/master/statefulset.yaml 
b/charts/celeborn/templates/master/statefulset.yaml
index d2ea5175e4..086fa1fd00 100644
--- a/charts/celeborn/templates/master/statefulset.yaml
+++ b/charts/celeborn/templates/master/statefulset.yaml
@@ -54,8 +54,13 @@ spec:
       {{- end }}
       {{- end }}
       {{- end }}
-      {{- if $paths }}
+      {{- if or .Values.master.extraInitContainers $paths }}
       initContainers:
+      {{- end }}
+      {{- with .Values.master.extraInitContainers }}
+      {{- toYaml . | nindent 6 }}
+      {{- end }}
+      {{- if $paths }}
       - name: chown-celeborn-master-volume
         image: {{ include "celeborn.image" . }}
         {{- with .Values.image.pullPolicy }}
diff --git a/charts/celeborn/tests/master/statefulset_test.yaml 
b/charts/celeborn/tests/master/statefulset_test.yaml
index 01a9f40234..f19c883df2 100644
--- a/charts/celeborn/tests/master/statefulset_test.yaml
+++ b/charts/celeborn/tests/master/statefulset_test.yaml
@@ -508,3 +508,48 @@ tests:
                   storage: 200Gi
                 limits:
                   storage: 200Gi
+
+  - it: Should add extra init containers when `master.extraInitContainers` is 
set
+    template: master/statefulset.yaml
+    set:
+      master:
+        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 run extra init containers before the volume chown init container
+    template: master/statefulset.yaml
+    set:
+      master:
+        extraInitContainers:
+          - name: custom-init
+            image: busybox:1.36
+    asserts:
+      - equal:
+          path: spec.template.spec.initContainers[0].name
+          value: custom-init
+      - equal:
+          path: spec.template.spec.initContainers[1].name
+          value: chown-celeborn-master-volume
+
+  - it: Should not have initContainers when no volumes and extraInitContainers
+    template: master/statefulset.yaml
+    set:
+      master:
+        volumeMounts: []
+        extraInitContainers: []
+    asserts:
+      - notExists:
+          path: spec.template.spec.initContainers
diff --git a/charts/celeborn/values.yaml b/charts/celeborn/values.yaml
index 4fb8633959..2100957e70 100644
--- a/charts/celeborn/values.yaml
+++ b/charts/celeborn/values.yaml
@@ -143,6 +143,9 @@ master:
     # runAsGroup: 10006
     # fsGroup: 10006
 
+  # Add additional init containers into masters.
+  extraInitContainers: []
+
   # -- Volumes for Celeborn master pods.
   volumes:
   - name: celeborn-ratis
@@ -386,7 +389,7 @@ worker:
     # runAsGroup: 10006
     # fsGroup: 10006
 
-  # Add additional init containers into workers (templated).
+  # Add additional init containers into workers.
   extraInitContainers: []
 
   # --Volumes for Celeborn worker pods.

Reply via email to