[ISSUE #7913] Start Kubernetes scaling only on the cluster master #7964
All Vouch review confidence checks passed
Residual risk 0.25 = Change Risk (0.63) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.63 · 276 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 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.336
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.063
Real PR Conversation Timeline
1 comments
"Review active on #7964"
general
weight: 0.35
Aias00
Problem
In clustered Admin mode every replica starts Kubernetes scaling independently.
ScaleTaskInitializeris aCommandLineRunner, so each Admin loads the scaling policy and registers its own time-window and metric tasks. Master election inShenyuClusterServiceowns the upstream and instance check services but never adopts scaling, so followers keep actuating after the lease moves and every replica competes to change the gateway Deployment replicas.Fixes #7913.
Change
ScaleServicenow has anactivegate.executeScaling()is a no-op untilstart()is called;stop()cancels the dynamic task and both window tasks and clears the applied target.ScaleTaskInitializeris replaced byScaleLifecycleService, which reloads the policy/rule caches from the database and starts or stops scaling. Activation and deactivation are synchronized.ShenyuClusterServicestarts scaling after winning the master lease and stops it on the exception path and infinally(normal lease loss or shutdown).ShenyuStandaloneServicestarts and stops scaling instart()/shutdown(), preserving the previous standalone behavior./scale/policyand/scale/ruleare added to the clusterforward-list, so policy and rule changes issued against a follower are forwarded to the current master instead of being applied locally by a non-owner.Tests
ScaleServiceTest: inactive reconciliation is a no-op;start()activates and reconciles;stop()cancels all tasks and is idempotent.ScaleLifecycleServiceTest: caches reload on every activation;stop()delegates.ShenyuClusterServiceTest: the master lifecycle calls start/stop, the error path stops twice safely, and no start happens when the lease is not won.ShenyuStandaloneServiceTest: start/shutdown delegation order.All 26 targeted tests pass and checkstyle reports 0 violations (Java 17).
Known gaps (out of scope)
MetricsMonitor.addObserver()has no production caller, so the policy-3 observer path remains unwired. This predates this change.