mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-11 22:51:28 +00:00
* fix(helm): scale the classic chart's HPA out at the documented 60 percent CPU The litellm-helm chart shipped targetCPUUtilizationPercentage: 80, which is unexamined helm create scaffold rather than a chosen number. It arrived packaged with the stock minReplicas: 1, maxReplicas: 100, a commented-out targetMemoryUtilizationPercentage: 80, and the boilerplate "such as Minikube" comment, the same provenance as the 128Mi resource example this file just corrected. 60 is the documented recommendation. The mechanism behind it is scale-up lag: the chart's own startupProbe is failureThreshold: 30 times periodSeconds: 10, so a replica can take up to 300 seconds to become ready, and a pod added at 80 percent utilization arrives minutes after saturation. The memory target stays commented out on purpose. The prisma query engine's resident memory is a high-water mark that ratchets to the pod's worst-ever write and is never returned, so a memory-target HPA reads the largest write a pod ever did rather than what it is doing now, and replicas ratchet up without scaling back in. hpa_tests.yaml carried its second suite after a YAML document separator, and helm-unittest loads only the first document per file, so that suite never ran; an assertion planted in it still passed. Fold it into the one live suite and add coverage pinning the rendered CPU target, the absence of a memory metric by default, and that overrides still take effect. Bump the chart to 1.1.2, since rendered output changes for anyone running with autoscaling enabled. * fix(helm): bump litellm-helm to 1.1.3 after rebase onto 1.1.2 Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
66 lines
2.1 KiB
YAML
66 lines
2.1 KiB
YAML
suite: "hpa"
|
|
templates:
|
|
- hpa.yaml
|
|
tests:
|
|
- it: "renders behavior when set"
|
|
set:
|
|
autoscaling.enabled: true
|
|
autoscaling.behavior:
|
|
scaleUp:
|
|
stabilizationWindowSeconds: 60
|
|
policies:
|
|
- type: Pods
|
|
value: 2
|
|
periodSeconds: 60
|
|
scaleDown:
|
|
stabilizationWindowSeconds: 90
|
|
policies:
|
|
- type: Pods
|
|
value: 1
|
|
periodSeconds: 60
|
|
asserts:
|
|
- isKind: { of: HorizontalPodAutoscaler }
|
|
- equal: { path: spec.behavior.scaleUp.stabilizationWindowSeconds, value: 60 }
|
|
- equal: { path: spec.behavior.scaleDown.stabilizationWindowSeconds, value: 90 }
|
|
|
|
- it: "does not render behavior when not set"
|
|
set:
|
|
autoscaling.enabled: true
|
|
asserts:
|
|
- isKind: { of: HorizontalPodAutoscaler }
|
|
- isNull: { path: spec.behavior }
|
|
|
|
- it: "scales on cpu at the documented 60 percent by default"
|
|
set:
|
|
autoscaling.enabled: true
|
|
asserts:
|
|
- isKind: { of: HorizontalPodAutoscaler }
|
|
- equal: { path: "spec.metrics[0].resource.name", value: cpu }
|
|
- equal: { path: "spec.metrics[0].resource.target.type", value: Utilization }
|
|
- equal: { path: "spec.metrics[0].resource.target.averageUtilization", value: 60 }
|
|
|
|
- it: "does not scale on memory by default"
|
|
set:
|
|
autoscaling.enabled: true
|
|
asserts:
|
|
- lengthEqual: { path: spec.metrics, count: 1 }
|
|
|
|
- it: "honours an explicit cpu target override"
|
|
set:
|
|
autoscaling.enabled: true
|
|
autoscaling.targetCPUUtilizationPercentage: 75
|
|
asserts:
|
|
- equal: { path: "spec.metrics[0].resource.target.averageUtilization", value: 75 }
|
|
|
|
- it: "renders a memory metric only when a memory target is set"
|
|
set:
|
|
autoscaling.enabled: true
|
|
autoscaling.targetMemoryUtilizationPercentage: 80
|
|
asserts:
|
|
- lengthEqual: { path: spec.metrics, count: 2 }
|
|
- equal: { path: "spec.metrics[1].resource.name", value: memory }
|
|
- equal: { path: "spec.metrics[1].resource.target.averageUtilization", value: 80 }
|
|
|
|
- it: "renders no hpa when autoscaling is disabled"
|
|
asserts:
|
|
- hasDocuments: { count: 0 }
|