From 0330217ad442895fafc1e03670872fc747d1431e Mon Sep 17 00:00:00 2001 From: amarrtech <272048731+amarrtech@users.noreply.github.com> Date: Tue, 6 Oct 2026 06:23:06 -0700 Subject: [PATCH 1/2] fix(helm): exclude migration jobs from proxy PDB Signed-off-by: amarrtech <272048731+amarrtech@users.noreply.github.com> --- helm/litellm-helm/templates/deployment.yaml | 1 + helm/litellm-helm/templates/poddisruptionbudget.yaml | 1 + helm/litellm-helm/tests/deployment_tests.yaml | 3 +++ helm/litellm-helm/tests/migrations-job_tests.yaml | 2 ++ helm/litellm-helm/tests/pdb_tests.yaml | 1 + 5 files changed, 8 insertions(+) diff --git a/helm/litellm-helm/templates/deployment.yaml b/helm/litellm-helm/templates/deployment.yaml index 299d41e2019..81fafad7ff8 100644 --- a/helm/litellm-helm/templates/deployment.yaml +++ b/helm/litellm-helm/templates/deployment.yaml @@ -34,6 +34,7 @@ spec: {{- end }} labels: {{- include "litellm.labels" . | nindent 8 }} + app.kubernetes.io/component: proxy {{- with .Values.podLabels }} {{- toYaml . | nindent 8 }} {{- end }} diff --git a/helm/litellm-helm/templates/poddisruptionbudget.yaml b/helm/litellm-helm/templates/poddisruptionbudget.yaml index 1715b94c1f6..753fd727d98 100644 --- a/helm/litellm-helm/templates/poddisruptionbudget.yaml +++ b/helm/litellm-helm/templates/poddisruptionbudget.yaml @@ -22,6 +22,7 @@ spec: matchLabels: {{- /* Match the Deployment selector to target the same pod set */ -}} {{- include "litellm.selectorLabels" . | nindent 6 }} + app.kubernetes.io/component: proxy {{- if .Values.pdb.minAvailable }} minAvailable: {{ .Values.pdb.minAvailable }} {{- else if .Values.pdb.maxUnavailable }} diff --git a/helm/litellm-helm/tests/deployment_tests.yaml b/helm/litellm-helm/tests/deployment_tests.yaml index ee946038202..0fd81dcb84b 100644 --- a/helm/litellm-helm/tests/deployment_tests.yaml +++ b/helm/litellm-helm/tests/deployment_tests.yaml @@ -16,6 +16,9 @@ tests: - equal: path: spec.template.spec.containers[0].image value: ghcr.io/berriai/litellm:test + - equal: + path: spec.template.metadata.labels['app.kubernetes.io/component'] + value: proxy - it: should work with tolerations template: deployment.yaml set: diff --git a/helm/litellm-helm/tests/migrations-job_tests.yaml b/helm/litellm-helm/tests/migrations-job_tests.yaml index dd4276ac60f..4466313edb0 100644 --- a/helm/litellm-helm/tests/migrations-job_tests.yaml +++ b/helm/litellm-helm/tests/migrations-job_tests.yaml @@ -21,6 +21,8 @@ tests: content: name: ANOTHER_VAR value: "another_value" + - notExists: + path: spec.template.metadata.labels['app.kubernetes.io/component'] - it: should work with extraEnvVars template: migrations-job.yaml diff --git a/helm/litellm-helm/tests/pdb_tests.yaml b/helm/litellm-helm/tests/pdb_tests.yaml index 5e042e80bd3..ba2b356c988 100644 --- a/helm/litellm-helm/tests/pdb_tests.yaml +++ b/helm/litellm-helm/tests/pdb_tests.yaml @@ -16,6 +16,7 @@ tests: value: app.kubernetes.io/name: litellm app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/component: proxy --- suite: "pdb disabled" From d021204fcc1810f215d5850a6d2aaff3c530677c Mon Sep 17 00:00:00 2001 From: amarrtech <272048731+amarrtech@users.noreply.github.com> Date: Tue, 6 Oct 2026 06:50:59 -0700 Subject: [PATCH 2/2] fix(helm): preserve PDB coverage during migration upgrades Signed-off-by: amarrtech <272048731+amarrtech@users.noreply.github.com> --- helm/litellm-helm/templates/deployment.yaml | 1 - .../templates/migrations-job.yaml | 3 ++- .../templates/poddisruptionbudget.yaml | 6 +++++- helm/litellm-helm/tests/deployment_tests.yaml | 3 --- .../tests/migrations-job_tests.yaml | 19 ++++++++++++++++++- helm/litellm-helm/tests/pdb_tests.yaml | 8 +++++++- 6 files changed, 32 insertions(+), 8 deletions(-) diff --git a/helm/litellm-helm/templates/deployment.yaml b/helm/litellm-helm/templates/deployment.yaml index 81fafad7ff8..299d41e2019 100644 --- a/helm/litellm-helm/templates/deployment.yaml +++ b/helm/litellm-helm/templates/deployment.yaml @@ -34,7 +34,6 @@ spec: {{- end }} labels: {{- include "litellm.labels" . | nindent 8 }} - app.kubernetes.io/component: proxy {{- with .Values.podLabels }} {{- toYaml . | nindent 8 }} {{- end }} diff --git a/helm/litellm-helm/templates/migrations-job.yaml b/helm/litellm-helm/templates/migrations-job.yaml index 5a873cbb965..229657b2e11 100644 --- a/helm/litellm-helm/templates/migrations-job.yaml +++ b/helm/litellm-helm/templates/migrations-job.yaml @@ -22,9 +22,10 @@ spec: metadata: labels: {{- include "litellm.labels" . | nindent 8 }} - {{- with .Values.podLabels }} + {{- with omit (default dict .Values.podLabels) "app.kubernetes.io/component" }} {{- toYaml . | nindent 8 }} {{- end }} + app.kubernetes.io/component: migration annotations: {{- with .Values.migrationJob.annotations }} {{- toYaml . | nindent 8 }} diff --git a/helm/litellm-helm/templates/poddisruptionbudget.yaml b/helm/litellm-helm/templates/poddisruptionbudget.yaml index 753fd727d98..a42a68f9ae7 100644 --- a/helm/litellm-helm/templates/poddisruptionbudget.yaml +++ b/helm/litellm-helm/templates/poddisruptionbudget.yaml @@ -22,7 +22,11 @@ spec: matchLabels: {{- /* Match the Deployment selector to target the same pod set */ -}} {{- include "litellm.selectorLabels" . | nindent 6 }} - app.kubernetes.io/component: proxy + matchExpressions: + - key: app.kubernetes.io/component + operator: NotIn + values: + - migration {{- if .Values.pdb.minAvailable }} minAvailable: {{ .Values.pdb.minAvailable }} {{- else if .Values.pdb.maxUnavailable }} diff --git a/helm/litellm-helm/tests/deployment_tests.yaml b/helm/litellm-helm/tests/deployment_tests.yaml index 0fd81dcb84b..ee946038202 100644 --- a/helm/litellm-helm/tests/deployment_tests.yaml +++ b/helm/litellm-helm/tests/deployment_tests.yaml @@ -16,9 +16,6 @@ tests: - equal: path: spec.template.spec.containers[0].image value: ghcr.io/berriai/litellm:test - - equal: - path: spec.template.metadata.labels['app.kubernetes.io/component'] - value: proxy - it: should work with tolerations template: deployment.yaml set: diff --git a/helm/litellm-helm/tests/migrations-job_tests.yaml b/helm/litellm-helm/tests/migrations-job_tests.yaml index 4466313edb0..20c9b080764 100644 --- a/helm/litellm-helm/tests/migrations-job_tests.yaml +++ b/helm/litellm-helm/tests/migrations-job_tests.yaml @@ -21,8 +21,25 @@ tests: content: name: ANOTHER_VAR value: "another_value" - - notExists: + - equal: path: spec.template.metadata.labels['app.kubernetes.io/component'] + value: migration + + - it: should keep migration component when shared pod labels conflict + template: migrations-job.yaml + set: + podLabels: + app.kubernetes.io/component: proxy + environment: test + migrationJob: + enabled: true + asserts: + - equal: + path: spec.template.metadata.labels['app.kubernetes.io/component'] + value: migration + - equal: + path: spec.template.metadata.labels.environment + value: test - it: should work with extraEnvVars template: migrations-job.yaml diff --git a/helm/litellm-helm/tests/pdb_tests.yaml b/helm/litellm-helm/tests/pdb_tests.yaml index ba2b356c988..121ce995bd6 100644 --- a/helm/litellm-helm/tests/pdb_tests.yaml +++ b/helm/litellm-helm/tests/pdb_tests.yaml @@ -16,7 +16,13 @@ tests: value: app.kubernetes.io/name: litellm app.kubernetes.io/instance: RELEASE-NAME - app.kubernetes.io/component: proxy + - equal: + path: spec.selector.matchExpressions + value: + - key: app.kubernetes.io/component + operator: NotIn + values: + - migration --- suite: "pdb disabled"