diff --git a/deploy/charts/litellm-helm/Chart.yaml b/deploy/charts/litellm-helm/Chart.yaml index b6ac264a22..e361ee226b 100644 --- a/deploy/charts/litellm-helm/Chart.yaml +++ b/deploy/charts/litellm-helm/Chart.yaml @@ -18,7 +18,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.4.5 +version: 0.4.6 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/deploy/charts/litellm-helm/README.md b/deploy/charts/litellm-helm/README.md index 86b5918f01..352c3e9ddf 100644 --- a/deploy/charts/litellm-helm/README.md +++ b/deploy/charts/litellm-helm/README.md @@ -41,6 +41,11 @@ If `db.useStackgresOperator` is used (not yet implemented): | `proxyConfigMap.key` | Key in the ConfigMap that contains the proxy config file. | `"config.yaml"` | | `proxy_config.*` | See [values.yaml](./values.yaml) for default settings. Rendered into the ConfigMap’s `config.yaml` only when `proxyConfigMap.create=true`. See [example_config_yaml](../../../litellm/proxy/example_config_yaml/) for configuration examples. | `N/A` | | `extraContainers[]` | An array of additional containers to be deployed as sidecars alongside the LiteLLM Proxy. +| `pdb.enabled` | Enable a PodDisruptionBudget for the LiteLLM proxy Deployment | `false` | +| `pdb.minAvailable` | Minimum number/percentage of pods that must be available during **voluntary** disruptions (choose **one** of minAvailable/maxUnavailable) | `null` | +| `pdb.maxUnavailable` | Maximum number/percentage of pods that can be unavailable during **voluntary** disruptions (choose **one** of minAvailable/maxUnavailable) | `null` | +| `pdb.annotations` | Extra metadata annotations to add to the PDB | `{}` | +| `pdb.labels` | Extra metadata labels to add to the PDB | `{}` | #### Example `proxy_config` ConfigMap from values (default): diff --git a/deploy/charts/litellm-helm/templates/NOTES.txt b/deploy/charts/litellm-helm/templates/NOTES.txt index e72c991608..017bbfa78b 100644 --- a/deploy/charts/litellm-helm/templates/NOTES.txt +++ b/deploy/charts/litellm-helm/templates/NOTES.txt @@ -20,3 +20,4 @@ echo "Visit http://127.0.0.1:8080 to use your application" kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT {{- end }} +PDB: {{ if .Values.pdb.enabled }}enabled{{ else }}disabled{{ end }}. Configure via .Values.pdb.* \ No newline at end of file diff --git a/deploy/charts/litellm-helm/templates/poddisruptionbudget.yaml b/deploy/charts/litellm-helm/templates/poddisruptionbudget.yaml new file mode 100644 index 0000000000..1715b94c1f --- /dev/null +++ b/deploy/charts/litellm-helm/templates/poddisruptionbudget.yaml @@ -0,0 +1,33 @@ +{{- /* +PodDisruptionBudget for LiteLLM proxy +Controlled via .Values.pdb.enabled and .Values.pdb.{minAvailable|maxUnavailable} +Only one of minAvailable / maxUnavailable should be set. If both are set, minAvailable wins. +*/ -}} +{{- if .Values.pdb.enabled }} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ include "litellm.fullname" . }} + labels: + {{- include "litellm.labels" . | nindent 4 }} + {{- with .Values.pdb.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.pdb.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + selector: + matchLabels: + {{- /* Match the Deployment selector to target the same pod set */ -}} + {{- include "litellm.selectorLabels" . | nindent 6 }} + {{- if .Values.pdb.minAvailable }} + minAvailable: {{ .Values.pdb.minAvailable }} + {{- else if .Values.pdb.maxUnavailable }} + maxUnavailable: {{ .Values.pdb.maxUnavailable }} + {{- else }} + # Safe default if enabled but not configured + maxUnavailable: 1 + {{- end }} +{{- end }} diff --git a/deploy/charts/litellm-helm/tests/pdb_tests.yaml b/deploy/charts/litellm-helm/tests/pdb_tests.yaml new file mode 100644 index 0000000000..5e042e80bd --- /dev/null +++ b/deploy/charts/litellm-helm/tests/pdb_tests.yaml @@ -0,0 +1,45 @@ +suite: "pdb enabled" +templates: + - poddisruptionbudget.yaml +tests: + - it: "renders a PDB with maxUnavailable=1" + set: + pdb.enabled: true + pdb.maxUnavailable: 1 + asserts: + - hasDocuments: { count: 1 } + - isKind: { of: PodDisruptionBudget } + - equal: { path: apiVersion, value: policy/v1 } + - equal: { path: spec.maxUnavailable, value: 1 } + - equal: + path: spec.selector.matchLabels + value: + app.kubernetes.io/name: litellm + app.kubernetes.io/instance: RELEASE-NAME + +--- +suite: "pdb disabled" +templates: + - poddisruptionbudget.yaml +tests: + - it: "does not render when disabled" + set: + pdb.enabled: false + asserts: + - hasDocuments: { count: 0 } + +--- +suite: "pdb minAvailable precedence" +templates: + - poddisruptionbudget.yaml +tests: + - it: "uses minAvailable when both are set" + set: + pdb.enabled: true + pdb.minAvailable: "50%" + pdb.maxUnavailable: 1 + asserts: + - isKind: { of: PodDisruptionBudget } + - equal: { path: apiVersion, value: policy/v1 } + - equal: { path: spec.minAvailable, value: "50%" } + - isNull: { path: spec.maxUnavailable } diff --git a/deploy/charts/litellm-helm/values.yaml b/deploy/charts/litellm-helm/values.yaml index 58d1880cd4..c1792497d2 100644 --- a/deploy/charts/litellm-helm/values.yaml +++ b/deploy/charts/litellm-helm/values.yaml @@ -240,4 +240,11 @@ extraEnvVars: { # value: EXTRA_ENV_VAR_VALUE } - +# Pod Disruption Budget +pdb: + enabled: false + # Set exactly one of the following. If both are set, minAvailable takes precedence. + minAvailable: null # e.g. "50%" or 1 + maxUnavailable: null # e.g. 1 or "20%" + annotations: {} + labels: {}