Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat(gameservers): Shared pod IPs with GameServer Addresses #3764

Conversation

lacroixthomas
Copy link
Contributor

What type of PR is this?
/kind feature

What this PR does / Why we need it:
Append the Pod IPs to the GameServer's addresses

Which issue(s) this PR fixes:

Closes #3763

Special notes for your reviewer:

@github-actions github-actions bot added kind/feature New features for Agones size/S labels Apr 16, 2024
@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 621fc248-ad56-49a9-8692-f8b3b37aa4b7

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

@lacroixthomas lacroixthomas marked this pull request as ready for review April 16, 2024 20:47
@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 5b0f4219-b594-4034-b104-fe5e8cb63c0c

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/3764/head:pr_3764 && git checkout pr_3764
  • 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.40.0-dev-13aaa03-amd64

@markmandel
Copy link
Member

Only thing I'd add is a test here:

assert.NotEmpty(t, readyGs.Status.Addresses)

Which checks if there's PodIp record(s), and that it's not empty (can also lookup the pod if we want and do a comparison?)

@lacroixthomas
Copy link
Contributor Author

Only thing I'd add is a test here:

assert.NotEmpty(t, readyGs.Status.Addresses)

Which checks if there's PodIp record(s), and that it's not empty (can also lookup the pod if we want and do a comparison?)

Hello @markmandel
I've added some check for the PodIPs on the addresses,
I'm not that familiar with the e2e of agones yet (about the framework / helpers etc), I'm gonna check this part to be able to do the lookup of the pod for the comparaison

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 6b3ce305-def9-4b74-8eec-1c31eb153201

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

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: c2142862-2753-4c9d-a6cd-bbb5f716e4d5

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

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: c9d2184e-d5d7-4dfd-b953-27c7da634878

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

@daniellee
Copy link
Contributor

daniellee commented Apr 18, 2024

Before I saw this PR, I had started working on it as well :-) Thanks for jumping on this so quickly - looking forward to seeing it merged soon.

Testing this PR locally, it doesn't seem to populate the gameserver.Status.Addresses field.

I hacked this guard into the syncGameServerStartingState function in pkg/gameservers/controller.go to force it to wait until the pod.Status.PodIPs field has been populated:

if pod.Status.PodIPs == nil || len(pod.Status.PodIPs) == 0 {
	return gs, workerqueue.NewDebugError(errors.Errorf("pod IP not yet populated for Pod %s", pod.ObjectMeta.Name))
}

That's probably not the ideal way to solve it but it identifies the problem. The gameserver's scheduled and ready states are set before the pod.Status.PodIPs field is populated and therefore the gameserver.Status.Addresses field never gets the PodIPs.

@lacroixthomas
Copy link
Contributor Author

Before I saw this PR, I had started working on it as well :-) Thanks for jumping on this so quickly - looking forward to seeing it merged soon.

Testing this PR locally, it doesn't seem to populate the gameserver.Status.Addresses field.

I hacked this guard into the syncGameServerStartingState function in pkg/gameservers/controller.goin to force it to wait until the pod.Status.PodIPs field has been populated:

if pod.Status.PodIPs == nil || len(pod.Status.PodIPs) == 0 {
	return gs, workerqueue.NewDebugError(errors.Errorf("pod IP not yet populated for Pod %s", pod.ObjectMeta.Name))
}

That's probably not the ideal way to solve it but it identifies the problem. The gameserver's scheduled and ready states are set before the pod.Status.PodIPs field is populated and therefore the gameserver.Status.Addresses field never gets the PodIPs.

Hello, I didn't have time yesterday to investigate what happens, but nice catch, thanks for looking into it ! I'll update my MR with your fix :)

@lacroixthomas
Copy link
Contributor Author

I will add unit tests for the controller fix *

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: e7c5118a-6eee-4a66-8c33-33f9fe5c29b0

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

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: e3836b05-5e77-41c3-b3da-9ac3efa71b79

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/3764/head:pr_3764 && git checkout pr_3764
  • 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.40.0-dev-52b70ae-amd64

Copy link
Collaborator

@zmerlynn zmerlynn left a comment

Choose a reason for hiding this comment

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

Thank you so much for the submission! This LGTM with a minor nit.

pkg/gameservers/gameservers.go Outdated Show resolved Hide resolved
test/e2e/gameserver_test.go Outdated Show resolved Hide resolved
@lacroixthomas
Copy link
Contributor Author

Thank you so much for the submission! This LGTM with a minor nit.

Thanks for the review ! I've updated the MR following your comments

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: b21bb160-cd2d-4370-ba84-9359d4a23da4

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/3764/head:pr_3764 && git checkout pr_3764
  • 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.40.0-dev-c674c20-amd64

representing all known ways to reach the `GameServer` over the network.

To choose `address` from `addresses`, [Agones looks for the following address types][addressFunc], in highest to lowest priorty:
* `ExternalDNS`
* `ExternalIP`
* `InternalDNS`
* `InternalIP`
* `PodIP`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since you didn't modify the address function in pkg/gameservers/gameservers.go, I don't think this line is true. However, to avoid a roundtrip across timezones and over a weekend, I may just go ahead and edit this, since the rest LGTM.

Copy link
Collaborator

Choose a reason for hiding this comment

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

(fixed in a671f1b)

Copy link
Collaborator

@zmerlynn zmerlynn left a comment

Choose a reason for hiding this comment

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

LGTM, cc @markmandel

@zmerlynn zmerlynn enabled auto-merge (squash) April 19, 2024 17:15
Copy link
Member

@markmandel markmandel left a comment

Choose a reason for hiding this comment

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

Looks great!

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 53bba61f-c80f-404b-9a02-b4a4ba1c7067

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/3764/head:pr_3764 && git checkout pr_3764
  • 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.40.0-dev-b2cd697-amd64

@zmerlynn zmerlynn merged commit 86f535d into googleforgames:main Apr 19, 2024
4 checks passed
spiceratops referenced this pull request in spiceratops/k8s-gitops May 13, 2024
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [agones](https://agones.dev)
([source](https://github.com/googleforgames/agones)) | minor |
`1.39.0` -> `1.40.0` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>googleforgames/agones (agones)</summary>

###
[`v1.40.0`](https://github.com/googleforgames/agones/blob/HEAD/CHANGELOG.md#v1400-2024-04-23)

[Compare
Source](https://github.com/googleforgames/agones/compare/v1.39.0...v1.40.0)

[Full
Changelog](https://github.com/googleforgames/agones/compare/v1.39.0...v1.40.0)

**Breaking changes:**

- Counters and Lists: Remove Bool Returns by
[@&#8203;Kalaiselvi84](https://github.com/Kalaiselvi84) in
[https://github.com/googleforgames/agones/pull/3738](https://github.com/googleforgames/agones/pull/3738)

**Implemented enhancements:**

- Leader Election in Custom Controller by
[@&#8203;Kalaiselvi84](https://github.com/Kalaiselvi84) in
[https://github.com/googleforgames/agones/pull/3696](https://github.com/googleforgames/agones/pull/3696)
- Migrating from generate-groups.sh to kube_codegen.sh by
[@&#8203;Kalaiselvi84](https://github.com/Kalaiselvi84) in
[https://github.com/googleforgames/agones/pull/3722](https://github.com/googleforgames/agones/pull/3722)
- Move GKEAutopilotExtendedDurationPods to Alpha in 1.28+ by
[@&#8203;zmerlynn](https://github.com/zmerlynn) in
[https://github.com/googleforgames/agones/pull/3729](https://github.com/googleforgames/agones/pull/3729)
- Move DisableResyncOnSDKServer to Beta by
[@&#8203;Kalaiselvi84](https://github.com/Kalaiselvi84) in
[https://github.com/googleforgames/agones/pull/3732](https://github.com/googleforgames/agones/pull/3732)
- Counters & Lists landing page and doc improvements by
[@&#8203;markmandel](https://github.com/markmandel) in
[https://github.com/googleforgames/agones/pull/3649](https://github.com/googleforgames/agones/pull/3649)
- Graduate FleetAllocationOverflow to Stable by
[@&#8203;Kalaiselvi84](https://github.com/Kalaiselvi84) in
[https://github.com/googleforgames/agones/pull/3733](https://github.com/googleforgames/agones/pull/3733)
- Adds Counters and Lists to CSharp SDK by
[@&#8203;igooch](https://github.com/igooch) in
[https://github.com/googleforgames/agones/pull/3581](https://github.com/googleforgames/agones/pull/3581)
- Feat/counter and list defaulting order to ascending by
[@&#8203;lacroixthomas](https://github.com/lacroixthomas) in
[https://github.com/googleforgames/agones/pull/3734](https://github.com/googleforgames/agones/pull/3734)
- Add handling for StatusAddresses in GameServerStatus for the Unity SDK
by [@&#8203;charlesvien](https://github.com/charlesvien) in
[https://github.com/googleforgames/agones/pull/3739](https://github.com/googleforgames/agones/pull/3739)
- Feat(gameservers): Shared pod IPs with GameServer Addresses by
[@&#8203;lacroixthomas](https://github.com/lacroixthomas) in
[https://github.com/googleforgames/agones/pull/3764](https://github.com/googleforgames/agones/pull/3764)
- Be prescriptive about rotating regions when updating Kubernetes
versions by [@&#8203;zmerlynn](https://github.com/zmerlynn) in
[https://github.com/googleforgames/agones/pull/3716](https://github.com/googleforgames/agones/pull/3716)
- Fix ensure-e2e-infra-state-bucket by
[@&#8203;zmerlynn](https://github.com/zmerlynn) in
[https://github.com/googleforgames/agones/pull/3719](https://github.com/googleforgames/agones/pull/3719)
- Create Performance Cluster 1.28 by
[@&#8203;Kalaiselvi84](https://github.com/Kalaiselvi84) in
[https://github.com/googleforgames/agones/pull/3720](https://github.com/googleforgames/agones/pull/3720)
- Optimise GameServer Sub-Controller Queues by
[@&#8203;markmandel](https://github.com/markmandel) in
[https://github.com/googleforgames/agones/pull/3781](https://github.com/googleforgames/agones/pull/3781)

**Fixed bugs:**

- Counters & Lists: Consolidate `priorities` sorting by
[@&#8203;markmandel](https://github.com/markmandel) in
[https://github.com/googleforgames/agones/pull/3690](https://github.com/googleforgames/agones/pull/3690)
- Fix(Counter & Lists): Add validation for `priorities` by
[@&#8203;lacroixthomas](https://github.com/lacroixthomas) in
[https://github.com/googleforgames/agones/pull/3714](https://github.com/googleforgames/agones/pull/3714)
- fix:
[#&#8203;3607](https://github.com/googleforgames/agones/issues/3607)
Metrics data loss in K8S controller by
[@&#8203;alvin-7](https://github.com/alvin-7) in
[https://github.com/googleforgames/agones/pull/3692](https://github.com/googleforgames/agones/pull/3692)
- Deflake GameServerAllocationDuringMultipleAllocationClients by
allowing errors by
[@&#8203;Kalaiselvi84](https://github.com/Kalaiselvi84) in
[https://github.com/googleforgames/agones/pull/3750](https://github.com/googleforgames/agones/pull/3750)

**Security fixes:**

- Bump protobufjs from 7.2.4 to 7.2.6 in /sdks/nodejs by
[@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/googleforgames/agones/pull/3755](https://github.com/googleforgames/agones/pull/3755)
- Bump golang.org/x/net from 0.19.0 to 0.23.0 by
[@&#8203;zmerlynn](https://github.com/zmerlynn) in
[https://github.com/googleforgames/agones/pull/3793](https://github.com/googleforgames/agones/pull/3793)

**Other:**

- Flaky: TestGameServerCreationAfterDeletingOneExtensionsPod by
[@&#8203;markmandel](https://github.com/markmandel) in
[https://github.com/googleforgames/agones/pull/3699](https://github.com/googleforgames/agones/pull/3699)
- Prep for release v1.40.0 by
[@&#8203;Kalaiselvi84](https://github.com/Kalaiselvi84) in
[https://github.com/googleforgames/agones/pull/3700](https://github.com/googleforgames/agones/pull/3700)
- Bumps cpp-simple Image and Refactoring Example Makefiles by
[@&#8203;Kalaiselvi84](https://github.com/Kalaiselvi84) in
[https://github.com/googleforgames/agones/pull/3695](https://github.com/googleforgames/agones/pull/3695)
- Upgrade Protobuf to 1.33.0 by
[@&#8203;Kalaiselvi84](https://github.com/Kalaiselvi84) in
[https://github.com/googleforgames/agones/pull/3711](https://github.com/googleforgames/agones/pull/3711)
- Modify Script for Makefile Version Updates in Examples Directory by
[@&#8203;Kalaiselvi84](https://github.com/Kalaiselvi84) in
[https://github.com/googleforgames/agones/pull/3712](https://github.com/googleforgames/agones/pull/3712)
- Adds simple genai server example documentation to the Agones site by
[@&#8203;igooch](https://github.com/igooch) in
[https://github.com/googleforgames/agones/pull/3713](https://github.com/googleforgames/agones/pull/3713)
- Update Supported Kubernetes to 1.27, 1.28, 1.29 by
[@&#8203;Kalaiselvi84](https://github.com/Kalaiselvi84) in
[https://github.com/googleforgames/agones/pull/3654](https://github.com/googleforgames/agones/pull/3654)
- fix: typo in docs by [@&#8203;qhyun2](https://github.com/qhyun2) in
[https://github.com/googleforgames/agones/pull/3723](https://github.com/googleforgames/agones/pull/3723)
- Tweak: Setting up the Game Server by
[@&#8203;Kalaiselvi84](https://github.com/Kalaiselvi84) in
[https://github.com/googleforgames/agones/pull/3717](https://github.com/googleforgames/agones/pull/3717)
- Docs: gke.md - spelling by
[@&#8203;daniellee](https://github.com/daniellee) in
[https://github.com/googleforgames/agones/pull/3740](https://github.com/googleforgames/agones/pull/3740)
- Aesthetic rearrangement of cloudbuild.yaml by
[@&#8203;zmerlynn](https://github.com/zmerlynn) in
[https://github.com/googleforgames/agones/pull/3741](https://github.com/googleforgames/agones/pull/3741)
- Docs: Make hitting <enter> on connection explicit by
[@&#8203;markmandel](https://github.com/markmandel) in
[https://github.com/googleforgames/agones/pull/3743](https://github.com/googleforgames/agones/pull/3743)
- CI: Don't check Unreal Link by
[@&#8203;markmandel](https://github.com/markmandel) in
[https://github.com/googleforgames/agones/pull/3745](https://github.com/googleforgames/agones/pull/3745)
- New recommendation for multi-cluster allocation by
[@&#8203;markmandel](https://github.com/markmandel) in
[https://github.com/googleforgames/agones/pull/3744](https://github.com/googleforgames/agones/pull/3744)
- Custom Controller Example Page on Agones Website by
[@&#8203;Kalaiselvi84](https://github.com/Kalaiselvi84) in
[https://github.com/googleforgames/agones/pull/3725](https://github.com/googleforgames/agones/pull/3725)
- Add Nitrado logo by [@&#8203;towolf](https://github.com/towolf) in
[https://github.com/googleforgames/agones/pull/3753](https://github.com/googleforgames/agones/pull/3753)
- Remove unnecessary args from e2e-test-cloudbuild by
[@&#8203;zmerlynn](https://github.com/zmerlynn) in
[https://github.com/googleforgames/agones/pull/3754](https://github.com/googleforgames/agones/pull/3754)
- Update Allocation from Fleet Documentation by
[@&#8203;Kalaiselvi84](https://github.com/Kalaiselvi84) in
[https://github.com/googleforgames/agones/pull/3761](https://github.com/googleforgames/agones/pull/3761)
- Transform Lint Warnings into Errors by
[@&#8203;Kalaiselvi84](https://github.com/Kalaiselvi84) in
[https://github.com/googleforgames/agones/pull/3756](https://github.com/googleforgames/agones/pull/3756)
- Update Canary Testing Documentation by
[@&#8203;Kalaiselvi84](https://github.com/Kalaiselvi84) in
[https://github.com/googleforgames/agones/pull/3760](https://github.com/googleforgames/agones/pull/3760)
- Supertuxkart Example on Agones Site by
[@&#8203;Kalaiselvi84](https://github.com/Kalaiselvi84) in
[https://github.com/googleforgames/agones/pull/3728](https://github.com/googleforgames/agones/pull/3728)
- Xonotic Example on Agones Site by
[@&#8203;Kalaiselvi84](https://github.com/Kalaiselvi84) in
[https://github.com/googleforgames/agones/pull/3742](https://github.com/googleforgames/agones/pull/3742)
- nit documentation fix in kind cluster section when building Agones by
[@&#8203;vicentefb](https://github.com/vicentefb) in
[https://github.com/googleforgames/agones/pull/3770](https://github.com/googleforgames/agones/pull/3770)
- Merged steps inside documentation about webhook certificate creation
by [@&#8203;vicentefb](https://github.com/vicentefb) in
[https://github.com/googleforgames/agones/pull/3768](https://github.com/googleforgames/agones/pull/3768)
- Example Images: Increment Tags by
[@&#8203;Kalaiselvi84](https://github.com/Kalaiselvi84) in
[https://github.com/googleforgames/agones/pull/3796](https://github.com/googleforgames/agones/pull/3796)
- Update simple game server example documentation by
[@&#8203;vicentefb](https://github.com/vicentefb) in
[https://github.com/googleforgames/agones/pull/3776](https://github.com/googleforgames/agones/pull/3776)

**New Contributors:**

- [@&#8203;lacroixthomas](https://github.com/lacroixthomas) made their
first contribution in
[https://github.com/googleforgames/agones/pull/3714](https://github.com/googleforgames/agones/pull/3714)
- [@&#8203;daniellee](https://github.com/daniellee) made their first
contribution in
[https://github.com/googleforgames/agones/pull/3740](https://github.com/googleforgames/agones/pull/3740)
- [@&#8203;charlesvien](https://github.com/charlesvien) made their
first contribution in
[https://github.com/googleforgames/agones/pull/3739](https://github.com/googleforgames/agones/pull/3739)
- [@&#8203;vicentefb](https://github.com/vicentefb) made their first
contribution in
[https://github.com/googleforgames/agones/pull/3770](https://github.com/googleforgames/agones/pull/3770)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://github.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zNTYuMSIsInVwZGF0ZWRJblZlciI6IjM3LjM1Ni4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9oZWxtIiwidHlwZS9taW5vciJdfQ==-->
@lacroixthomas lacroixthomas deleted the features/shared-podips-with-gs-addresses branch May 14, 2024 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New features for Agones size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Shared Pod IPs with GameServer Addresses
5 participants