Scale-to-zero enforcement with e2e tests and HPA configuration - #585
Merged
ev-shindin merged 18 commits intoJan 21, 2026
Conversation
ev-shindin
force-pushed
the
feature/scale-to-zero-enforcement
branch
from
January 14, 2026 13:52
5d51723 to
d6b5a56
Compare
Contributor
|
/ok-to-test |
Contributor
|
🚀 E2E tests triggered by /ok-to-test |
ev-shindin
force-pushed
the
feature/scale-to-zero-enforcement
branch
2 times, most recently
from
January 14, 2026 15:37
3375c15 to
380466a
Compare
ev-shindin
force-pushed
the
feature/scale-to-zero-enforcement
branch
7 times, most recently
from
January 19, 2026 14:24
77ce83a to
ca362cb
Compare
Implement scale-to-zero enforcement logic: - Add Enforcer in internal/engines/pipeline to enforce scale-to-zero policy based on ConfigMap settings and request count metrics - Update CRD to allow numReplicas=0 in DesiredOptimizedAlloc status - Add CollectModelRequestCount in collector to query request metrics for retention period checking - Integrate enforcer into saturation engine pipeline - Return errors from collector when metrics unavailable to prevent premature scale-to-zero decisions
Add comprehensive unit tests for scale-to-zero functionality: - Add tests for Enforcer in internal/engines/pipeline covering: - Scale-to-zero enabled/disabled scenarios - Retention period enforcement - Metrics unavailability handling - Add tests for CollectModelRequestCount in collector/registration covering error cases when metrics are unavailable
ev-shindin
force-pushed
the
feature/scale-to-zero-enforcement
branch
3 times, most recently
from
January 19, 2026 14:57
19fd48a to
8e30123
Compare
ev-shindin
force-pushed
the
feature/scale-to-zero-enforcement
branch
from
January 19, 2026 15:48
8e30123 to
fabfb0b
Compare
ev-shindin
force-pushed
the
feature/scale-to-zero-enforcement
branch
4 times, most recently
from
January 20, 2026 10:23
f801ef0 to
7da1f1d
Compare
3 tasks
Change the default value of BENCHMARK_MODE from "true" to "false" and add clarification that istioBench env is required in helmfile when enabling benchmark mode. Also update the CI e2e OpenShift workflow to explicitly set BENCHMARK_MODE=false since the istioBench environment is not available in the llm-d helmfile.
- Change logging levels from DEBUG to VERBOSE for error conditions in scale_to_zero.go (keep DEBUG for "no values" case) - Rename RequestCountFunc to RequestCountFuncType for clarity - Move isHPAScaleToZeroEnabled to dedicated feature_gates_test.go - Extract DumpControllerLogs and DumpVAStatus to debug_helpers.go - Use saturation.DefaultVariantCost instead of local constant in enforcer
ev-shindin
force-pushed
the
feature/scale-to-zero-enforcement
branch
from
January 20, 2026 19:02
a5fb1fa to
5da44e3
Compare
…gate disabled - Move IsHPAScaleToZeroEnabled to shared test/utils/feature_gates.go - Update OpenShift tests to use shared function - Skip deployment scale-to-zero test if HPAScaleToZero feature gate not enabled - Remove default focus on "Saturation Mode" from test-e2e target to run all tests
Use matrix strategy to run e2e tests on two Kind clusters concurrently: - One with HPAScaleToZero feature gate enabled - One with HPAScaleToZero feature gate disabled This ensures tests pass regardless of the feature gate setting and validates behavior in both configurations.
- Use distinct name 'llm-d-sim-stz' for scale-to-zero test resources to avoid conflicts with saturation test resources that use 'llm-d-sim' - Skip scale-to-zero tests that require minReplicas=0 when HPAScaleToZero feature gate is not enabled - Use minReplicas=1 in Scale-to-Zero Disabled test when feature gate is not available
Use func(g Gomega) pattern with g.Expect() instead of func() with Expect() inside Eventually blocks. The previous pattern caused tests to fail immediately on first check instead of retrying.
… gate disabled - Increase e2e-tests job timeout from default 30m to 60m - Skip retention period test when HPAScaleToZero feature gate is not enabled since it depends on scale-to-zero test completing first
- Try multiple label selectors for kube-controller-manager pod - Check both Command and Args for feature gate flag - Fall back to finding pod by name prefix if label selectors fail - This fixes false negatives when running on Kind clusters
Without the --enable-kvcache flag, llm-d-sim doesn't emit vllm:kv_cache_usage_perc metrics, causing the autoscaler to default to 0% usage and trigger inappropriate scale-downs. Enable KV cache with --enable-kvcache, --kv-cache-size=1024, and --block-size=16 flags.
lionelvillard
approved these changes
Jan 21, 2026
lionelvillard
left a comment
Collaborator
There was a problem hiding this comment.
Added a minor comment. LGTM
@thanks @ev-shindin !
| ctx context.Context, | ||
| modelID string, | ||
| namespace string, | ||
| saturationTargets map[string]int, |
Collaborator
There was a problem hiding this comment.
nit: maybe create a type alias for map[string]int. Like this it's not clear what string and int represent.
This was referenced Feb 14, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
internal/scaletozero/) that handles retention period-based scaling decisionsChanges
New Package:
internal/scaletozero/enforcer.go: Core enforcement logic with retention period trackingqueries.go: Prometheus query registration (moved from collector)HPA Configuration
hpa.minReplicasis now configurable (default: 1 for safety)HPA_MIN_REPLICASenvironment variable supportENABLE_SCALE_TO_ZEROE2E Tests
test/e2e-saturation-based/e2e_scale_to_zero_test.gotest/e2e-openshift/scale_to_zero_test.goDocumentation
docs/integrations/hpa-integration.mdwith OpenShift-specific instructionsTest plan
make testto verify unit tests passmake test-e2e-scale-to-zeroto test Kind scale-to-zero behaviormake test-e2e-openshift-scale-to-zeroon OpenShift cluster with HPAScaleToZero enabledmake test-e2e-saturation-based) still passNotes
Commits
feat(scale-to-zero): add enforcer package and e2e testsfeat(hpa): enable HPAScaleToZero feature gate and configurable minReplicasfeat(openshift): add HPAScaleToZero feature gate detection and docsfeat(ci): add separate make targets for scale-to-zero e2e testsci: enable scale-to-zero e2e tests in Kind CI workflow