|
| 1 | +# Agones xDS Provider |
| 2 | + |
| 3 | +The [Agones] xDS Provider is built to simplify Quilkin integration with Agones |
| 4 | +game server hosting on top of [Kubernetes](https://kubernetes.io). |
| 5 | + |
| 6 | +This provider watches for changes in Agones |
| 7 | +[`GameServer` resources](https://agones.dev/site/docs/getting-started/create-gameserver/) in a cluster, and |
| 8 | +utilises that information to provide [Endpoint][Endpoints] information to connected Quilkin proxies. |
| 9 | + |
| 10 | +To view all the options for the agones provider subcommand, run: |
| 11 | +```shell |
| 12 | +$ quilkin manage agones --help |
| 13 | +{{#include ../../../../../target/quilkin.manage.agones.commands}} |
| 14 | +``` |
| 15 | + |
| 16 | +> Currently, the Agones provider can only discover resources within the cluster it is running in. |
| 17 | +
|
| 18 | +## Endpoint Configuration |
| 19 | + |
| 20 | +This provider watches the Kubernetes clusters for `Allocated` |
| 21 | +[Agones GameServers](https://agones.dev/site/docs/reference/gameserver/#gameserver-state-diagram) |
| 22 | +and exposes their IP address and Port as [Endpoints] to any connected Quilkin proxies. |
| 23 | + |
| 24 | +> Since an Agones GameServer can have multiple ports exposed, if multiple ports are in |
| 25 | +> use, the server will pick the first port in the port list. |
| 26 | +
|
| 27 | +By default the Agones xDS provider will look in the `default` namespace for any `GameServer` resources, but it can be |
| 28 | +configured via the `--gameservers-namespace` argument. |
| 29 | + |
| 30 | +### Access Tokens |
| 31 | + |
| 32 | +The set of [access tokens](../../proxy.md#specialist-endpoint-metadata) for the associated Endpoint can be |
| 33 | +set by adding a comma separated standard base64 encoded strings. This must be added under an annotation |
| 34 | +`quilkin.dev/tokens` in the |
| 35 | +[GameServer](https://agones.dev/site/docs/reference/agones_crd_api_reference/#agones.dev/v1.GameServer)'s metadata. |
| 36 | + |
| 37 | +For example: |
| 38 | + |
| 39 | +```yaml |
| 40 | +annotations: |
| 41 | + # Sets two tokens for the corresponding endpoint with values 1x7ijy6 and 8gj3v2i respectively. |
| 42 | + quilkin.dev/tokens: MXg3aWp5Ng==,OGdqM3YyaQ== |
| 43 | +``` |
| 44 | +
|
| 45 | +## Filter Configuration |
| 46 | +
|
| 47 | +The Agones provider watches for a singular [`ConfigMap`](https://kubernetes.io/docs/concepts/configuration/configmap/) |
| 48 | +that has the label of `quilkin.dev/configmap: "true"`, and any changes that happen to it, and use its contents to |
| 49 | +send [Filter] configuration to any connected Quilkin proxies. |
| 50 | +
|
| 51 | +The `ConfigMap` contents should be a valid Quilkin [file configuration][configuration], but with no |
| 52 | +Endpoint data. |
| 53 | + |
| 54 | +For example: |
| 55 | + |
| 56 | +```yaml |
| 57 | +{{#include ../../../../../examples/agones-xonotic-xds/xds-control-plane.yaml:config-map}} |
| 58 | +``` |
| 59 | + |
| 60 | +By default the Agones xDS provider will look in the `default` namespace for this `ConfigMap`, but it can be |
| 61 | +configured via the `--config-namespace` argument. |
| 62 | + |
| 63 | +## Usage |
| 64 | + |
| 65 | +As an example, the following runs the server with subcommnad `manage agones` against a cluster (using default |
| 66 | +kubeconfig authentication) where Quilkin pods run in the `quilkin` namespace and `GameServer` pods run in the |
| 67 | +`gameservers` namespace: |
| 68 | + |
| 69 | +```sh |
| 70 | +quilkin manage agones --config-namespace quilkin --gameservers-namespace gameservers |
| 71 | +``` |
| 72 | + |
| 73 | +For a full referenmce of deploying this provider in a Kubernetes cluster, with appropriate [Deployments], [Services], |
| 74 | +and [RBAC] Rules, there is an [Agones, xDS and Xonotic example][example]. |
| 75 | + |
| 76 | +[Agones]: https://agones.dev |
| 77 | +[Endpoints]: ../../proxy.md#endpoints |
| 78 | +[Deployments]: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/ |
| 79 | +[Services]: https://kubernetes.io/docs/concepts/services-networking/service/ |
| 80 | +[RBAC]: https://kubernetes.io/docs/reference/access-authn-authz/rbac/ |
| 81 | +[example]: https://github.com/googleforgames/quilkin/tree/{{GITHUB_REF_NAME}}/examples/agones-xonotic-xds |
| 82 | +[Filter]: ../../../services/proxy/filters.md |
| 83 | +[configuration]: ../../../services/proxy/configuration.md |
0 commit comments