Repository navigation
fix(gateway): reconcile provider routes when cross-zone consumers change - #875
Merged
Merged
Conversation
A cross-zone ConsumeRoute references the proxy Route in the subscriber's zone, but the subscriber's credentials end up in the JumperConfig of the same-named primary Route in the provider's zone (and failover secondary Routes). The ConsumeRoute watch only enqueued the referenced proxy Route, so changes such as a rotated client secret only reached the provider zone on the periodic resync. The ConsumeRoute-to-Route mapping now also enqueues all same-named primary and failover secondary Routes in the ConsumeRoute's environment, using a new Route name index. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
lukas016
reviewed
Nov 20, 2026
lukas016
approved these changes
Nov 20, 2026
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
In a cross-zone setup, the provider Route is in zone A and the subscriber's proxy Route is in zone B. The subscriber's ConsumeRoute references the proxy Route in zone B. The subscriber's credentials, however, are written into the JumperConfig of the same-named primary Route in zone A, which reads all ConsumeRoutes with that route name.
mapConsumeRouteToRouteonly queued the Route the ConsumeRoute references. So when a subscriber changed its config (for example, rotated its OAuth2 client secret), only the zone B proxy Route was reconciled. The zone A JumperConfig kept the old credentials until the periodic resync, which runs every 30 minutes plus up to 70% jitter (about 51 minutes at most). Deleted cross-zone subscriptions also left their credentials in place until then.Change
mapConsumeRouteToRoutenow queues:Get, so it is queued even if that Route can't be fetched;RouteHandler. Other proxy Routes are skipped, because they only list their own consumers.Listis limited to the ConsumeRoute's environment label (rule13-environment-isolation). If the ConsumeRoute has no environment label, only the referenced Route is queued.metadata.namefield index onRoutefor this lookup.docs/docs/architecture/gateway.mdx.agenticneeds no change: its Routes and ConsumeRoutes are reconciled by the gateway controller.Tests
The new envtest specs in
gateway/internal/controller/route_controller_test.gorun the mapper against the manager's real cache and the new index. They cover:The cross-zone spec fails against the old mapper.
make testpasses ingateway.make lintreports no issues in the changed files; the existing findings are in files this PR doesn't touch. The code-auditor is clean.Reviewer notes
A rotated secret now triggers one extra Route reconcile per zone that has a same-named primary or failover Route. Usually that's just one Route.