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

how to allocate a Local Game Server? #2536

Closed
goace opened this issue Apr 7, 2022 · 13 comments · Fixed by #2545
Closed

how to allocate a Local Game Server? #2536

goace opened this issue Apr 7, 2022 · 13 comments · Fixed by #2545
Assignees
Labels
area/user-experience Pertaining to developers trying to use Agones, e.g. SDK, installation, etc help wanted We would love help on these issues. Please come help us! kind/bug These are bugs.
Milestone

Comments

@goace
Copy link
Contributor

goace commented Apr 7, 2022

the doc only shows how to register a local server to agones, but how can I allocate it ?

@SaitejaTamma SaitejaTamma added the question I have a question! label Apr 7, 2022
@roberthbailey
Copy link
Member

Which doc are you referring to?

Whenever I need a refresher for how to allocate, I look at https://agones.dev/site/docs/getting-started/create-fleet/#4-allocate-a-game-server-from-the-fleet

For easier discovery, I wonder if moving that to a separate page under the getting started guides would make sense.

@goace
Copy link
Contributor Author

goace commented Apr 8, 2022

@roberthbailey Hi, I mean this doc https://agones.dev/site/docs/guides/local-game-server/

How can I allocate a GS which is registered as a local-game-server?

@roberthbailey
Copy link
Member

That page says "The game server is not managed by Agones. Features like autoscaling, replication, etc are not available." I wonder if allocation is one of the features that doesn't work.

Maybe @markmandel knows offhand?

@goace
Copy link
Contributor Author

goace commented Apr 8, 2022

What's the meaning of registering a local server to agones If it can't be allocated..?

@roberthbailey
Copy link
Member

What's the meaning of registering a local server to agones If it can't be allocated..?

You can verify the interaction between the game server and the SDK / sidecar. For example, you can verify that you are sending health pings correctly, you can watch the game server to see when metadata gets applied to it, you can set labels or annotations on the game server and see metadata propagate back to the Kubernetes resource, you can verify that you are calling Ready() at the correct time. If you are using the alpha features, you can set player capacity and call player connect / disconnect as well.

It seems like it should be possible to allocate a local game server though - I just haven't tried testing it myself.

@markmandel
Copy link
Member

Sorry, I think there is confusion.

https://agones.dev/site/docs/guides/local-game-server/ refers to registering a local address for QA purposes with an existing Agones cluster. (This is different from the test local server found here), which I think is what you were referring to @roberthbailey.

If you want to allocate that GameServer from the cluster, then you use an Allocation with appropriate selectors that will match against it, just like you would for any other GameServer.

The point of it is that it looks and acts like just about any other GameServer withing the cluster, but the address points to a local instance, to make QA a bit easier to handle, so there is inherently nothing special about how you would Allocate it vs any other GameServer.

@roberthbailey
Copy link
Member

So it sounds like it should be allocatable like any other game server and we just need to add some instructions on how to do it.

@roberthbailey roberthbailey added the help wanted We would love help on these issues. Please come help us! label Apr 11, 2022
@markmandel
Copy link
Member

Not sure how we can tell you how to do it - other than point you at existing documentation 🤔 . We don't know what labels you are putting on your GameServer, so we don't know how you could allocate.

We could make a note that "you can then allocate as you would do normally, through label selectors", and point to the GameServerAllocation reference? (maybe provide an example?)

Would that make things clearer @goace ?

@goace
Copy link
Contributor Author

goace commented Apr 12, 2022

@markmandel thanks for your reply, it make sense.

So I can add a native k8s label to a gameserver, then I can allocate it via "matchLabels" with my custom lable, is that right?

I think you should put that in the docs to make this clear to everyone..

@goace
Copy link
Contributor Author

goace commented Apr 12, 2022

I encountered a new problem, I think it's a bug.

I allocated a local game server with my custom label successfully, bug the gameserver's state is still READY.

image

@markmandel

@goace
Copy link
Contributor Author

goace commented Apr 12, 2022

for more information, this is my config files:

# gameserver depolyment
apiVersion: "agones.dev/v1"
kind: GameServer
metadata:
  name: local-gs
  annotations:
    agones.dev/dev-address: "192.168.1.1"
  labels:
    gstype: local
spec:
  ports:
  - name: default
    portPolicy: Static
    hostPort: 17654
    containerPort: 17654
  # The following is ignored but required due to validation.
  template:
    spec:
      containers:
      - name: simple-game-server
        image: gcr.io/agones-images/simple-game-server:0.11

# allocation
apiVersion: "allocation.agones.dev/v1"
kind: GameServerAllocation
spec:
  selectors:
    - matchLabels:
        gstype: local
  scheduling: Packed

@markmandel
Copy link
Member

Oooh! Good find! Just replicated this in an e2e test locally.

I'll get a fix into the next release.

@markmandel
Copy link
Member

Found the bug! PR incoming. That's been there a long while.

The good news is, since you are managing individual local development GameServers, making sure it stays as Allocated doesn't really matter, as nothing is going to delete it unless you/some system you control does it.

@markmandel markmandel added kind/bug These are bugs. and removed question I have a question! labels Apr 15, 2022
@markmandel markmandel self-assigned this Apr 15, 2022
@markmandel markmandel added the area/user-experience Pertaining to developers trying to use Agones, e.g. SDK, installation, etc label Apr 15, 2022
markmandel added a commit to markmandel/agones that referenced this issue Apr 15, 2022
There was a bug in the implementation of the [local development
GameServer](https://agones.dev/site/docs/guides/local-game-server/)
that would always move a `GameServer` to `Ready` any time the state was
not currently `Ready`.

This meant if you tried to Allocate the `GameServer`, the controller
would immediately move it back to being `Ready`.

This fix locks down that the only path that the controller should affect
is moving from `Creating` state to `Ready`. This allows the end user to
manually manage state on the `GameServer` as they desire.

Closes googleforgames#2536
markmandel added a commit to markmandel/agones that referenced this issue Apr 21, 2022
There was a bug in the implementation of the [local development
GameServer](https://agones.dev/site/docs/guides/local-game-server/)
that would always move a `GameServer` to `Ready` any time the state was
not currently `Ready`.

This meant if you tried to Allocate the `GameServer`, the controller
would immediately move it back to being `Ready`.

This fix locks down that the only path that the controller should affect
is moving from `Creating` state to `Ready`. This allows the end user to
manually manage state on the `GameServer` as they desire.

Closes googleforgames#2536
roberthbailey pushed a commit that referenced this issue Apr 21, 2022
* Don't move Dev GameServer back to Ready always

There was a bug in the implementation of the [local development
GameServer](https://agones.dev/site/docs/guides/local-game-server/)
that would always move a `GameServer` to `Ready` any time the state was
not currently `Ready`.

This meant if you tried to Allocate the `GameServer`, the controller
would immediately move it back to being `Ready`.

This fix locks down that the only path that the controller should affect
is moving from `Creating` state to `Ready`. This allows the end user to
manually manage state on the `GameServer` as they desire.

Closes #2536

* Review updates.
Thiryn pushed a commit to Thiryn/agones that referenced this issue Apr 25, 2022
* Don't move Dev GameServer back to Ready always

There was a bug in the implementation of the [local development
GameServer](https://agones.dev/site/docs/guides/local-game-server/)
that would always move a `GameServer` to `Ready` any time the state was
not currently `Ready`.

This meant if you tried to Allocate the `GameServer`, the controller
would immediately move it back to being `Ready`.

This fix locks down that the only path that the controller should affect
is moving from `Creating` state to `Ready`. This allows the end user to
manually manage state on the `GameServer` as they desire.

Closes googleforgames#2536

* Review updates.
@SaitejaTamma SaitejaTamma added this to the 1.23.0 milestone May 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/user-experience Pertaining to developers trying to use Agones, e.g. SDK, installation, etc help wanted We would love help on these issues. Please come help us! kind/bug These are bugs.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants