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

Configure Allocator Status Code #3782

Merged
merged 13 commits into from
Apr 23, 2024
Merged

Conversation

Kalaiselvi84
Copy link
Contributor

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:

Which issue(s) this PR fixes:

Closes #3780

Special notes for your reviewer:

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 6520f72f-8a86-4423-8f30-2041eb55cd95

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

@zmerlynn
Copy link
Collaborator

zmerlynn commented Apr 19, 2024

Can we come up with an approach that doesn't involve flag interpretation in a base library? Flags should be plumbed down from the cmd/ layer.

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: da2f1075-c206-45c6-a938-67857a24e742

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

… on httpUnallocatedStatusCode and added test in converter_test.go
@Kalaiselvi84
Copy link
Contributor Author

Can we come up with an approach that doesn't involve flag interpretation in a base library? Flags should be plumbed down from the cmd/ layer.

I have moved the flag to cmd/main.go and updated the convertStateV1ToError in converter.go to use error code based on httpUnallocatedStatusCode and added a test in converter_test.go. Please review them and share your feedback..

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: e1ed79a1-811e-42cb-9699-8fb7464f31ca

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

@zmerlynn
Copy link
Collaborator

Can we come up with an approach that doesn't involve flag interpretation in a base library? Flags should be plumbed down from the cmd/ layer.

I have moved the flag to cmd/main.go and updated the convertStateV1ToError in converter.go to use error code based on httpUnallocatedStatusCode and added a test in converter_test.go. Please review them and share your feedback..

It doesn't look like the flag was moved to cmd/main.go - rather, it looks like the flag was added there, and you added it to the config, but didn't do anything with that config? Your goal is to get to a place where there is no viper import in pkg/allocation at all - if you look, there's only a couple of places we do that, and in both cases we only import viper to provide a function that can be used in cmd/main.go for the respective binary.

I wish I could find a good citation for this, but the general idea here is that flags in libraries make testing a pain because they're "spooky action at a distance". Flags should go into config structures that get plumbed down.

But, that said, is there a reason not to do this directly here?

response, err := converters.ConvertGSAToAllocationResponse(allocatedGsa)

You can just look for ResourceExhausted and translate it to Unavailable right here instead.

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: dfcf3ca6-32aa-468d-8b76-c0c8fcb6bb40

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

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 2cab87d3-f833-49f2-acc8-74f1695703be

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

@Kalaiselvi84
Copy link
Contributor Author

Flags should go into config structures that get plumbed down.

But, that said, is there a reason not to do this directly here?

response, err := converters.ConvertGSAToAllocationResponse(allocatedGsa)

Along with adding a new flag in the config structures, I've also integrated it into the newServiceHandler() function and within the Allocate() method of the serviceHandler, this statusCode is utilized when calling ConvertGSAToAllocationResponse() method and modified the converter.go file to capture this change. Please let me know if I am in the right direction and share your feedback..

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 397afe29-88a6-48e6-a9f9-70dca07d5e84

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

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.

This is actually looking pretty solid, just a nit

pkg/allocation/converters/converter_test.go Outdated Show resolved Hide resolved
@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 4721c5c9-8448-415f-a4f1-2d0762a683a0

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

cmd/allocator/main.go Show resolved Hide resolved
pkg/allocation/converters/converter.go Outdated Show resolved Hide resolved
@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 00de5ace-072e-4299-9b35-b506a7c5c63b

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

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 22f82971-322e-485a-bb14-be9f0bd076d1

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

pkg/allocation/converters/converter.go Outdated Show resolved Hide resolved
pkg/allocation/converters/converter_test.go Outdated Show resolved Hide resolved
pkg/allocation/converters/converter_test.go Outdated Show resolved Hide resolved
pkg/allocation/converters/converter_test.go Show resolved Hide resolved
cmd/allocator/main.go Show resolved Hide resolved
@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: e5f49c79-e4b4-41b0-bfb4-4056425957e1

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

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.

Very close!

cmd/allocator/main.go Outdated Show resolved Hide resolved
cmd/allocator/main.go Outdated Show resolved Hide resolved
pkg/allocation/converters/converter_test.go Outdated Show resolved Hide resolved
pkg/allocation/converters/converter_test.go Outdated Show resolved Hide resolved
pkg/allocation/converters/converter_test.go Outdated Show resolved Hide resolved
pkg/allocation/converters/converter_test.go Outdated Show resolved Hide resolved
pkg/allocation/converters/converter_test.go Outdated Show resolved Hide resolved
…llocationResponse and remove test TestConvertStateV1ToError
@Kalaiselvi84 Kalaiselvi84 marked this pull request as ready for review April 23, 2024 22:56
@zmerlynn zmerlynn enabled auto-merge (squash) April 23, 2024 23:00
@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 2bb930ab-f69b-4b59-a828-1f24ae348345

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/3782/head:pr_3782 && git checkout pr_3782
  • 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.41.0-dev-e6716e9-amd64

@zmerlynn zmerlynn merged commit 3ae6e18 into googleforgames:main Apr 23, 2024
3 of 4 checks passed
@Kalaiselvi84 Kalaiselvi84 added kind/feature New features for Agones and removed kind/other labels Jun 4, 2024
spiceratops referenced this pull request in spiceratops/k8s-gitops Jun 8, 2024
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [agones](https://agones.dev)
([source](https://github.com/googleforgames/agones)) | minor |
`1.40.0` -> `1.41.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.41.0`](https://github.com/googleforgames/agones/blob/HEAD/CHANGELOG.md#v1410-2024-06-04)

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

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

**Implemented enhancements:**

- Configure Allocator Status Code by
[@&#8203;Kalaiselvi84](https://github.com/Kalaiselvi84) in
[https://github.com/googleforgames/agones/pull/3782](https://github.com/googleforgames/agones/pull/3782)
- Graduate Counters and Lists to Beta by
[@&#8203;Kalaiselvi84](https://github.com/Kalaiselvi84) in
[https://github.com/googleforgames/agones/pull/3801](https://github.com/googleforgames/agones/pull/3801)
- Passthrough autopilot - Adds an AutopilotPassthroughPort Feature Gate
and new pod label by [@&#8203;vicentefb](https://github.com/vicentefb)
in
[https://github.com/googleforgames/agones/pull/3809](https://github.com/googleforgames/agones/pull/3809)
- CountsAndLists: Move to Beta Protobuf by
[@&#8203;Kalaiselvi84](https://github.com/Kalaiselvi84) in
[https://github.com/googleforgames/agones/pull/3806](https://github.com/googleforgames/agones/pull/3806)
- feat: support multiple port ranges by
[@&#8203;nrwiersma](https://github.com/nrwiersma) in
[https://github.com/googleforgames/agones/pull/3747](https://github.com/googleforgames/agones/pull/3747)
- Changes `sdk-server` to Patch instead of Update by
[@&#8203;igooch](https://github.com/igooch) in
[https://github.com/googleforgames/agones/pull/3803](https://github.com/googleforgames/agones/pull/3803)
- Generate grpc for nodejs from alpha to beta by
[@&#8203;lacroixthomas](https://github.com/lacroixthomas) in
[https://github.com/googleforgames/agones/pull/3825](https://github.com/googleforgames/agones/pull/3825)
- Update CountsAndLists from Alpha to Beta by
[@&#8203;Kalaiselvi84](https://github.com/Kalaiselvi84) in
[https://github.com/googleforgames/agones/pull/3824](https://github.com/googleforgames/agones/pull/3824)
- feat(gameserver): New DirectToGameServer PortPolicy allows direct
traffic to a GameServer by
[@&#8203;daniellee](https://github.com/daniellee) in
[https://github.com/googleforgames/agones/pull/3807](https://github.com/googleforgames/agones/pull/3807)
- Passthrough autopilot - Adds mutating webhook by
[@&#8203;vicentefb](https://github.com/vicentefb) in
[https://github.com/googleforgames/agones/pull/3833](https://github.com/googleforgames/agones/pull/3833)
- Passthrough autopilot - added ports array case and updated unit tests
by [@&#8203;vicentefb](https://github.com/vicentefb) in
[https://github.com/googleforgames/agones/pull/3842](https://github.com/googleforgames/agones/pull/3842)
- Nodejs counters and lists by
[@&#8203;steven-supersolid](https://github.com/steven-supersolid) in
[https://github.com/googleforgames/agones/pull/3726](https://github.com/googleforgames/agones/pull/3726)
- Promote AutopilotPassthroughPort feature gate to Alpha by
[@&#8203;vicentefb](https://github.com/vicentefb) in
[https://github.com/googleforgames/agones/pull/3849](https://github.com/googleforgames/agones/pull/3849)

**Fixed bugs:**

- Helm Param Update: Default to agones.controller if agones.extensions
is Missing by [@&#8203;Kalaiselvi84](https://github.com/Kalaiselvi84)
in
[https://github.com/googleforgames/agones/pull/3773](https://github.com/googleforgames/agones/pull/3773)
- fix: rollout strategy issues by
[@&#8203;nrwiersma](https://github.com/nrwiersma) in
[https://github.com/googleforgames/agones/pull/3762](https://github.com/googleforgames/agones/pull/3762)
- Set Minimum Buffer Size to 1 by
[@&#8203;Kalaiselvi84](https://github.com/Kalaiselvi84) in
[https://github.com/googleforgames/agones/pull/3749](https://github.com/googleforgames/agones/pull/3749)
- Pin ltsc2019 to older SHA by
[@&#8203;zmerlynn](https://github.com/zmerlynn) in
[https://github.com/googleforgames/agones/pull/3829](https://github.com/googleforgames/agones/pull/3829)
- TestGameServerAllocationDuringMultipleAllocationClients: Readdress
flake by [@&#8203;zmerlynn](https://github.com/zmerlynn) in
[https://github.com/googleforgames/agones/pull/3831](https://github.com/googleforgames/agones/pull/3831)
- Refactor finalizer name to include valid domain name and path by
[@&#8203;indexjoseph](https://github.com/indexjoseph) in
[https://github.com/googleforgames/agones/pull/3840](https://github.com/googleforgames/agones/pull/3840)
- agones-{extensions,allocator}: Be more defensive about draining by
[@&#8203;zmerlynn](https://github.com/zmerlynn) in
[https://github.com/googleforgames/agones/pull/3839](https://github.com/googleforgames/agones/pull/3839)
- agones-{extensions,allocator}: Pause after cancelling context by
[@&#8203;zmerlynn](https://github.com/zmerlynn) in
[https://github.com/googleforgames/agones/pull/3843](https://github.com/googleforgames/agones/pull/3843)
- Change the line to modify in Quickstart: Edit a Game Server by
[@&#8203;peterzhongyi](https://github.com/peterzhongyi) in
[https://github.com/googleforgames/agones/pull/3844](https://github.com/googleforgames/agones/pull/3844)

**Other:**

- Prep for Release v1.41.0 by
[@&#8203;Kalaiselvi84](https://github.com/Kalaiselvi84) in
[https://github.com/googleforgames/agones/pull/3800](https://github.com/googleforgames/agones/pull/3800)
- Update site documentation to reflect firewall prefix and default to
Autopilot cluster creation for Agones by
[@&#8203;vicentefb](https://github.com/vicentefb) in
[https://github.com/googleforgames/agones/pull/3769](https://github.com/googleforgames/agones/pull/3769)
- Add a System Diagram and overview page by
[@&#8203;zmerlynn](https://github.com/zmerlynn) in
[https://github.com/googleforgames/agones/pull/3792](https://github.com/googleforgames/agones/pull/3792)
- Update Side Menu: Preserve and Restore Scroll Position by
[@&#8203;Kalaiselvi84](https://github.com/Kalaiselvi84) in
[https://github.com/googleforgames/agones/pull/3805](https://github.com/googleforgames/agones/pull/3805)
- fix: typo by [@&#8203;skmpf](https://github.com/skmpf) in
[https://github.com/googleforgames/agones/pull/3808](https://github.com/googleforgames/agones/pull/3808)
- Helm Config: Add httpUnallocatedStatusCode in Allocator Service by
[@&#8203;Kalaiselvi84](https://github.com/Kalaiselvi84) in
[https://github.com/googleforgames/agones/pull/3802](https://github.com/googleforgames/agones/pull/3802)
- Update Docs: CountersAndLists to Beta by
[@&#8203;Kalaiselvi84](https://github.com/Kalaiselvi84) in
[https://github.com/googleforgames/agones/pull/3810](https://github.com/googleforgames/agones/pull/3810)
- Disable Dev feature FeatureAutopilotPassthroughPort by
[@&#8203;vicentefb](https://github.com/vicentefb) in
[https://github.com/googleforgames/agones/pull/3815](https://github.com/googleforgames/agones/pull/3815)
- Disable FeatureAutopilotPassthroughPort in features.go by
[@&#8203;vicentefb](https://github.com/vicentefb) in
[https://github.com/googleforgames/agones/pull/3816](https://github.com/googleforgames/agones/pull/3816)
- SDK proto compatibility guarantees and deprecation policies
documentation by [@&#8203;igooch](https://github.com/igooch) in
[https://github.com/googleforgames/agones/pull/3774](https://github.com/googleforgames/agones/pull/3774)
- Fix dangling "as of" by
[@&#8203;zmerlynn](https://github.com/zmerlynn) in
[https://github.com/googleforgames/agones/pull/3827](https://github.com/googleforgames/agones/pull/3827)
- Steps to Promote SDK Features from Alpha to Beta by
[@&#8203;Kalaiselvi84](https://github.com/Kalaiselvi84) in
[https://github.com/googleforgames/agones/pull/3814](https://github.com/googleforgames/agones/pull/3814)
- Adds comment for help troubleshooting issues with terraform tfstate by
[@&#8203;igooch](https://github.com/igooch) in
[https://github.com/googleforgames/agones/pull/3822](https://github.com/googleforgames/agones/pull/3822)
- docs: improve counter and list example comments by
[@&#8203;yonbh](https://github.com/yonbh) in
[https://github.com/googleforgames/agones/pull/3818](https://github.com/googleforgames/agones/pull/3818)
- Skip /tmp/ on yamllint by
[@&#8203;zmerlynn](https://github.com/zmerlynn) in
[https://github.com/googleforgames/agones/pull/3838](https://github.com/googleforgames/agones/pull/3838)
- TestAllocatorAfterDeleteReplica: More logging by
[@&#8203;zmerlynn](https://github.com/zmerlynn) in
[https://github.com/googleforgames/agones/pull/3837](https://github.com/googleforgames/agones/pull/3837)
- Instructions for upgrading golang version by
[@&#8203;gongmax](https://github.com/gongmax) in
[https://github.com/googleforgames/agones/pull/3819](https://github.com/googleforgames/agones/pull/3819)
- Remove unused function FindGameServerContainer by
[@&#8203;zmerlynn](https://github.com/zmerlynn) in
[https://github.com/googleforgames/agones/pull/3841](https://github.com/googleforgames/agones/pull/3841)
- Adds Unreal to the List of URL Links to Not Check by
[@&#8203;igooch](https://github.com/igooch) in
[https://github.com/googleforgames/agones/pull/3847](https://github.com/googleforgames/agones/pull/3847)
- docs: clarify virtualization setup for Windows versions by
[@&#8203;andresromerodev](https://github.com/andresromerodev) in
[https://github.com/googleforgames/agones/pull/3850](https://github.com/googleforgames/agones/pull/3850)

**New Contributors:**

- [@&#8203;skmpf](https://github.com/skmpf) made their first
contribution in
[https://github.com/googleforgames/agones/pull/3808](https://github.com/googleforgames/agones/pull/3808)
- [@&#8203;yonbh](https://github.com/yonbh) made their first
contribution in
[https://github.com/googleforgames/agones/pull/3818](https://github.com/googleforgames/agones/pull/3818)
- [@&#8203;peterzhongyi](https://github.com/peterzhongyi) made their
first contribution in
[https://github.com/googleforgames/agones/pull/3844](https://github.com/googleforgames/agones/pull/3844)
- [@&#8203;andresromerodev](https://github.com/andresromerodev) made
their first contribution in
[https://github.com/googleforgames/agones/pull/3850](https://github.com/googleforgames/agones/pull/3850)

</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:eyJjcmVhdGVkSW5WZXIiOiIzNy4zOTAuMCIsInVwZGF0ZWRJblZlciI6IjM3LjM5MC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9oZWxtIiwidHlwZS9taW5vciJdfQ==-->
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/M size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configurable Allocator HTTP status codes on failure
3 participants