From 97ec0470bfe9be50fb613f9e45017475a74da6ce Mon Sep 17 00:00:00 2001 From: Yassin Kortam Date: Sat, 1 Aug 2026 13:03:32 -0700 Subject: [PATCH] fix(helm): render pod-level securityContext on the migration Job (#35482) The litellm-helm proxy Deployment renders a pod-level securityContext from .Values.podSecurityContext, but the Prisma migration Job rendered only the container-level securityContext from .Values.securityContext. Clusters that enforce pod-level admission policies (OPA Gatekeeper K8sPSPAllowedUsers, or a PSP-style fsGroup MustRunAs rule) therefore admitted the Deployment and denied the Job, which blocks install and upgrade because the Job runs as an ArgoCD PreSync or Helm pre-install/pre-upgrade hook. The Job now renders the same pod-level securityContext the Deployment does. Charts that leave podSecurityContext unset render an empty securityContext, matching what the Deployment already emitted, so default installs are unchanged. Resolves LIT-4928 --- .../templates/migrations-job.yaml | 2 ++ .../tests/migrations-job_tests.yaml | 36 +++++++++++++++++++ 2 files changed, 38 insertions(+) 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