-
Notifications
You must be signed in to change notification settings - Fork 801
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
Added game-server example #1771
Added game-server example #1771
Conversation
examples/simple-game-server/Makefile
Outdated
|
||
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) | ||
project_path := $(dir $(mkfile_path)) | ||
server_tag = $(REPOSITORY)/game-server:0.22 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume we could start counting from the start:
server_tag = $(REPOSITORY)/game-server:0.22 | |
server_tag = $(REPOSITORY)/game-server:0.1 |
spec: | ||
containers: | ||
- name: simple-game-server | ||
image: gcr.io/agones-images/game-server:0.22 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, version tag could be 0.1
examples/simple-game-server/main.go
Outdated
tcpRespond(conn, "ACK TCP: "+txt) | ||
exit(s) | ||
|
||
// turns off the health pings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// turns off the health pings | |
// allocates GameServer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, for this PR. First of all I assume we can list all commands which are available when using TCP server, they have been reduced for some reason, only ALLOCATE
and EXIT
left.
Other idea, can we remove simple-udp
server in a single or an upcoming PR to reduce code duplication?
Build Succeeded 👏 Build Id: 4aa8a6ef-11a0-479e-b524-56bc0a800fc2 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:
|
Only other main thing I would add - put a entry in here: https://agones.dev/site/docs/examples/#game-server-implementations Source: https://github.com/googleforgames/agones/blob/master/site/content/en/docs/Examples/_index.md |
Build Failed 😱 Build Id: 41673126-e94c-428b-8265-0781ccc8fe5b To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Build Succeeded 👏 Build Id: 7691b9f1-89a9-47cb-a9c6-655647074cb2 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:
|
I've added the changes, and also used this image as the e2e image which passed. Before being merged, the e2e image should be changed and the gameserver image should also be uploaded to gcr.io/agones-images |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't review main.go too thoroughly, since it's mostly copied from existing code.
It would also be nice to add yaml configs showing how to enable TCP (and maybe both udp and tcp) so that we can deprecate and delete the simple-udp and simple-tcp example directories.
build/Makefile
Outdated
@@ -57,7 +57,7 @@ KIND_PROFILE ?= agones | |||
KIND_CONTAINER_NAME=$(KIND_PROFILE)-control-plane | |||
|
|||
# Game Server image to use while doing end-to-end tests | |||
GS_TEST_IMAGE ?= gcr.io/agones-images/udp-server:0.21 | |||
GS_TEST_IMAGE ?= gcr.io/agones-dev-286708/game-server:0.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert this file in the PR (feel free to keep it locally for testing though).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is to use this instead of the udp server, as discussed here. Do you just prefer that this is changed at a later point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @roberthbailey 's point is that it shouldn't be GS_TEST_IMAGE ?= gcr.io/agones-dev-286708/game-server:0.1
it should be GS_TEST_IMAGE ?= gcr.io/agones-images/game-server:0.1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should either be reverted (so that we continue to use the udp-server:0.21 in e2e tests for now) or updated to the agones-images project (if we feel like the new image is ready to go).
examples/simple-game-server/Makefile
Outdated
|
||
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) | ||
project_path := $(dir $(mkfile_path)) | ||
server_tag = $(REPOSITORY)/game-server:0.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you call the image simple-game-server
instead of game-server
to be consistent with the directory name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we rather want it to be inconsistent with the other image names?
The udp server image is called udp-server
, while the directory is called simple-udp
, so I just want to make sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, @markmandel set the original naming scheme (which I copied for the simple-tcp server) but personally I think it makes more sense if the names match.
As another data point, the language specific examples are directory-name
-server
, e.g. rust-simple-server
in the directory rust-simple
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to @roberthbailey makes sense to me for the directory and the name to match 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, will rename the image name 👍
@@ -22,6 +22,7 @@ These are all examples of simple game server implementations, that integrate the | |||
|
|||
- {{< ghlink href="examples/simple-udp" >}}Simple UDP{{< /ghlink >}} (Go) - simple server and client that send UDP packets back and forth. | |||
- {{< ghlink href="examples/simple-tcp" >}}Simple TCP{{< /ghlink >}} (Go) - simple server that responds to new-line delimited messages sent over a TCP connection. | |||
- {{< ghlink href="examples/simple-game-server" >}}Simple gameserver{{< /ghlink >}} (Go) - simple server that responds to TCP connections or UDP packets on the same port. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add release guards to this new link.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do I do that/Where can I read about how to do that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
examples/simple-game-server/main.go
Outdated
} | ||
|
||
// prevents program from quitting as the server is listening on goroutines | ||
for { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Put on one line (for {}
).
Build Failed 😱 Build Id: 68285ecd-321f-4692-9699-b66d1b62a499 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
I'm assuming that this is failing since that image hasn't been built and pushed up. I assume @Bmandk you are good for me to create it and push it to the registry? |
I would be inclined to say that I may have gotten the feature gate wrong, as that is the test that is failing. But please correct me if I'm wrong! |
I just realized that I wrote the 0.9.0 and not 1.9.0, but I'm assuming that is not the reason of the test failing. I'm unsure if there's anything else, or if I'm just misinterpreting the test logs. Wdyt? |
Heh, yes, that will be something that does need to be fixed 👍 But looks like Did you want me to wait until the feature gate on the docs is fixed, or you good for me to go ahead and get that image up there? |
Just pushed the new version, feel free to push it up now! |
Cool - thanks! We're in the middle of our performance review season, but will try and take a break today/tomorrow and get this up. Thanks for working with us on this! |
No hurry at all, and thanks for all your patience with me :) |
Build Failed 😱 Build Id: 186c61d1-d6cd-4b08-9019-045c9eaf5c76 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Build Failed 😱 Build Id: e0b6e64f-4dfa-45c2-b35a-8f146cd65c33 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Build Succeeded 👏 Build Id: c719e467-4e37-4744-8ad8-29e126e4e7d1 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:
|
# Usually you would define a Fleet rather than a GameServerSet | ||
# directly. This is here mostly for testing purposes | ||
|
||
apiVersion: "agones.dev/v1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if we should delete this file -- it actually serves no purpose other than potentially Agones developer testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to deleting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay passing! I had some general minor cleanup things, but otherwise, this looks really good/
https://github.com/googleforgames/agones/blob/master/test/e2e/framework/framework.go#L165 < another place to update the default udp server image.
- name: simple-game-server | ||
image: gcr.io/agones-images/simple-game-server:0.1 | ||
env: | ||
# Disables the UDP listener (Enabled by default) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think on all of these, let's default to UDP being enabled, since that's the most common use case. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, will do
- name: simple-game-server | ||
image: gcr.io/agones-images/simple-game-server:0.1 | ||
env: | ||
# Disables the UDP listener (Enabled by default) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, feels like UDP should be enabled by default.
(Does it make sense to remove the env cars entirely for the default version, and maybe have a fleet-tcp.yaml for a TCP version?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that actually makes more sense. So remove the env vars from all the current yaml's, and just make a TCP-only fleet? That should show both how to disable UDP and enable TCP.
env: | ||
# Disables the UDP listener (Enabled by default) | ||
- name: "UDP" | ||
value: "FALSE" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing here - wondering if it's simpler to remove the env vars -- here we are demo'ing passthrough, so I don't know if we want to make things more complicated with more env varas for UDP/TCP enablement?
- name: simple-game-server | ||
image: gcr.io/agones-images/simple-game-server:0.1 | ||
env: | ||
# Disables the UDP listener (Enabled by default) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's start with UDP enabled by default (maybe delete the env vars?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops, just kicking this to "request changes" so we address the cleanup items before this gets merged.
Build Succeeded 👏 Build Id: f5064412-526c-4bbe-a2c2-6996ed9fa13d 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:
|
Build Failed 😱 Build Id: d04a003e-de75-4792-bdba-7c4e34a5cbf7 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
I think I pressed a wrong button, as I accidentally created a new commit. I've reverted that, hopefully it should be fine now. Let me know if there are other changes required. |
Build Succeeded 👏 Build Id: 6bcde4be-61b3-4586-8905-f273b016cafe 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:
|
.golangci.yml
Outdated
@@ -46,7 +46,6 @@ output: | |||
|
|||
linters: | |||
enable: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something weird has happened with your git history -- there are all this extra changes in here 😞
You might want to rebase your local branch against master, and squash your changes, and force push over the top to make sure you're in a happy place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, everything looks fine now. Let me know if there's anything else I need to do (as you might have guessed, I'm not a git wizard!)
Change initial version to 0.1 Move response handling to function and use for both UDP and TCP Generalized the response handling to TCP and UDP Added documentation Change empty for loop to one-liner Changed repo for e2e test image Renamed image to simple-game-server Added release guards to docs Changed feature gate version Added yaml config of disabling UDP and enabling TCP Update build/Makefile to use simple-game-server:0.1 image name Co-authored-by: Mark Mandel <markmandel@google.com> Deleted gameserverset.yaml Changed default flags for gs image in test framework Removed env vars from yaml and create a new fleet-tcp.yaml instead Revert "Merge branch 'master' into simple-game-server-example" This reverts commit cda2966, reversing changes made to 1faaa39. Revert "Revert "Merge branch 'master' into simple-game-server-example"" This reverts commit 06c841d.
06c841d
to
f42da54
Compare
Build Failed 😱 Build Id: aca5009f-6106-4cb4-b683-7d49f479463c To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Oh no.. |
It's okay, that's a standard flake 🙄 |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: aLekSer, Bmandk, markmandel The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Build Succeeded 👏 Build Id: 5bd0bdd0-47ef-47d0-acc3-bb092ad7483f 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:
|
Change initial version to 0.1 Move response handling to function and use for both UDP and TCP Generalized the response handling to TCP and UDP Added documentation Added yaml config of disabling UDP and enabling TCP Update build/Makefile to use simple-game-server:0.1 image name Co-authored-by: Mark Mandel <markmandel@google.com>
What type of PR is this?
/kind cleanup
What this PR does / Why we need it:
As discussed in this PR, this PR adds a game-server-example, which is the simple-udp server with added TCP functionality, enabled through flags. While it could be generalized more (by consolidating the large switch to a protocol-independant function), I wanted to only expand on the udp server to not make any breaking changes here.
In the future, this could replace the udp example for all testing purposes, and the tcp server should also be removed.
Which issue(s) this PR fixes:
Closes #
Special notes for your reviewer: