From 9bfdbe92e910a2f86e84329d212f2857cfbb1893 Mon Sep 17 00:00:00 2001 From: Kamlesh Joshi <72374645+kamleshjoshi8102@users.noreply.github.com> Date: Sat, 21 Feb 2026 08:03:39 +0530 Subject: [PATCH] Add init containers support to Helm chart (#1826) This commit adds support for init containers in the descheduler Helm chart, allowing users to run initialization tasks before the main descheduler container starts. Changes: - Add initContainers field to values.yaml with example usage - Update deployment.yaml template to render init containers - Update cronjob.yaml template to render init containers - Bump chart version from 0.34.0 to 0.34.1 Init containers can be used for various purposes such as: - Pre-loading configuration from external sources - Waiting for dependencies to be ready - Setting up required files or permissions - Running security scans or compliance checks Example usage in values.yaml: initContainers: - name: init-config image: busybox:1.28 command: ['sh', '-c', 'echo Initializing && sleep 5'] Signed-off-by: kjoshi --- charts/descheduler/templates/cronjob.yaml | 4 ++++ charts/descheduler/templates/deployment.yaml | 4 ++++ charts/descheduler/values.yaml | 7 +++++++ 3 files changed, 15 insertions(+) diff --git a/charts/descheduler/templates/cronjob.yaml b/charts/descheduler/templates/cronjob.yaml index a149b8d9d..7ab688a8c 100644 --- a/charts/descheduler/templates/cronjob.yaml +++ b/charts/descheduler/templates/cronjob.yaml @@ -96,6 +96,10 @@ spec: imagePullSecrets: {{- toYaml . | nindent 10 }} {{- end }} + {{- with .Values.initContainers }} + initContainers: + {{- toYaml . | nindent 12 }} + {{- end }} containers: - name: {{ .Chart.Name }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default (printf "v%s" .Chart.AppVersion) }}" diff --git a/charts/descheduler/templates/deployment.yaml b/charts/descheduler/templates/deployment.yaml index b124f9bed..86a331062 100644 --- a/charts/descheduler/templates/deployment.yaml +++ b/charts/descheduler/templates/deployment.yaml @@ -49,6 +49,10 @@ spec: imagePullSecrets: {{- toYaml . | nindent 6 }} {{- end }} + {{- with .Values.initContainers }} + initContainers: + {{- toYaml . | nindent 8 }} + {{- end }} containers: - name: {{ .Chart.Name }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default (printf "v%s" .Chart.AppVersion) }}" diff --git a/charts/descheduler/values.yaml b/charts/descheduler/values.yaml index 3ba1097e4..f98a8cf13 100644 --- a/charts/descheduler/values.yaml +++ b/charts/descheduler/values.yaml @@ -233,6 +233,13 @@ livenessProbe: periodSeconds: 20 timeoutSeconds: 5 +# Init containers to run before the main descheduler container +initContainers: [] +# Example: +# - name: init-myservice +# image: busybox:1.28 +# command: ['sh', '-c', 'echo The app is running! && sleep 10'] + service: enabled: false # @param service.ipFamilyPolicy [string], support SingleStack, PreferDualStack and RequireDualStack