test: add HPA autoscaling conformance test for KAR-0057 #104
All Vouch review confidence checks passed
Residual risk 0.28 = Change Risk (0.52) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #104"
general
weight: 0.35
janetkuo
Summary
This PR adds
TestHPAAutoscaling, an automated conformance test for KAR-0057: Effective HPA Autoscaling for AI Workloads.The test verifies that Kubernetes HorizontalPodAutoscaler (HPA) correctly scales accelerator-backed workloads using a custom per-Pod metric.
The implementation focuses specifically on HPA behavior rather than duplicating accelerator allocation checks covered by KAR-0051.
Refs #57, #96.
What the Test Covers
The test creates a Deployment whose Pods request an accelerator through DRA or a device plugin, depending on the configured
-allocation-mode.Each Pod performs a startup device check and exposes a controllable custom metric representing a synthetic inference queue depth.
The test uses an
autoscaling/v2HPA with aPodsmetric and anAverageValuetarget of 10.1. Baseline and negative control
2. Scale-up
3. Scale-down
4. Cleanup
The test verifies HPA autoscaling behavior for accelerator-backed workloads. It does not benchmark inference performance or independently validate accelerator allocation correctness.
Custom Metrics Requirements
The test relies on an existing custom metrics pipeline supplied by the platform. It does not install or replace the platform's custom metrics adapter.
The
-hpa-custom-metric-nameflag identifies the custom metric used for validation.If the platform supports HorizontalPodAutoscaler, it must support custom-metrics-based scaling for this requirement.
pod_autoscalingmay be marked N/A only when the platform does not support HPA itself.The test is skipped under
-shortand when the required custom metric is not configured.Configuration details and integration requirements are documented in
test/README.md.Changes Addressing Maintainer Review
Thank you to @janetkuo for the detailed review and suggestions.
This revision addresses all five review comments:
1. HPA applicability: Updated the skip message and documentation to clarify that N/A applies only when HPA itself is unsupported.
2. Accelerator allocation checks: Removed detailed DRA and device-plugin allocation validation. The test retains accelerator resource requests, the container startup device check, and Running/Ready verification.
3. Scale-down verification: Removed redundant Pod deletion and ResourceClaim-release assertions from the scale-down phase. Resource cleanup remains verified separately.
4. Unit test simplification: Removed
simCluster,TestHPAScenario, and simulation-only helpers. Retained pure-helper unit tests and focused tests for error classification and cleanup.5. Documentation: Updated the KAR-0057 README to describe the implemented test without pending/proposed wording and aligned
test/README.mdwith the revised implementation.An additional correction strengthens the negative-control observation-gap handling, with a focused regression test.
The revision reduces unnecessary complexity while preserving the core KAR-0057 validation behavior.
Validation
The maintainer-review revision was reported to pass the following local checks:
go test -v -short -count=1 ./test— 393 passed, 0 failed, 7 skipped.go test -race -short -count=1 ./test— Passed.go vet ./test— Passed.make lint— No issues reported.The final observation-gap correction additionally passed formatting, source-integrity, and patch-application checks. The full local Go suite has not been independently rerun after that correction.
Upstream CI on the latest commit:
pull-ai-conformance-verify— Passed.pull-ai-conformance-e2e-gcp— Pending at the time of this update.Remaining Validation
Real end-to-end validation of the HPA scenario on a Kubernetes cluster with two GPUs and a working custom metrics adapter is still pending.
The existing upstream GCP E2E environment does not provide the custom metrics adapter needed to exercise this opt-in scenario.
Once the required environment is available, real-cluster results can be added to this PR.
Scope
The changes are limited to:
test/hpa_autoscaling_test.gotest/hpa_autoscaling_unit_test.gotest/README.mdkars/0057-hpa-autoscaling-for-ai-workloads/README.mdUnrelated upstream functionality, including KAR-0061, remains unchanged.
This PR is ready for further maintainer review. Feedback and suggestions are welcome.