Skip to content

fix(gateway): reconcile provider routes when cross-zone consumers change - #875

Merged
ron96g merged 1 commit into
mainfrom
agents/cross-zone-api-propagation-investigation
Nov 20, 2026
Merged

ron96g merged 1 commit into
mainfrom
agents/cross-zone-api-propagation-investigation

Conversation

@ron96g

@ron96g ron96g commented Nov 19, 2026

Copy link
Copy Markdown
Member

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.

mapConsumeRouteToRoute only 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

  • mapConsumeRouteToRoute now queues:
    • the referenced Route. It is queued without a prior Get, so it is queued even if that Route can't be fetched;
    • all primary and failover-secondary Routes with the same name. This mirrors the consumer lookup in RouteHandler. Other proxy Routes are skipped, because they only list their own consumers.
  • The List is limited to the ConsumeRoute's environment label (rule 13-environment-isolation). If the ConsumeRoute has no environment label, only the referenced Route is queued.
  • New metadata.name field index on Route for this lookup.
  • Docs: new section "Consumer changes across zones" in docs/docs/architecture/gateway.mdx.

agentic needs no change: its Routes and ConsumeRoutes are reconciled by the gateway controller.

Tests

The new envtest specs in gateway/internal/controller/route_controller_test.go run the mapper against the manager's real cache and the new index. They cover:

  • cross-zone: zone A primary and zone D failover secondary are queued, zone C proxy is not;
  • a same-named Route in another environment is not queued;
  • a ConsumeRoute without an environment label;
  • a referenced Route that doesn't exist.

The cross-zone spec fails against the old mapper. make test passes in gateway. make lint reports 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.

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>
@ron96g ron96g self-assigned this Nov 19, 2026
@ron96g
ron96g merged commit 1863be4 into main Nov 20, 2026
78 checks passed
@ron96g
ron96g deleted the agents/cross-zone-api-propagation-investigation branch November 20, 2026 12:27
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.

2 participants