feat(cache): support HPA on CacheRuntime via scale subresource and status selector #6223
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.42) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 320 lines diff across 4 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.345
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #6223"
general
weight: 0.35
cheyang
<!--
Please make sure you have read and understood the contributing guidelines;
https://github.com/fluid-cloudnative/fluid/blob/master/CONTRIBUTING.md-->
Ⅰ. Describe what this PR does
Add HPA support for the new CacheRuntime API:
1. Populate
Status.Selector: the CacheEngine setsstatus.selectorto the serialized label selector of the worker component (e.g.cacheruntime.fluid.io/component-name=<runtime>-worker,cacheruntime.fluid.io/name=<runtime>), which the scale subresource exposes to HPA for pod discovery.2. Scale subresource on the CacheRuntime CRD:
+kubebuilder:subresource:scalewithspecReplicasPath: .spec.worker.replicas,statusReplicasPath: .status.worker.currentReplicas,labelSelectorPath: .status.selector— enableskubectl scaleand HPA targeting of CacheRuntime, mirroring what the existing runtime CRDs (e.g. AlluxioRuntime) already do.3. Worker spec sync: replica writes through the scale subresource flow via the existing
SyncComponentSpecpath to the worker AdvancedStatefulSet.Note on component optionality: master and worker are optional components (e.g. a P2P cache may have neither). Whether a component is created is decided by the runtime class topology plus the per-component
disabledflag, not by the presence of the spec block — so the scale subresource only applies to runtimes with the worker component enabled, and a GET on.../scalefailing for a runtime without a worker is expected.Ⅱ. Does this pull request fix one issue?
#6063
Ⅲ. List the added test cases (unit test/integration test) if any, please explain if no tests are needed.
pkg/ddc/cache/engine.test/gha-e2e/curvine/test.sh), deliberately without deploying a real HPA:- asserts
status.selectoris set and actually discovers the worker pods;- reads
GET .../scaleand assertsspec.replicas,status.replicasand the stringselectorfield (autoscaling/v1ScaleStatus.Selector, filled by the API server fromlabelSelectorPath);- scales workers up through the scale subresource (the same write path an HPA takes) and down via a direct spec patch, verifying pod counts both ways.
Ⅳ. Describe how to verify it
Run the kind-e2e-test workflow (curvine case). The scale subresource contract is verified directly against the API server, so no HPA object is required.
Ⅴ. Special notes for reviews
https://github.com/fluid-cloudnative/fluid/pull/6064 is another fix, but has no update for two months.