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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(helm): render a fixed replicaCount on componentized deployments when HPA is disabled
yassin333fadad6ceb
diff --git a/helm/litellm/templates/backend/deployment.yaml b/helm/litellm/templates/backend/deployment.yamlindex 0db2f0b3d43..6370f581d71 100644--- a/helm/litellm/templates/backend/deployment.yaml+++ b/helm/litellm/templates/backend/deployment.yaml@@ -7,6 +7,9 @@ metadata:{{- include "litellm.commonLabels" . | nindent 4 }}app.kubernetes.io/component: backendspec:+ {{- if not .Values.backend.hpa.enabled }}+ replicas: {{ .Values.backend.replicaCount }}+ {{- end }}{{- with .Values.backend.strategy }}strategy:{{- toYaml . | nindent 4 }}diff --git a/helm/litellm/templates/gateway/deployment.yaml b/helm/litellm/templates/gateway/deployment.yamlindex c06cc9583a0..0c537b1bdeb 100644--- a/helm/litellm/templates/gateway/deployment.yaml+++ b/helm/litellm/templates/gateway/deployment.yaml@@ -7,6 +7,9 @@ metadata:{{- include "litellm.commonLabels" . | nindent 4 }}app.kubernetes.io/component: gatewayspec:+ {{- if not .Values.gateway.hpa.enabled }}+ replicas: {{ .Values.gateway.replicaCount }}+ {{- end }}{{- with .Values.gateway.strategy }}strategy:{{- toYaml . | nindent 4 }}diff --git a/helm/litellm/templates/ui/deployment.yaml b/helm/litellm/templates/ui/deployment.yamlindex b992b347bad..b794418b7e9 100644--- a/helm/litellm/templates/ui/deployment.yaml+++ b/helm/litellm/templates/ui/deployment.yaml@@ -7,6 +7,9 @@ metadata:{{- include "litellm.commonLabels" . | nindent 4 }}app.kubernetes.io/component: uispec:+ {{- if not .Values.ui.hpa.enabled }}+ replicas: {{ .Values.ui.replicaCount }}+ {{- end }}{{- with .Values.ui.strategy }}strategy:{{- toYaml . | nindent 4 }}diff --git a/helm/litellm/tests/replica_count_tests.yaml b/helm/litellm/tests/replica_count_tests.yamlnew file mode 100644index 00000000000..e6a28689ff5--- /dev/null+++ b/helm/litellm/tests/replica_count_tests.yaml@@ -0,0 +1,84 @@+suite: test fixed replica count when HPA is disabled+templates:+ - gateway/deployment.yaml+ - gateway/configmap.yaml+ - backend/deployment.yaml+ - ui/deployment.yaml+values:+ - ./values/required.yaml+tests:+ - it: gateway renders replicaCount into spec.replicas when its HPA is disabled+ template: gateway/deployment.yaml+ set:+ gateway.hpa.enabled: false+ gateway.replicaCount: 3+ asserts:+ - isKind:+ of: Deployment+ - equal:+ path: spec.replicas+ value: 3++ - it: backend renders replicaCount into spec.replicas when its HPA is disabled+ template: backend/deployment.yaml+ set:+ backend.hpa.enabled: false+ backend.replicaCount: 2+ asserts:+ - equal:+ path: spec.replicas+ value: 2++ - it: ui renders replicaCount into spec.replicas when its HPA is disabled+ template: ui/deployment.yaml+ set:+ ui.hpa.enabled: false+ ui.replicaCount: 2+ asserts:+ - equal:+ path: spec.replicas+ value: 2++ - it: replicaCount 0 scales the gateway to zero instead of being treated as unset+ template: gateway/deployment.yaml+ set:+ gateway.hpa.enabled: false+ gateway.replicaCount: 0+ asserts:+ - equal:+ path: spec.replicas+ value: 0++ - it: every component omits spec.replicas when its HPA is enabled, so the autoscaler owns the count+ set:+ gateway.hpa.enabled: true+ gateway.replicaCount: 3+ backend.hpa.enabled: true+ backend.replicaCount: 3+ ui.hpa.enabled: true+ ui.replicaCount: 3+ asserts:+ - notExists:+ path: spec.replicas+ template: gateway/deployment.yaml+ - notExists:+ path: spec.replicas+ template: backend/deployment.yaml+ - notExists:+ path: spec.replicas+ template: ui/deployment.yaml++ - it: a component with HPA disabled renders replicas while a sibling with HPA enabled does not+ set:+ gateway.hpa.enabled: false+ gateway.replicaCount: 4+ backend.hpa.enabled: true+ backend.replicaCount: 4+ asserts:+ - equal:+ path: spec.replicas+ value: 4+ template: gateway/deployment.yaml+ - notExists:+ path: spec.replicas+ template: backend/deployment.yamldiff --git a/helm/litellm/values.yaml b/helm/litellm/values.yamlindex 4ca54131d6a..d7836b03a34 100644--- a/helm/litellm/values.yaml+++ b/helm/litellm/values.yaml@@ -397,6 +397,10 @@ gateway:# failureThreshold: 30# periodSeconds: 10startupProbe: {}+ # Fixed pod count, rendered into the Deployment's spec.replicas only when+ # hpa.enabled is false. With the HPA on, the autoscaler owns the count and+ # this value is ignored.+ replicaCount: 1hpa:enabled: trueminReplicas: 1@@ -524,6 +528,8 @@ backend:strategy: {}# Optional startupProbe; same shape as gateway.startupProbe. Empty by default.startupProbe: {}+ # Same semantics as gateway.replicaCount.+ replicaCount: 1hpa:enabled: trueminReplicas: 1@@ -590,6 +596,8 @@ ui:strategy: {}# Optional startupProbe; same shape as gateway.startupProbe. Empty by default.startupProbe: {}+ # Same semantics as gateway.replicaCount.+ replicaCount: 1hpa:enabled: falseminReplicas: 1