fix: skip inactive GameServerSets held by Allocated or Reserved GameServers #4814
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.48) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.48 · 545 lines diff across 6 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.377
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #4814"
general
weight: 0.35
markmandel
What type of PR is this?
/kind bug
What this PR does / Why we need it:
During a rolling update,
rollingUpdateReststops at the first inactive GameServerSet whoseSpec.Replicas != Status.Replicas, to wait for a scale down that is still in progress. Allocated or Reserved GameServers can keep an inactive GameServerSet above its target until they are shut down. When that GameServerSet comes first inrest, which follows the unsorted lister order, no other inactive GameServerSet is scaled down in that sync, and their Ready GameServers can stay for minutes after the new GameServerSet is Ready. #4802 has the reproduction and the measurements.This PR skips an inactive GameServerSet that is above its target and has only Allocated or Reserved GameServers left (
Status.Replicas == AllocatedReplicas + ReservedReplicas). There is no scale down to wait for in that GameServerSet: it reaches its target only when those GameServers are shut down.In all other cases where
Spec.Replicas != Status.Replicas, the loop still stops. This keeps the wait for a scale down that is in progress.Status.Replicasexcludes GameServers that are being deleted, so the Ready counts are stale right after a target is lowered, and continuing there could exceedmaxUnavailable.Changes:
pkg/fleets/controller.go: the skip described above.pkg/fleets/controller_rollingupdatefix_test.go:TestControllerRollingUpdateRestMultipleInactiveGameServerSets.test/e2e/fleet_test.go:TestFleetRollingUpdateWithBlockedInactiveGameServerSet, a smaller version of the e2e test from #4802.Which issue(s) this PR fixes:
<!--
*Automatically closes linked issue when PR is merged.
Usage:
Closes #<issue number>, orCloses (paste link of issue).Use "Work on #<issue number>" if you wish to reference the issue without closing it.
-->
Closes #4802
Did you use AI tools in preparing this PR?:
<!--
If you used AI tools in preparing your PR, you must disclose this in the description of your PR.
--->
Y - This PR was written in part with the assistance of generative AI. I reviewed the logic and the test cases.
Special notes for your reviewer:
TestControllerRollingUpdateRestMultipleInactiveGameServerSetsputs an inactive GameServerSet held by Allocated GameServers, Reserved GameServers, or both before one with Ready GameServers, and expects the Ready one to be scaled down. These three cases fail without the change. The test also covers the reverse order, and a GameServerSet above its target that still has Ready GameServers, where the loop must still stop.v1with a target between zero and its Allocated GameServers. The controller skips a target of zero, which does not reproduce the issue. The test therefore waits untilv1only has Allocated GameServers left, and sets the target ofv1to 1 before the update tov3.e2e results of this test on a local kind cluster. The "before" controller is
mainat d380e8d87, and the "after" controller is the same commit with this change.| Controller |
RollingUpdateSurge| Result | Time untilv2is removed after the update tov3||---|---|---|---|
| before | off | 4 of 5 runs fail, 1 passes | over 2 minutes in the failed runs, 52s in the passed run |
| before | on | 4 of 4 runs fail | over 2 minutes |
| after | off | 5 of 5 runs pass | 2s to 4s |
| after | on | 5 of 5 runs pass | 5s to 7s |
v2is scaled down.simple-game-serveris 0.44, because 0.45 is not in the public registry yet.pkg/fleetsunit tests after the rebase, and did not run the e2e test again.