diff --git a/services/ping-discovery/Dockerfile b/services/ping-discovery/Dockerfile new file mode 100644 index 0000000..4749bed --- /dev/null +++ b/services/ping-discovery/Dockerfile @@ -0,0 +1,34 @@ +# +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +FROM golang:1.19 as build + +WORKDIR /go/src/ping-discovery +COPY . . + +RUN go mod download +RUN go vet -v +RUN go test -v + +RUN CGO_ENABLED=0 go build -o /go/bin/ping-discovery + +FROM gcr.io/distroless/static-debian11:nonroot + +COPY --from=build /go/bin/ping-discovery / + +ENV GIN_MODE=release +USER nonroot:nonroot +CMD ["/ping-discovery"] diff --git a/services/ping-discovery/README.md b/services/ping-discovery/README.md new file mode 100644 index 0000000..aecd760 --- /dev/null +++ b/services/ping-discovery/README.md @@ -0,0 +1,75 @@ +# Ping Discovery Service + +This service will inspect a Google Cloud project for +[Agones Latency Ping endpoints](https://agones.dev/site/docs/guides/ping-service/), 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. + +## API + +
Endpoint | +Input | +Return | +Description | + + +
GET /list |
+ None | +
+ +{ + "asia-east1": { + "Name": "agones-ping-udp-service", + "Namespace": "agones-system", + "Region": "asia-east1", + "Address": "104.155.211.151", + "Protocol": "UDP" + }, + "europe-west1": { + "Name": "agones-ping-udp-service", + "Namespace": "agones-system", + "Region": "europe-west1", + "Address": "34.22.151.131", + "Protocol": "UDP" + }, + "us-central1": { + "Name": "agones-ping-udp-service", + "Namespace": "agones-system", + "Region": "us-central1", + "Address": "35.227.137.95", + "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. + | +