From c9a775123268c06c06d9e60c7decc3494b55be87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samy=20Djema=C3=AF?= <53857555+SamyDjemai@users.noreply.github.com> Date: Thu, 6 Aug 2026 19:10:45 +0200 Subject: [PATCH] feat(helm): add command/args override for gateway, backend, and ui Allow overriding the container entrypoint (command) and arguments (args) for all three components: gateway, backend, and ui. When unset, the image's default ENTRYPOINT/CMD is used (current behavior). When set, the values are rendered into the Deployment template. This enables use cases like running the gateway with Granian instead of uvicorn (--run_granian) without needing to fork the chart or use ServerSideApply patches from a separate ArgoCD source. --- .../litellm/templates/backend/deployment.yaml | 8 ++ .../litellm/templates/gateway/deployment.yaml | 8 ++ helm/litellm/templates/ui/deployment.yaml | 8 ++ helm/litellm/tests/command_args_tests.yaml | 89 +++++++++++++++++++ helm/litellm/values.yaml | 6 ++ 5 files changed, 119 insertions(+) create mode 100644 helm/litellm/tests/command_args_tests.yaml diff --git a/helm/litellm/templates/backend/deployment.yaml b/helm/litellm/templates/backend/deployment.yaml index c5d799a0faf..0c1fea1f4e6 100644 --- a/helm/litellm/templates/backend/deployment.yaml +++ b/helm/litellm/templates/backend/deployment.yaml @@ -41,6 +41,14 @@ spec: - name: backend image: "{{ .Values.backend.image.repository }}:{{ .Values.backend.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.backend.image.pullPolicy }} + {{- with .Values.backend.command }} + command: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.backend.args }} + args: + {{- toYaml . | nindent 12 }} + {{- end }} {{- with .Values.backend.securityContext }} securityContext: {{- toYaml . | nindent 12 }} diff --git a/helm/litellm/templates/gateway/deployment.yaml b/helm/litellm/templates/gateway/deployment.yaml index 7d16134a53d..01d9860ce3d 100644 --- a/helm/litellm/templates/gateway/deployment.yaml +++ b/helm/litellm/templates/gateway/deployment.yaml @@ -39,6 +39,14 @@ spec: - name: gateway image: "{{ .Values.gateway.image.repository }}:{{ .Values.gateway.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.gateway.image.pullPolicy }} + {{- with .Values.gateway.command }} + command: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.gateway.args }} + args: + {{- toYaml . | nindent 12 }} + {{- end }} {{- with .Values.gateway.securityContext }} securityContext: {{- toYaml . | nindent 12 }} diff --git a/helm/litellm/templates/ui/deployment.yaml b/helm/litellm/templates/ui/deployment.yaml index b4129dbc8ac..4b7d3b148f0 100644 --- a/helm/litellm/templates/ui/deployment.yaml +++ b/helm/litellm/templates/ui/deployment.yaml @@ -36,6 +36,14 @@ spec: - name: ui image: "{{ .Values.ui.image.repository }}:{{ .Values.ui.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.ui.image.pullPolicy }} + {{- with .Values.ui.command }} + command: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.ui.args }} + args: + {{- toYaml . | nindent 12 }} + {{- end }} {{- with .Values.ui.securityContext }} securityContext: {{- toYaml . | nindent 12 }} diff --git a/helm/litellm/tests/command_args_tests.yaml b/helm/litellm/tests/command_args_tests.yaml new file mode 100644 index 00000000000..0e41694675a --- /dev/null +++ b/helm/litellm/tests/command_args_tests.yaml @@ -0,0 +1,89 @@ +suite: test container command and args overrides +templates: + - gateway/deployment.yaml + - gateway/configmap.yaml + - backend/deployment.yaml + - ui/deployment.yaml +values: + - ./values/required.yaml +tests: + - it: gateway omits command and args by default + template: gateway/deployment.yaml + asserts: + - isNull: + path: spec.template.spec.containers[0].command + - isNull: + path: spec.template.spec.containers[0].args + + - it: gateway renders command and args when set + template: gateway/deployment.yaml + set: + gateway.command: + - .venv/bin/granian + gateway.args: + - gateway.main:app + - --http + - auto + asserts: + - equal: + path: spec.template.spec.containers[0].command + value: + - .venv/bin/granian + - equal: + path: spec.template.spec.containers[0].args + value: + - gateway.main:app + - --http + - auto + + - it: backend omits command and args by default + template: backend/deployment.yaml + asserts: + - isNull: + path: spec.template.spec.containers[0].command + - isNull: + path: spec.template.spec.containers[0].args + + - it: backend renders command and args when set + template: backend/deployment.yaml + set: + backend.command: + - python + backend.args: + - -m + - litellm + asserts: + - equal: + path: spec.template.spec.containers[0].command + value: + - python + - equal: + path: spec.template.spec.containers[0].args + value: + - -m + - litellm + + - it: ui omits command and args by default + template: ui/deployment.yaml + asserts: + - isNull: + path: spec.template.spec.containers[0].command + - isNull: + path: spec.template.spec.containers[0].args + + - it: ui renders command and args when set + template: ui/deployment.yaml + set: + ui.command: + - node + ui.args: + - server.js + asserts: + - equal: + path: spec.template.spec.containers[0].command + value: + - node + - equal: + path: spec.template.spec.containers[0].args + value: + - server.js diff --git a/helm/litellm/values.yaml b/helm/litellm/values.yaml index cd377667602..dbefdaafc1a 100644 --- a/helm/litellm/values.yaml +++ b/helm/litellm/values.yaml @@ -202,6 +202,8 @@ gateway: repository: ghcr.io/berriai/litellm-gateway tag: "" # defaults to .Chart.AppVersion pullPolicy: IfNotPresent + command: [] + args: [] service: type: ClusterIP port: 4000 @@ -298,6 +300,8 @@ backend: repository: ghcr.io/berriai/litellm-backend tag: "" pullPolicy: IfNotPresent + command: [] + args: [] service: type: ClusterIP port: 4001 @@ -358,6 +362,8 @@ ui: repository: ghcr.io/berriai/litellm-ui tag: "" pullPolicy: IfNotPresent + command: [] + args: [] service: type: ClusterIP port: 3000