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

Documentation quickstart and specification gameserver #124

Merged
merged 1 commit into from
Mar 2, 2018

Conversation

cyriltovena
Copy link
Collaborator

@cyriltovena cyriltovena commented Mar 1, 2018

This should resolves #45

  • the simple-udp 0.1 need to be pushed again.

@cyriltovena cyriltovena added kind/documentation Documentation for Agones area/examples Examples. Usually found in the `examples` directory labels Mar 1, 2018
@cyriltovena cyriltovena requested a review from markmandel March 1, 2018 19:36
@markmandel markmandel added this to the 0.1 milestone Mar 1, 2018
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.

This is awesome.

Still want to run through this and test it, but thought I'd drop a few initial thoughts down before I had a chance to do that.

README.md Outdated

### Guides
- Integrating the C++ SDK (forthcoming)
- [Game Server Specification](./docs/gameserver_spec.md)
- [Integrating the C++ SDK](./docs/integrating_sdk.md)
Copy link
Member

Choose a reason for hiding this comment

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

Did you mean to include this line (and the accompanying empty doc?)

Just since there isn't anything in it, I have a minor concern it will get skipped ;)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was willing to do it but then time run out. I'll remove it.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good. I've got a PR coming where I expand and move the SDK section around a bit, so it should take care of this. It's coming down the pike.


>NOTE: Agones required Kubernetes versions 1.9 with role-based access controls (RBAC) and MutatingAdmissionWebhook features activated. To check your version, enter `kubectl version`.

If you don't have a Kubernetes cluster you can follow the [build](../build/README.md#running-a-test-minikube-cluster) instructions to either use [Minikube](https://github.com/kubernetes/minikube) single node cluster or create one in [Google Kubernetes Engine](https://cloud.google.com/kubernetes-engine/).
Copy link
Member

Choose a reason for hiding this comment

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

We can update this section once @dzlier-gcp has the new install guide, and redirect to that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@dzlier-gcp let me know when it's ready

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

actually I referenced it already !


Like any other kubernetes ressources you describe a GameServer desired state via a specification written in YAML or JSON to the kubernetes API. The Agones controller will then change the actual state to the desired state.

A full GameServer specification is available below for reference :
Copy link
Member

Choose a reason for hiding this comment

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

Shall we also link to the example.yaml in case people want a straight up yaml file as well?


The `spec` field is the actual GameServer specification and it is composed as follow:

- `container` is the name of container running the GameServer in case you are running a [multi-container pod](https://kubernetes.io/docs/concepts/workloads/pods/pod-overview/) , if you do this is mandatory. For instance this is useful if you want to run a sidecar to ship logs.
Copy link
Member

Choose a reason for hiding this comment

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

Rather than saying "multi container" - can we simplify this and say "if you have than one container definied in a pod" (or similar). I think it would be easier to parse.

Let's wait for the GameServer state to become `Ready`:

```
watch kubectl describe gameserver
Copy link
Member

Choose a reason for hiding this comment

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

Should we put an example in here of what it should look like, and some directions, so the user knows where to look to know that the GameServer is Ready?

(Maybe also direct them to look at some of the events, just as a point of interest?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Let me know, wasn't sure what to say

Copy link
Member

Choose a reason for hiding this comment

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

👍

@@ -0,0 +1 @@
# Integrating the C++ SDK
Copy link
Member

Choose a reason for hiding this comment

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

Should we remove this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

will do

@@ -17,12 +17,9 @@ kind: GameServer
metadata:
name: "simple-udp"
spec:
portPolicy: "static"
Copy link
Member

Choose a reason for hiding this comment

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

Question: do we want to be explicit about being dynamic? I don't have strong opinions, but thought I'd raise the question.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think it's a good point let's do that, if users look at the file at least it is more explanatory

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@markmandel markmandel added the area/user-experience Pertaining to developers trying to use Agones, e.g. SDK, installation, etc label Mar 1, 2018
@cyriltovena cyriltovena force-pushed the doc/quickstart-gs branch 3 times, most recently from 9cf5491 to 671e057 Compare March 1, 2018 21:28
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.

Looking good - some more thoughts and feeling.

Normal Starting 11s gameserver-controller Synced
Normal Ready 4s gameserver-controller Address and Port populated
```

Copy link
Member

Choose a reason for hiding this comment

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

"If you look towards the bottom, you can see there is a Status > State value. We are waiting for it to move to Ready, which means that the game server is ready to accept connections.

You might also be interested to see the Events section, which outlines when various lifecycle events of the GameSever occur. We can also see when the GameServer is ready on the event stream as well - at which time the Status > Address and Status > Port have also been populated, letting us know what IP and port our client can now connect to!

^ Something like that sound good?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yep changing it.

Name: simple-udp
Resources:
Status:
Address: 10.130.65.212
Copy link
Member

Choose a reason for hiding this comment

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

Just want to double check this isn't a real IP you care about

Copy link
Collaborator Author

@cyriltovena cyriltovena Mar 1, 2018

Choose a reason for hiding this comment

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

it's internal (10.x.x.x) I don't think anyone can do anything with it. Should I changed that ?

Copy link
Member

Choose a reason for hiding this comment

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

As long as it's fine. Just wanted to double check. Security FTW.


1. A Kubernetes cluster with the UDP port range 7000-8000 open on each node.
2. Agones controller installed in the targeted cluster
3. kubectl properly configured
Copy link
Member

Choose a reason for hiding this comment

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

netcat?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

you're either on WSL or linux I guess you have that no ?

Copy link
Member

Choose a reason for hiding this comment

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

I'd err on the side of being explicit? And maybe make a note that it's already installed on most Linux/macOS distros, Windows will need to use WSL) ?

Copy link
Member

Choose a reason for hiding this comment

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

👍

```
user@computer:~/$ gameserver "simple-udp" created
```

Copy link
Member

Choose a reason for hiding this comment

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

"This has created a GameServer record inside Kubernetes, which has also created a backing Pod (maybe talk about Pods?) to run our simple udp game server code in"

(I just want to explain a bit more what has happened at each step)

If you want to see all your running GameServers you can run:
kubectl get gameservers

It should look something like this: insert example

(Maybe)

You can also see the Pod that got created by running kubectl get pods, the Pod will be prefixed by simple-udp.


To install Agones controller into your Kubernetes cluster follow the [installation instructions](../README.md#Installation).

For the purpose of this guide we're going to use the [simple-udp](../examples/simple-udp/) example as the GameServer container. This example is very simple UDP server written in Go. Don't hesitate to look at the code of this example for more information.
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to move this up to the top, so we start with what we're trying to achieve?

Otherwise this might get buried in the pre-reqs section.

EXIT
```

You can also try to send `UNHEALTHY` to change the Game Server state.
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to do this - or should we tell them to type 'EXIT' which tells the SDK to run the Shutdown command, and therefore shuts down the GameServer?

@cyriltovena
Copy link
Collaborator Author

Everything should be resolved.

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.

All just super minor stuff.

But I tested out all the steps, and everything works!

README.md Outdated

### Guides
- [Game Server Specification](./docs/gameserver_spec.md)
Copy link
Member

Choose a reason for hiding this comment

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

Should the spec be under "Reference" ? WDYT?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Moved !


## Objectives

- Create a GameServer in kubernetes using Agones custom ressources.
Copy link
Member

Choose a reason for hiding this comment

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

resources

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

EXIT
```

You can finally type `EXIT` which tells the SDK to run the Shutdown command, and therefore shuts down the `GameServer`.
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Should we also make a note something like:

"Which you can see if you run kubectl describe gameserver again - either the GameServer will be gone completely, or it will be in Shutdown state, on the way to being deleted"

Or something to that effect?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added the text

watch kubectl describe gameserver
```

If you look towards the bottom, you can see there is a `Status > State` value. We are waiting for it to move to `Ready`, which means that the game server is ready to accept connections.
Copy link
Member

Choose a reason for hiding this comment

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

Minor thought: Should this section be after the example? Not sure.

Copy link
Collaborator Author

@cyriltovena cyriltovena Mar 2, 2018

Choose a reason for hiding this comment

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

Yes read again and I give some space.


1. A Kubernetes cluster with the UDP port range 7000-8000 open on each node.
2. Agones controller installed in the targeted cluster
3. kubectl properly configured
Copy link
Member

Choose a reason for hiding this comment

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

👍

Let's wait for the GameServer state to become `Ready`:

```
watch kubectl describe gameserver
Copy link
Member

Choose a reason for hiding this comment

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

👍

You can now communicate with the Game Server :

```
nc -u 10.130.65.208 7936
Copy link
Member

Choose a reason for hiding this comment

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

Should this be nc -u {IP} {PORT}

???

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sure


Since Agones defines a new [Custom Ressources Definition (CRD)](https://kubernetes.io/docs/concepts/api-extension/custom-resources/) we can define a new ressource using the kind `GameServer` with the custom group `stable.agones.dev` and API version `v1alpha1`.

You can use the metadata field to target a specific [namespaces](https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/) but also attach specific [annotations](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/) and [labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/) to your ressource. This is a very common pattern in the kubernetes ecosystem.
Copy link
Member

Choose a reason for hiding this comment

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

Kubernetes (capitol K)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed everywhere.

- `containerPort` the port that is being opened on the game server process, this is required field.
- `protocol` the protocol being used. Defaults to UDP. TCP is the only other option.
- `health` to track the overall healthy state of the GameServer, more information available in the [health check documentation](./health_checking.md).
- `template` the [pod spec template](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.9/#pod-v1-core) to run you GameServer containers, [see](https://kubernetes.io/docs/concepts/workloads/pods/pod-overview/#pod-templates) for more
Copy link
Member

Choose a reason for hiding this comment

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

for more .... "information" ? 😄

@cyriltovena
Copy link
Collaborator Author

Voila

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.

LGTM!

@markmandel markmandel merged commit 980b34f into master Mar 2, 2018
@markmandel markmandel deleted the doc/quickstart-gs branch March 2, 2018 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/examples Examples. Usually found in the `examples` directory area/user-experience Pertaining to developers trying to use Agones, e.g. SDK, installation, etc kind/documentation Documentation for Agones
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Write documentation for creating a GameServer
3 participants