diff --git a/deploy/charts/litellm-helm/templates/hpa.yaml b/deploy/charts/litellm-helm/templates/hpa.yaml index 71e199c5aeb4..fec4d1f5c5ea 100644 --- a/deploy/charts/litellm-helm/templates/hpa.yaml +++ b/deploy/charts/litellm-helm/templates/hpa.yaml @@ -12,6 +12,10 @@ spec: name: {{ include "litellm.fullname" . }} minReplicas: {{ .Values.autoscaling.minReplicas }} maxReplicas: {{ .Values.autoscaling.maxReplicas }} + {{- if .Values.autoscaling.behavior }} + behavior: + {{- toYaml .Values.autoscaling.behavior | nindent 4 }} + {{- end }} metrics: {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - type: Resource diff --git a/deploy/charts/litellm-helm/tests/hpa_tests.yaml b/deploy/charts/litellm-helm/tests/hpa_tests.yaml new file mode 100644 index 000000000000..ec18c3591d30 --- /dev/null +++ b/deploy/charts/litellm-helm/tests/hpa_tests.yaml @@ -0,0 +1,36 @@ +suite: "hpa with behavior" +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 } + +--- +suite: "hpa without behavior" +templates: + - hpa.yaml +tests: + - it: "does not render behavior when not set" + set: + autoscaling.enabled: true + asserts: + - isKind: { of: HorizontalPodAutoscaler } + - isNull: { path: spec.behavior } diff --git a/deploy/charts/litellm-helm/values.yaml b/deploy/charts/litellm-helm/values.yaml index 9c7c013341ba..81558ed5b291 100644 --- a/deploy/charts/litellm-helm/values.yaml +++ b/deploy/charts/litellm-helm/values.yaml @@ -184,6 +184,7 @@ autoscaling: maxReplicas: 100 targetCPUUtilizationPercentage: 80 # targetMemoryUtilizationPercentage: 80 + # behavior: {} # Autoscaling with keda is mutually exclusive with hpa keda: