fix: duplicate GameServerSets not being cleaned up under a Fleet#4469
Open
mnthe wants to merge 1 commit intoagones-dev:mainfrom
Open
fix: duplicate GameServerSets not being cleaned up under a Fleet#4469mnthe wants to merge 1 commit intoagones-dev:mainfrom
mnthe wants to merge 1 commit intoagones-dev:mainfrom
Conversation
When multiple GameServerSets with the same template exist under a single Fleet (caused by informer cache lag during creation), filterGameServerSetByActive() used last-write-wins semantics: only the last matching GameServerSet in the list was kept as active, while earlier matches were silently dropped — placed in neither the active nor the rest slice. This caused two problems: 1. Duplicate GameServerSets were never scaled down or deleted, since they were invisible to applyDeploymentStrategy() and deleteEmptyGameServerSets(). 2. Because the Kubernetes informer store iterates over a Go map with non-deterministic ordering, each syncFleet() call could pick a different GameServerSet as "active", causing all duplicates to eventually have their Spec.Replicas updated to the Fleet's desired count — resulting in N times the expected number of GameServers. Fix: when multiple GameServerSets match the Fleet template, keep the oldest by CreationTimestamp as active and place the rest in the rest slice for normal scale-down and cleanup.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
/kind bug
What this PR does / Why we need it:
Fixes a bug in
filterGameServerSetByActive()where duplicate GameServerSets sharing the same template as the Fleet are silently dropped — placed in neither theactivenor therestslice.When multiple GameServerSets match the Fleet's template, the current code overwrites the
activevariable on each match (last-write-wins). Earlier matches are lost entirely: they don't go intorest, soapplyDeploymentStrategy()anddeleteEmptyGameServerSets()never touch them.This causes two problems:
syncFleet()can pick a different GSS as "active" and update itsSpec.Replicas.Screenshot — 3 duplicate GameServerSets under a single Fleet, all with the same Desired value:
The fix keeps the oldest GameServerSet (by
CreationTimestamp) as active and places any duplicates into therestslice, where the existing deployment strategy logic naturally scales them down and deletes them.Which issue(s) this PR fixes:
Closes #4468
Special notes for your reviewer:
filterGameServerSetByActive()(pkg/fleets/controller.go), which has had last-write-wins behavior since its initial implementation and has never been modified.TestControllerFilterGameServerSetByActiveDuplicatescovering:make test-go).Does this PR introduce a user-facing change?