Repository navigation
net: scope worker gateway topology watches - #918
Draft
Patrick W. Healy (phealy) wants to merge 4 commits into
Draft
Patrick W. Healy (phealy) wants to merge 4 commits into
Patrick W. Healy (phealy) wants to merge 4 commits into
Conversation
Use forwarding paths rather than undirected topology components for MTU resolution, and dynamically synchronize gateway-specific informers only while the pinned role or direct Site assignments require them. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ab9b78ee-42b8-4841-8d74-cd78d002d48b
Wrap dynamic watch requests so reflector-selected randomized timeouts are doubled for both watch-list initialization and normal watches without changing LIST requests or other watch options. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ab9b78ee-42b8-4841-8d74-cd78d002d48b
Keep SiteGatewayPoolAssignment MTUs off ordinary worker mesh links while retaining them for gateway-to-assigned-Site forwarding paths. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ab9b78ee-42b8-4841-8d74-cd78d002d48b
Install the update callback once before launching the reconcile worker and dispatch lifecycle events through a synchronized callback lookup. Cover late callback registration with immediate add, update, and delete events for all three gateway resources. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ab9b78ee-42b8-4841-8d74-cd78d002d48b
Patrick W. Healy (phealy)
added this pull request to stack #919
October 14, 2026 23:10
This was referenced Oct 14, 2026
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved startup concurrency, blocked reconciliation, MTU calculation, and status consistency issues prevent approval.
6 open findings
MTU resolver omits site, assignment, and downstream pool caps · New Pool matching applies MTU caps from non-traversed peering edges · New Data race on shared startup error variable · New Gateway MTU replaces instead of minimizing downstream cap · New Blocked cache sync prevents obsolete worker starts from being canceled · New Route summary uses stale gateway pool informer instead of lifecycle snapshot · New
What changed in this PR
Reduces node-agent API server load by running gateway topology watches only when needed, completing the five-PR optimization stack.
Changes:
- Adds gateway informer lifecycle management, synchronized callbacks, and readiness reporting.
- Calculates MTU limits from forwarding paths rather than connected topology.
- Doubles informer watch timeouts and adds tests and documentation.
| File | Description |
|---|---|
| docs/net/configuration.md | Documents forwarding-path MTU limits. |
| docs/net/architecture.md | Explains conditional gateway watches. |
| docs/content/reference/networking/configuration.md | Updates public MTU guidance. |
| cmd/unbounded-net-node/status_server.go | Adds lifecycle-aware readiness and status. |
| cmd/unbounded-net-node/status_server_http_test.go | Tests gateway readiness responses. |
| cmd/unbounded-net-node/site_watch_reconcile.go | Integrates informer lifecycle and transit MTUs. |
| cmd/unbounded-net-node/reconciliation_helpers.go | Adds forwarding-path MTU calculations. |
| cmd/unbounded-net-node/reconciliation_helpers_test.go | Tests revised MTU behavior. |
| cmd/unbounded-net-node/node_types.go | Carries transit MTU limits. |
| cmd/unbounded-net-node/mtu.go | Applies role-aware assignment limits. |
| cmd/unbounded-net-node/main.go | Separates discovery and gateway informers. |
| cmd/unbounded-net-node/informer_factory.go | Doubles watch timeouts. |
| cmd/unbounded-net-node/informer_factory_test.go | Tests watch and LIST options. |
| cmd/unbounded-net-node/gateway_informer_lifecycle.go | Manages conditional gateway caches. |
| cmd/unbounded-net-node/gateway_informer_lifecycle_test.go | Tests lifecycle transitions and callbacks. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+308
to
+309
| for _, hop := range path { | ||
| if hop.Type == "GatewayPool" { |
Comment on lines
+319
to
+323
| for _, poolName := range peering.Spec.GatewayPools { | ||
| if pathPools[strings.TrimSpace(poolName)] { | ||
| matchedPools++ | ||
| } | ||
| } |
| for range 3 { | ||
| gatewayRequired := gatewayCachesRequired(adoptedAssignment, mySiteName, assignmentInformer) | ||
|
|
||
| gatewaySnapshot, retireGatewayInformers, err = gatewayInformers.prepare(ctx, gatewayRequired) |
|
|
||
| transitTunnelMTU := learnedGatewayTransitTunnelMTU(pool.Name, learnedRoutes, poolPeerings) | ||
| if isGatewayNode { | ||
| transitTunnelMTU = gatewayPoolPeeringTunnelMTU(localGatewayPools, pool.Name, poolPeerings) |
| nodes: nodes, | ||
| poolPeerings: poolPeerings, | ||
| } | ||
| if !cache.WaitForCacheSync(runCtx.Done(), pools.HasSynced, nodes.HasSynced, poolPeerings.HasSynced) { |
Comment on lines
+3095
to
+3097
| gatewayPoolInformer := s.gatewayPoolInformer | ||
| if s.gatewayInformers != nil { | ||
| gatewayPoolInformer = s.gatewayInformers.snapshot().pools |
This branch has not been deployed
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.


Summary
Stop worker agents from watching cluster-wide gateway topology they don't use.
Testing
Stack
This is one of five stacked PRs that reduce API server load from unbounded-net-controller and unbounded-net-node. Kubernetes remains the source of truth. Review them bottom to top:
Motivation. A large cluster running v0.8.0 had the controller continuously writing objects that hadn't changed. Every node agent also watched the whole cluster's gateway topology. On a canary cluster, the full stack cut controller API calls by 54.4% and node agent API calls by 73.8%.