Skip to content

net: reconcile SiteNodeSlices per Site - #915

Open
Patrick W. Healy (phealy) wants to merge 4 commits into
mainfrom
phealy/net-api-site-slices
Open

Patrick W. Healy (phealy) wants to merge 4 commits into
mainfrom
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

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

@phealy

Copy link
Copy Markdown
Contributor Author

Fixed the operator migration-window e2e expectation in 6d86219. With user approval, the test now restarts the real controller with the orphan already present and verifies the production startup repair deletes it while preserving current and legacy Site slices. The real kind-based focused e2e passed locally using the Podman provider; test compilation and scoped formatting/lint also pass.

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 work tracking and deletion-based repair affect network membership and warrant final human validation.

0 open findings

🧠 Review effort: Balanced

@phealy
Patrick W. Healy (phealy) marked this pull request as ready for review October 16, 2026 23:50
@phealy
Patrick W. Healy (phealy) requested a review from a team October 16, 2026 23:50
stacked auto-merge was automatically disabled October 23, 2026 23:31

Auto-merge was disabled for another pull request in the stack

@phealy
Patrick W. Healy (phealy) added this pull request to the merge queue Oct 23, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 23, 2026
Base automatically changed from phealy/net-api-controller-noops to main October 23, 2026 23:47
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
Restart the real controller with the orphan already present and retain checks for current and legacy Site slices.

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

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.

3 participants