diff --git a/helm/litellm-helm/templates/migrations-job.yaml b/helm/litellm-helm/templates/migrations-job.yaml index 7aa96a59102..659f8c1e67a 100644 --- a/helm/litellm-helm/templates/migrations-job.yaml +++ b/helm/litellm-helm/templates/migrations-job.yaml @@ -28,12 +28,13 @@ 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 }} - {{- with .Values.migrationJob.podLabels }} + {{- with omit (default dict .Values.migrationJob.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 1715b94c1f6..a42a68f9ae7 100644 --- a/helm/litellm-helm/templates/poddisruptionbudget.yaml +++ b/helm/litellm-helm/templates/poddisruptionbudget.yaml @@ -22,6 +22,11 @@ spec: matchLabels: {{- /* Match the Deployment selector to target the same pod set */ -}} {{- include "litellm.selectorLabels" . | nindent 6 }} + 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/migrations-job_tests.yaml b/helm/litellm-helm/tests/migrations-job_tests.yaml index bd5dd457f95..3ac79ec4b10 100644 --- a/helm/litellm-helm/tests/migrations-job_tests.yaml +++ b/helm/litellm-helm/tests/migrations-job_tests.yaml @@ -21,6 +21,25 @@ tests: content: name: ANOTHER_VAR value: "another_value" + - 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 @@ -389,10 +408,14 @@ tests: enabled: true podLabels: custom.io/pod-role: migration + app.kubernetes.io/component: proxy asserts: - equal: path: spec.template.metadata.labels['custom.io/pod-role'] value: migration + - equal: + path: spec.template.metadata.labels['app.kubernetes.io/component'] + value: migration - it: should override container command and args template: migrations-job.yaml diff --git a/helm/litellm-helm/tests/pdb_tests.yaml b/helm/litellm-helm/tests/pdb_tests.yaml index 5e042e80bd3..121ce995bd6 100644 --- a/helm/litellm-helm/tests/pdb_tests.yaml +++ b/helm/litellm-helm/tests/pdb_tests.yaml @@ -16,6 +16,13 @@ tests: value: app.kubernetes.io/name: litellm app.kubernetes.io/instance: RELEASE-NAME + - equal: + path: spec.selector.matchExpressions + value: + - key: app.kubernetes.io/component + operator: NotIn + values: + - migration --- suite: "pdb disabled"