Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(helm): render pod-level securityContext on the migration Job (#35482)

Yassin Kortam97ec0470bfe9
diff --git a/helm/litellm-helm/templates/migrations-job.yaml b/helm/litellm-helm/templates/migrations-job.yaml
index 5ec7f5b7f3e..7bc1a133883 100644
--- a/helm/litellm-helm/templates/migrations-job.yaml
+++ b/helm/litellm-helm/templates/migrations-job.yaml
@@ -35,6 +35,8 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "litellm.migrationServiceAccountName" . }}
+ securityContext:
+ {{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- with .Values.migrationJob.extraInitContainers }}
initContainers:
{{- tpl (toYaml .) $ | nindent 8 }}
diff --git a/helm/litellm-helm/tests/migrations-job_tests.yaml b/helm/litellm-helm/tests/migrations-job_tests.yaml
index 05dd37b4857..6bfc1f38adc 100644
--- a/helm/litellm-helm/tests/migrations-job_tests.yaml
+++ b/helm/litellm-helm/tests/migrations-job_tests.yaml
@@ -254,3 +254,39 @@ tests:
content:
name: sidecar-tpl
image: "ghcr.io/berriai/litellm-database:test"
+ - it: should render the pod-level securityContext from podSecurityContext
+ template: migrations-job.yaml
+ set:
+ migrationJob:
+ enabled: true
+ podSecurityContext:
+ fsGroup: 10000
+ runAsUser: 10000
+ runAsNonRoot: true
+ asserts:
+ - equal:
+ path: spec.template.spec.securityContext
+ value:
+ fsGroup: 10000
+ runAsUser: 10000
+ runAsNonRoot: true
+ - it: should keep the pod-level and container-level securityContext separate
+ template: migrations-job.yaml
+ set:
+ migrationJob:
+ enabled: true
+ podSecurityContext:
+ fsGroup: 10000
+ securityContext:
+ allowPrivilegeEscalation: false
+ readOnlyRootFilesystem: true
+ asserts:
+ - equal:
+ path: spec.template.spec.securityContext
+ value:
+ fsGroup: 10000
+ - equal:
+ path: spec.template.spec.containers[0].securityContext
+ value:
+ allowPrivilegeEscalation: false
+ readOnlyRootFilesystem: true