Skip to content

feat(operator): advertise GameServer hostname via external-dns Service annotation - #13

Merged
ValgulNecron merged 1 commit into
mainfrom
feat/gameserver-hostname-external-dns
Jun 28, 2026
Merged

ValgulNecron merged 1 commit into
mainfrom
feat/gameserver-hostname-external-dns

Conversation

@ValgulNecron

Copy link
Copy Markdown
Collaborator

What

Wires the previously dead spec.networking.hostname field. The dashboard already collects it (Networking settings + create wizard, with a hint promising "ingress / external-dns annotations") and the CRD stored it, but no controller code read it — setting a hostname did nothing.

The reconciler now stamps the de-facto-standard external-dns.alpha.kubernetes.io/hostname annotation onto the fronting game Service when hostname is set, so an installed external-dns controller publishes the record. The operator does not create the DNS record itself, matching the field's documented contract.

How

  • New desiredServiceAnnotations(gs) helper overlays the external-dns hint onto the user's serviceAnnotations; reconcileService feeds it through the existing applyManagedServiceAnnotations, so clearing the hostname prunes the annotation for free (managed-annotations sentinel).
  • Set unconditionally when hostname is non-empty (not gated on Expose) — external-dns decides what to publish from its own source config.
  • The typed hostname field wins over a same-key entry in serviceAnnotations (explicit, validated, UI-backed field is authoritative).
  • No CRD schema change → no codegen.

Tests

  • Unit: TestDesiredServiceAnnotations (empty/set/override/nil-map cases).
  • Envtest: TestGameServer_HostnameSetsExternalDNSAnnotation covers the set-then-prune lifecycle on the real Service.

Also gofmt-aligns a pre-existing misaligned label map in reconcileStatefulSet (Kestrel→Gameplane rename leftover) that gofmt flagged.

🤖 Generated with Claude Code

…e annotation

spec.networking.hostname was accepted by the CRD and collected by the
dashboard (Networking settings + create wizard, with a hint promising
"ingress / external-dns annotations"), but no controller code read it —
a user could set a hostname and nothing happened.

The reconciler now stamps the de-facto-standard
external-dns.alpha.kubernetes.io/hostname annotation onto the fronting
game Service when hostname is set, so an installed external-dns
controller publishes the record. The operator does not create the DNS
record itself, matching the field's documented contract.

The hint joins the existing managed-service-annotations desired set, so
removal/convergence (clearing the hostname prunes the annotation) comes
for free from applyManagedServiceAnnotations. Set unconditionally on
hostname, not gated on Expose type — external-dns decides what to
publish from its own source config. The typed field wins over a same-key
entry in serviceAnnotations.

Adds unit tests for desiredServiceAnnotations and an envtest covering the
set-then-prune lifecycle. Also gofmt-aligns a pre-existing misaligned
label map in reconcileStatefulSet (rename leftover) that gofmt flagged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: valgulnecron <39313199+ValgulNecron@users.noreply.github.com>
@ValgulNecron
ValgulNecron merged commit 309a1f8 into main Jun 28, 2026
11 checks passed
@ValgulNecron
ValgulNecron deleted the feat/gameserver-hostname-external-dns branch June 28, 2026 19:21
@ValgulNecron
ValgulNecron restored the feat/gameserver-hostname-external-dns branch June 28, 2026 19:30
@ValgulNecron
ValgulNecron deleted the feat/gameserver-hostname-external-dns branch June 28, 2026 21:52
@ValgulNecron
ValgulNecron restored the feat/gameserver-hostname-external-dns branch June 28, 2026 22:00
@ValgulNecron
ValgulNecron deleted the feat/gameserver-hostname-external-dns branch June 30, 2026 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant