From a7837bc2e65c48c868ee8e2c97392c56a7595fb9 Mon Sep 17 00:00:00 2001 From: Hendrik Brombeer Date: Tue, 4 Aug 2026 13:43:59 +0200 Subject: [PATCH] feat(grounds-gamemode): give matchmade servers a broker instead of a dialled port MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A matchmade server now waits for its matches on `match.host..start` rather than listening on a port the matchmaker dials. Agones names the pod after the GameServer, so the server derives that subject from its own HOSTNAME and service-match no longer has to know where the pod is — which mattered because these fleets run portPolicy: None and therefore have neither a Service nor a DNS name, leaving the matchmaker to read the PodIP off the GameServer status. `grpcPort` and the matchhost container port stay for one release. A runtime image that has not been rebuilt has no NATS responder, and service-match falls back to the old route rather than letting the match form and then silently never start. Both come out once every matchmade fleet answers on NATS. Only rendered when matchmaking is enabled, so an ordinary fleet is untouched. --- .../grounds-gamemode/templates/_helpers.tpl | 2 ++ charts/grounds-gamemode/values.yaml | 24 +++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/charts/grounds-gamemode/templates/_helpers.tpl b/charts/grounds-gamemode/templates/_helpers.tpl index 3d7d11a..0d5916c 100644 --- a/charts/grounds-gamemode/templates/_helpers.tpl +++ b/charts/grounds-gamemode/templates/_helpers.tpl @@ -31,6 +31,8 @@ Velocity forwarding env-vars for the engine. {{- if .Values.agones.matchmaking.enabled }} - name: GROUNDS_MATCHMAKING value: "1" +- name: NATS_URL + value: {{ .Values.agones.matchmaking.natsUrl | quote }} - name: GROUNDS_MATCH_HOST_PORT value: {{ .Values.agones.matchmaking.grpcPort | quote }} {{- end }} diff --git a/charts/grounds-gamemode/values.yaml b/charts/grounds-gamemode/values.yaml index c67dc04..881221a 100644 --- a/charts/grounds-gamemode/values.yaml +++ b/charts/grounds-gamemode/values.yaml @@ -73,19 +73,29 @@ agones: enabled: false # Matchmaking mode. When on, the matchmaker (service-match) allocates and # drives these servers: it selects on the Agones `matches` Counter and pushes - # each match over gRPC to the server's MatchHost port. Off for ordinary fleets - # — a lobby is joined directly, not matchmade — so the counter, the gRPC port - # and GROUNDS_MATCHMAKING are all opt-in and a non-matchmade Fleet renders - # exactly as before. + # each match to the server over NATS. Off for ordinary fleets — a lobby is + # joined directly, not matchmade — so the counter, the broker address and + # GROUNDS_MATCHMAKING are all opt-in and a non-matchmade Fleet renders exactly + # as before. matchmaking: enabled: false # How many matches one server may host at once — the capacity of the # `matches` Counter the allocator reads (`minAvailable >= 1`) and increments # on allocation. The server decrements it when a match ends. counterCapacity: 4 - # The MatchHost gRPC port the server listens on and service-match dials - # (its GAMESERVER_GRPC_PORT default). A plain container port on the PodIP, - # not an Agones-managed game port. + # Where the server waits for its matches. It subscribes to + # `match.host..start`, and Agones names the pod after the + # GameServer, so the server derives that name from its own HOSTNAME and the + # matchmaker never has to know where the pod is. + # + # That is the whole reason this replaced a dialled port: these fleets run + # portPolicy: None, so they have no Service and no DNS name, and the + # matchmaker had to read the PodIP off the GameServer status. + natsUrl: "nats://nats.nats.svc.cluster.local:4222" + # The old MatchHost gRPC port, kept for one release. A runtime that has not + # migrated yet has no NATS responder, and service-match falls back to this + # rather than leaving the match unstarted. Remove once every fleet answers + # on NATS — with it, the container port below. grpcPort: 9090 fleet: minReplicas: 0