Skip to content

Add selectable fields to gameserver crd#4542

Open
swermin wants to merge 3 commits intoagones-dev:mainfrom
swermin:feat/add-selectable-fields
Open

Add selectable fields to gameserver crd#4542
swermin wants to merge 3 commits intoagones-dev:mainfrom
swermin:feat/add-selectable-fields

Conversation

@swermin
Copy link
Copy Markdown
Contributor

@swermin swermin commented Apr 29, 2026

What type of PR is this?

Uncomment only one /kind <> line, press enter to put that in a new line, and remove leading whitespace from that line:

/kind breaking
/kind bug
/kind cleanup
/kind documentation

/kind feature

/kind hotfix
/kind release

What this PR does / Why we need it:
We have observers to make sure that our servers are being in the right state. Since we are running with multi servers it is hard to find specific servers with fields like status and nodeName. So, to facilitate the filtering we wanted to add those fields as selectable.

Special notes for your reviewer:
This is a nice to have feature, to be able to filter based on fields like state and node name.

@github-actions github-actions Bot added kind/feature New features for Agones size/XS labels Apr 29, 2026
@swermin swermin force-pushed the feat/add-selectable-fields branch from 0ac0047 to 19769ae Compare April 29, 2026 14:51
@lacroixthomas
Copy link
Copy Markdown
Collaborator

Hello !
You might need to run make gen-install, this will update the ./install/yaml/install.yaml

@swermin
Copy link
Copy Markdown
Contributor Author

swermin commented Apr 29, 2026

Ah, good point! Let me do that

@swermin swermin force-pushed the feat/add-selectable-fields branch from 19769ae to e3d0054 Compare April 29, 2026 22:11
@lacroixthomas
Copy link
Copy Markdown
Collaborator

/gcbrun

@markmandel
Copy link
Copy Markdown
Member

Is there any limit on the number of selectable fields we can apply?

@swermin
Copy link
Copy Markdown
Contributor Author

swermin commented Apr 29, 2026

Is there any limit on the number of selectable fields we can apply?

I don’t think so. What do you have in mind?

@lacroixthomas
Copy link
Copy Markdown
Collaborator

lacroixthomas commented Apr 29, 2026

Seems that there is indeed a limitation of 8 selectable fields per CRD: https://pkg.go.dev/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1#CustomResourceDefinitionVersion

// selectableFields specifies paths to fields that may be used as field selectors.
	// A maximum of 8 selectable fields are allowed.
	// See https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors
	//
	// +featureGate=CustomResourceFieldSelectors
	// +optional
	// +listType=atomic
	SelectableFields [][SelectableField](https://pkg.go.dev/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1#SelectableField) `json:"selectableFields,omitempty" protobuf:"bytes,9,rep,name=selectableFields"`

Might not be an issue, but we can keep an eye on it, I guess these selectable fields makes sense ?

@markmandel
Copy link
Copy Markdown
Member

I thought I read that there was a limit!

@lacroixthomas
Copy link
Copy Markdown
Collaborator

I thought I read that there was a limit!

And you were right 😄

@markmandel
Copy link
Copy Markdown
Member

I don't have any issues with these fields - but we should be careful with what we pick.

@agones-bot
Copy link
Copy Markdown
Collaborator

Build Succeeded 🥳

Build Id: 29903f9c-f2fe-4012-9b70-99c9de2f1bc6

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/4542/head:pr_4542 && git checkout pr_4542
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.58.0-dev-e3d0054

@swermin
Copy link
Copy Markdown
Contributor Author

swermin commented Apr 30, 2026

Seems that there is indeed a limitation of 8 selectable fields per CRD:

I cannot seem to read the manual 🤣

@swermin
Copy link
Copy Markdown
Contributor Author

swermin commented Apr 30, 2026

I don't have any issues with these fields - but we should be careful with what we pick.

I get that. These fields would help us make our maintenance cycle simpler, but that doesn’t mean that it is a right choice to put in here.
I defer to your judgement here if you want to merge it or not.

Our gameservers (for now) do not support signals. So we have safe-to-evict: false set.
Currently when maintenance is needed on a node then we need to use a combination ofawk + sed to figure out which Ready gameservers to delete and let the Allocated one’s drain normally.

These selectors would make is so that we can run a more simple command, like:

Kubectl delete gs —field-selector status.state=Ready,status.nodeName=a-node-name

@swermin swermin force-pushed the feat/add-selectable-fields branch 2 times, most recently from 59eee73 to 18f72c6 Compare April 30, 2026 21:48
@markmandel
Copy link
Copy Markdown
Member

I have a fun idea - why not make selected fields helm configurable, and we can default to the two you have selected already.

We don't use them internally, and that way, anyone can change them should they need to.

WDYT?

@swermin
Copy link
Copy Markdown
Contributor Author

swermin commented May 4, 2026

I was actually wondering if that was possible. Because it would make sense to give the option for others to set the ones they need (if needed that is)

@swermin swermin force-pushed the feat/add-selectable-fields branch from 18f72c6 to 8c3c002 Compare May 4, 2026 20:45
@swermin
Copy link
Copy Markdown
Contributor Author

swermin commented May 4, 2026

I’ll do some tinkering!

@github-actions github-actions Bot added the size/M label May 5, 2026
@swermin
Copy link
Copy Markdown
Contributor Author

swermin commented May 5, 2026

I am also fine to keep the selectable fields empty if that is preferred!

@swermin swermin force-pushed the feat/add-selectable-fields branch 2 times, most recently from 50fa821 to 0a3e5d1 Compare May 5, 2026 20:23
@github-actions github-actions Bot added the size/S label May 5, 2026
@swermin swermin force-pushed the feat/add-selectable-fields branch from 0a3e5d1 to 41a1655 Compare May 5, 2026 20:32
swermin added 2 commits May 7, 2026 14:07
Signed-off-by: Ermin Hrkalovic <ermin.hrkalovic@guerrilla-games.com>
Signed-off-by: Ermin Hrkalovic <ermin.hrkalovic@guerrilla-games.com>
Signed-off-by: Ermin Hrkalovic <ermin.hrkalovic@guerrilla-games.com>

Co-authored-by: Copilot <copilot@github.com>
@swermin swermin force-pushed the feat/add-selectable-fields branch from 41a1655 to f1d2062 Compare May 7, 2026 12:07
@markmandel
Copy link
Copy Markdown
Member

/gcbrun

Love it.

Thinking about docs.

We'll definitely need docs here: https://agones.dev/site/docs/installation/install-agones/helm/#gameservers

But wondering where to put that fields are selectable in the docs -- maybe in here? https://agones.dev/site/docs/reference/gameserver/ ?

@agones-bot
Copy link
Copy Markdown
Collaborator

Build Succeeded 🥳

Build Id: ce0a1c5f-8861-4e04-a822-c7b9442e823c

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/4542/head:pr_4542 && git checkout pr_4542
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.58.0-dev-f1d2062

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants