From c08dfe17bc8470b71887d896864af0d67c62260c Mon Sep 17 00:00:00 2001 From: Hendrik Brombeer Date: Wed, 6 May 2026 09:41:45 +0200 Subject: [PATCH] feat(paper): stay inert when no Agones SDK sidecar is present MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The paper baseImage on Grounds bundles plugin-agones-paper into every pod by default — including plain plugin-paper Deployments that aren't wrapped in an Agones GameServer / Fleet. Those pods don't get the SDK sidecar (the Agones mutating webhook only injects it on GameServer-managed pods), so the plugin's hardcoded calls to http://localhost:9358 loop on SocketException + log SEVERE every 10 seconds — loud noise for an inert feature. Use the `AGONES_SDK_HTTP_PORT` env var as the activation gate. The Agones webhook always sets it on the GameServer container's env, right alongside the volume mount that backs the SDK socket. Present → real init (existing behaviour); absent → log a single info line ("Skipped Agones plugin (reason=no_sidecar, AGONES_SDK_HTTP_PORT_unset) ; pod is not a GameServer") and return. Mirror of the pattern plugin-grounds-platform already uses for its own required env vars: detect missing context, log once, stay quiet, never crash. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../kotlin/gg/grounds/GroundsPluginAgones.kt | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/paper/src/main/kotlin/gg/grounds/GroundsPluginAgones.kt b/paper/src/main/kotlin/gg/grounds/GroundsPluginAgones.kt index 8fa0d38..183ca4a 100644 --- a/paper/src/main/kotlin/gg/grounds/GroundsPluginAgones.kt +++ b/paper/src/main/kotlin/gg/grounds/GroundsPluginAgones.kt @@ -17,6 +17,27 @@ class GroundsPluginAgones : JavaPlugin() { private lateinit var fallbackTask: BukkitTask override fun onEnable() { + // The Agones SDK sidecar is only injected by the cluster's + // mutating webhook into pods that the controller has wrapped + // in a GameServer / Fleet. A plain plugin-paper Deployment + // (the default for non-gamemode workloads on Grounds) has no + // sidecar — the plugin's calls to localhost:9358 then loop on + // SocketException + log SEVERE every 10s, which is loud noise + // for an inert feature. + // + // The Agones webhook always sets `AGONES_SDK_HTTP_PORT` (and + // its grpc twin) on the GameServer container's env. Use that + // as the activation gate: present → real init; absent → log + // once and stay quiet. + val sidecarPort = System.getenv("AGONES_SDK_HTTP_PORT") + if (sidecarPort.isNullOrBlank()) { + logger.info( + "Skipped Agones plugin (reason=no_sidecar, " + + "AGONES_SDK_HTTP_PORT_unset); pod is not a GameServer" + ) + return + } + val agonesHelper = createAgonesHelper() setGameServerState(agonesHelper)