← Back to Pull requests

fix: skip inactive GameServerSets held by Allocated or Reserved GameServers #4814

Closed
unknown closed this pull request without merging on Nov 09, 2026 11:03 UTC
View on GitHub
unknown unknown commented on Nov 03, 2026 02:32 UTC
Author

What type of PR is this?
/kind bug

What this PR does / Why we need it:

During a rolling update, rollingUpdateRest stops at the first inactive GameServerSet whose Spec.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 in rest, 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.Replicas excludes GameServers that are being deleted, so the Ready counts are stale right after a target is lowered, and continuing there could exceed maxUnavailable.

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>, or Closes (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:

  • TestControllerRollingUpdateRestMultipleInactiveGameServerSets puts 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.

  • The e2e test uses a Fleet of 8 GameServers with 4 Allocated. With a Fleet of this size, the scale down steps are small, so the rollout does not reliably leave v1 with 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 until v1 only has Allocated GameServers left, and sets the target of v1 to 1 before the update to v3.

  • The change is not behind a feature gate, because it only affects a GameServerSet that cannot reach its target until its Allocated or Reserved GameServers are shut down.
  • e2e results of this test on a local kind cluster. The "before" controller is main at d380e8d87, and the "after" controller is the same commit with this change.

    | Controller | RollingUpdateSurge | Result | Time until v2 is removed after the update to v3 |
    |---|---|---|---|
    | 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 |

  • The failed runs all fail at the check that v2 is scaled down.

  • Environment: kind v0.33.0 default node image (Kubernetes v1.37.0), arm64. Only the controller and extensions were built from source, other components are 1.62.0. simple-game-server is 0.44, because 0.45 is not in the public registry yet.

  • I ran only this test, one run at a time. I did not run it in parallel with the rest of the e2e suite.

  • After these runs, I rebased this branch on #4824, which changes only integer conversions and lint annotations in the fleet controller. I ran the pkg/fleets unit tests after the rebase, and did not run the e2e test again.
  • Diff: 545 lines (+408 / -137) across 6 files Reviewer: markmandel Review duration: 9151m
    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
    0.48
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 48% (MEDIUM) · Higher = larger blast radius
    48%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.8% · Safe to merge
    20.8%