Add --enable-gateway-api flag (auto/true/false) to fix startup crash without Gateway API CRDs#66
Merged
danieloliveira079 merged 1 commit intomainfrom Mar 27, 2026
Conversation
Fixes a startup crash for users without Gateway API CRDs installed. The controller previously always created a Gateway API informer, causing a fatal error when httproutes.gateway.networking.k8s.io was not present. The new --enable-gateway-api flag (default: auto) probes for the HTTPRoute CRD at startup and conditionally enables the gateway backend: - auto: enable if CRD present, warn and disable if absent (safe default) - true: always enable, fail hard at startup if CRD is missing - false: always disable, no informer or client created A nil-guard in the handler returns a clear per-GameServer error if a fleet requests router-backend=gateway while the backend is disabled. Also bumps RELEASE_TAG and install.yaml image tag to 0.5.0. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Users not running the Gateway API backend hit a fatal startup crash because the controller unconditionally created a Gateway API informer. Without
httproutes.gateway.networking.k8s.ioCRD installed, the informer fails with:This broke all ingress-only users who upgraded to the version that added Gateway API support.
Solution
Add a
--enable-gateway-apiflag (default:auto) that probes for the HTTPRoute CRD at startup and conditionally enables the gateway backend:auto(default)httproutesCRD is present, warn and disable if absent. Safe for all existing deployments.truefalseThe detection checks for the
httproutesresource specifically withingateway.networking.k8s.io/v1— not just group presence — so other Gateway CRDs (gateways,gatewayclasses) being present withouthttproutesis correctly handled.A nil-guard in
GameSeverEventHandler.Reconcilereturns a clear, actionable per-GameServer error if a fleet usesrouter-backend=gatewaywhile the backend is disabled, rather than panicking.Changes
pkg/app/controller.go—resolveGatewayAPIEnabled+checkGatewayAPICRDs;Config.EnableGatewayAPIfieldpkg/stores/store.go—NewStoreacceptsgatewayEnabled bool; gateway client/informer created conditionallypkg/handlers/gameserver_handler.go—NewGameSeverEventHandleracceptsgatewayEnabled bool; nil-guard with actionable errorcmd/root.go—--enable-gateway-apiflag wired indeploy/install.yaml— image tag bumped to0.5.0Makefile—RELEASE_TAGbumped to0.5.0README.md— Controller Flags section with--enable-gateway-apidocumentedAGENTS.md— Manual test procedure for all four scenariosTest plan
--enable-gateway-api=autowith HTTPRoute CRD absent → warning logged, controller starts, ingress backend works--enable-gateway-api=truewith HTTPRoute CRD absent → fatal at startup with clear error--enable-gateway-api=false→ disabled log line, controller starts cleanly--enable-gateway-api=autowith HTTPRoute CRD present → detected and enabledgo test ./...passesAll four scenarios were validated against the dev cluster before this PR.
🤖 Generated with Claude Code