Skip to content

net: reconcile SiteNodeSlices per Site - #915

Draft
Patrick W. Healy (phealy) wants to merge 3 commits into
phealy/net-api-controller-noopsfrom
phealy/net-api-site-slices
Draft

Patrick W. Healy (phealy) wants to merge 3 commits into
phealy/net-api-controller-noopsfrom
phealy/net-api-site-slices

Conversation

@phealy

@phealy Patrick W. Healy (phealy) commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Reconcile SiteNodeSlices one Site at a time instead of reconsidering every Site on any change.

  • Targeted work. Node and Site events map to the Sites they affect. Reconciling one Site doesn't read another Site's slices.
  • No-op reconciles. A reconcile whose cached slices are unchanged makes no live API reads.
  • Malformed slices. A malformed slice marks every Site for reconciliation. After cleaning it up, the controller rebuilds the affected slices so that a partly deleted set can't leave stale membership.
  • Orphan repair. Repair of orphaned slices is deferred out of the topology reconcile.
  • Design doc. designs/site-node-slices.md documents the approach.

Testing

Unit tests cover:

  • no live reads for an unchanged reconcile
  • targeted reconciliation of one Site
  • malformed-slice events marking all Sites
  • rebuilding slices after cleanup
  • deferred orphan repair

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:

  1. net: skip no-op managed kube-proxy reconciliation #914 Controller no-op reconciliation
  2. net: reconcile SiteNodeSlices per Site #915 Targeted SiteNodeSlice reconciliation
  3. net: publish node assignments and replace stale agents #916 Controller-published node assignments
  4. net: adopt and acknowledge node assignments in the agent #917 Node agent assignment adoption
  5. net: scope worker gateway topology watches #918 Scoped worker gateway watches

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%.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Event targeting can miss affected Sites, leaving stale Node membership or missing connectivity slices.

3 open findings
What changed in this PR

Reduces controller API load by reconciling SiteNodeSlices only for affected Sites.

Changes:

  • Adds per-Site dirty tracking and cache-based no-op checks.
  • Moves orphan repair to a separate periodic loop.
  • Adds reconciliation tests and design documentation.
File Description
internal/​net/​controller/​site_controller.go Targets reconciliation and defers orphan repair.
internal/​net/​controller/​site_controller_helpers_test.go Tests targeted work, no-op reads, and malformed-slice repair.
designs/​site-node-slices.md Documents reconciliation scope and live-state safeguards.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/net/controller/site_controller.go Outdated
Comment thread internal/net/controller/site_controller.go Outdated
Comment thread internal/net/controller/site_controller.go Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: ab9b78ee-42b8-4841-8d74-cd78d002d48b
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: ab9b78ee-42b8-4841-8d74-cd78d002d48b
SiteNodeSlice membership is derived from internal IPs, so Node updates and
deletions dirty both the labeled and IP-matched Sites. Slice updates dirty
both the old and new siteName so the original Site can repair a slice that
the new Site deletes as extra.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ab9b78ee-42b8-4841-8d74-cd78d002d48b

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Concurrent dirty-work tracking and deferred repair affect network membership and warrant final human validation.

0 open findings

3 resolved since last review

🧠 Review effort: Balanced

This branch has not been deployed

No deployments
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