This service will inspect a Google Cloud project for Agones Latency Ping endpoints, and return one for each region that Agones is installed.
The Service will choose an endpoint at random on each request for each region, assuming there are more than one. This is to distribute the load amongst clusters.
Endpoint | Input | Return | Description |
GET /list |
None |
{ "asia-east1": { "Name": "agones-ping-udp-service", "Namespace": "agones-system", "Region": "asia-east1", "Address": "35.229.159.46", "Port": 50000, "Protocol": "UDP" }, "europe-west1": { "Name": "agones-ping-udp-service", "Namespace": "agones-system", "Region": "europe-west1", "Address": "34.25.152.131", "Port": 50000, "Protocol": "UDP" }, "us-central1": { "Name": "agones-ping-udp-service", "Namespace": "agones-system", "Region": "us-central1", "Address": "35.226.145.95", "Port": 50000, "Protocol": "UDP" } } |
Map of region, where the key is the region name, and a singular endpoint for the UDP ping service for each region as the value. |
When running locally, make sure you have gcloud installed, and a default project authenticated and configured, so that the binary can determine the project it should be scanning for Ping endpoints.
go run main.go
docker build . -t ping-discovery
Note: The docker image will fail locally, since it has no access Google Cloud Application Default Credentials.