Skip to content

Remove CountsAndLists feature gate from controllers, allocation, auto… - #4760

Merged
markmandel merged 7 commits into
agones-dev:mainfrom
Sivasankaran25:countsandlists-stable-controllers
Oct 10, 2026
Merged

markmandel merged 7 commits into
agones-dev:mainfrom
Sivasankaran25:countsandlists-stable-controllers

Conversation

@Sivasankaran25

@Sivasankaran25 Sivasankaran25 commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

What type of PR is this?

/kind cleanup

What this PR does / Why we need it:

Part of graduating CountsAndLists to Stable. This follows the API validation PR (#4733) and removes the FeatureCountsAndLists gate checks from the controller and allocation code paths, so Counters, Lists and Priorities are always processed:

  • pkg/allocation/converters: always convert Priorities, Counters and Lists between the allocation API and the CRD types.
  • pkg/gameserverallocations:
    • Always tie-break with Counter/List Priorities in the allocation cache and in find.
    • Always batch requests by SortKey in the allocator.
    • The nil-GSA guard in ListSortedGameServers stays; only the gate check is removed.
  • pkg/fleetautoscalers: remove the "feature flag not enabled" error for CounterPolicy/ListPolicy.
  • pkg/fleets: always sync Priorities to the active GameServerSet and aggregate Counter/List status.
  • pkg/gameserversets: always aggregate Counter/List status, and always use Priorities when sorting for Packed and Distributed.
  • pkg/metrics: always record Fleet Counter and List metrics.

Tests:

  • Removed test cases that only covered the gate-disabled path.
  • Removed ParseFeatures calls and the FeatureTestMutex locks that guarded them where a test no longer changes feature flags.

Which issue(s) this PR fixes:

Works On #4590

Did you use AI tools in preparing this PR?:

Y

Special notes for your reviewer:

  • Out of scope: the FeatureCountsAndLists checks in pkg/sdkserver (sdkserver.go, sdk.go, localsdk.go) are left for the follow-up PR. The gate definition in pkg/util/runtime/features.go stays until those checks are removed too.
  • Behaviour change: these controllers now ignore CountsAndLists=false. They no longer clear Counter/List status on Fleets and GameServerSets, and the autoscaler no longer rejects Counter/List policies when the gate is off.
  • Testing: unit tests pass with go test -race over pkg/..., sdks/go/... and cmd/....

@Sivasankaran25 Sivasankaran25 self-assigned this Sep 29, 2026
@github-actions github-actions Bot added kind/cleanup Refactoring code, fixing up documentation, etc size/L labels Sep 29, 2026
@agones-bot

Copy link
Copy Markdown
Collaborator

Build Succeeded 🥳

Build Id: b32fb3de-0519-4e24-9ddf-ead7d1e26858

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

git fetch https://github.com/googleforgames/agones.git pull/4760/head:pr_4760 && git checkout pr_4760
helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.62.0-dev-ce0018d

@markmandel
markmandel requested a balanced review from Copilot September 29, 2026 22:53
@markmandel

Copy link
Copy Markdown
Member

Looks like a solid breaking out of work in a single PR - nice job.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The runtime changes consistently remove the targeted gate, with only a minor spelling correction outstanding.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

Removes CountsAndLists feature-gate checks from controllers, allocation, autoscaling, sorting, conversion, and metrics paths.

Changes:

  • Makes counter/list aggregation, allocation, sorting, autoscaling, and metrics unconditional.
  • Updates unit tests by removing feature-gate setup and obsolete disabled-state cases.
File Description
pkg/​metrics/​controller.go Always records counter/list metrics.
pkg/​metrics/​controller_test.go Removes metric feature setup.
pkg/​gameserversets/​gameserversets.go Always applies counter/list priorities.
pkg/​gameserversets/​gameserversets_test.go Removes sorting feature setup.
pkg/​gameserversets/​controller.go Always aggregates counter/list status.
pkg/​gameserversets/​controller_test.go Updates aggregation expectations.
pkg/​gameserverallocations/​find.go Always honors allocation priorities.
pkg/​gameserverallocations/​find_test.go Removes disabled-feature setup.
pkg/​gameserverallocations/​allocator.go Always processes counter/list allocation data.
pkg/​gameserverallocations/​allocator_test.go Removes feature-specific setup.
pkg/​gameserverallocations/​allocation_cache.go Always uses priorities for tie-breaking.
pkg/​gameserverallocations/​allocation_cache_test.go Removes sorting feature setup.
pkg/​fleets/​controller.go Always propagates and aggregates counter/list data.
pkg/​fleets/​controller_test.go Removes obsolete gated-status tests.
pkg/​fleetautoscalers/​fleetautoscalers.go Always permits counter/list policies.
pkg/​fleetautoscalers/​fleetautoscalers_test.go Removes gate-dependent policy cases.
pkg/​allocation/​converters/​converter.go Always converts counter/list fields.
pkg/​allocation/​converters/​converter_test.go Removes converter feature setup.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread pkg/gameserverallocations/allocator.go Outdated
if sortKey == uint64(0) {
sortKey = newSortKey
}
// SortKey returns the sorting values (list of Priorities) as a determinstic key.

@igooch igooch left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also fill in the PR description, and note that the pkg/sdkserver gate checks are left for the follow-up PR.

t.Parallel()

// TODO: remove when `CountsAndLists` feature flag is moved to stable.
runtime.FeatureTestMutex.Lock()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This TODO is about removing the runtime.FeatureTestMutex.Lock() for tests that no longer call ParseFeatures. Either add back the todo, or remove the unneeded locks.

"CounterActions increment and ListActions add, delete, and update capacity": {
features: fmt.Sprintf("%s=true", runtime.FeatureCountsAndLists),
gs: &gs1,
gs: &gs1,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the last features value gone, the features related code in this test can be removed too.

features     string
...
runtime.FeatureTestMutex.Lock()
defer runtime.FeatureTestMutex.Unlock()
// we always set the feature flag in all these tests, so always process it.
require.NoError(t, runtime.ParseFeatures(testScenario.features))

@agones-bot

Copy link
Copy Markdown
Collaborator

Build Succeeded 🥳

Build Id: fbd78c86-6a90-4d1d-bf34-e1ec316b7af8

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

git fetch https://github.com/googleforgames/agones.git pull/4760/head:pr_4760 && git checkout pr_4760
helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.62.0-dev-b974eac

@lacroixthomas

Copy link
Copy Markdown
Collaborator

I've seen 2 places where it's still using the CountsAndLists but I guess it will part of another PR with the sdk parts:
Linked with the proto: https://github.com/agones-dev/agones/blob/main/pkg/allocation/go/allocation.pb.go#L330
Swagger https://github.com/agones-dev/agones/blob/main/pkg/allocation/go/allocation.swagger.json#L204

Otherwise LGTM ! Nice one

@Sivasankaran25

Copy link
Copy Markdown
Collaborator Author

I've seen 2 places where it's still using the CountsAndLists but I guess it will part of another PR with the sdk parts: Linked with the proto: https://github.com/agones-dev/agones/blob/main/pkg/allocation/go/allocation.pb.go#L330 Swagger https://github.com/agones-dev/agones/blob/main/pkg/allocation/go/allocation.swagger.json#L204

Otherwise LGTM ! Nice one

Yes, this scenario is part of another PR.

@agones-bot

Copy link
Copy Markdown
Collaborator

Build Succeeded 🥳

Build Id: 43ed7e1f-94d3-46c2-8e12-49897419453f

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

git fetch https://github.com/googleforgames/agones.git pull/4760/head:pr_4760 && git checkout pr_4760
helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.62.0-dev-d49cbb5

@agones-bot

Copy link
Copy Markdown
Collaborator

Build Succeeded 🥳

Build Id: 8fa187ff-8e73-488f-a440-2d1c313665e7

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

git fetch https://github.com/googleforgames/agones.git pull/4760/head:pr_4760 && git checkout pr_4760
helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.62.0-dev-b083abc

@markmandel

Copy link
Copy Markdown
Member

This looks good - sorry for the delay, been sick. Can we fix up the conflicts, and then I'm happy to merge 👍🏻

@agones-bot

Copy link
Copy Markdown
Collaborator

Build Failed 😭

Build Id: 0f3eccd0-1c72-4af2-8aff-3d04f01cd4c2

Status: FAILURE

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@agones-bot

Copy link
Copy Markdown
Collaborator

Build Succeeded 🥳

Build Id: e0e75509-9c7b-4bcf-9539-9c6fa3450776

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

git fetch https://github.com/googleforgames/agones.git pull/4760/head:pr_4760 && git checkout pr_4760
helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.62.0-dev-0d5aac8

@markmandel markmandel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

@markmandel
markmandel merged commit 6591608 into agones-dev:main Oct 10, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/cleanup Refactoring code, fixing up documentation, etc size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants