Skip to content

refactor(sdk): shared WatchSet, one watch and cache per kind - #524

Merged
ebourgeois merged 1 commit into
mainfrom
refactor/phaseb2
Oct 4, 2026
Merged

ebourgeois merged 1 commit into
mainfrom
refactor/phaseb2

Conversation

@ebourgeois

Copy link
Copy Markdown
Contributor

refactor(sdk): shared WatchSet, one watch and cache per kind

…9 §3, roadmap 01 Phase B step B2)

One watcher per (kind, namespace target) in sdk::watch keeps the store and
fans out every InitApply/Apply/Delete to subscribed controllers
(async-broadcast: backpressure, never loss; late subscribers get the store
replayed; ended streams restart with backoff; watch metrics). Controllers
consume it via for_stream / watches_stream / owns_stream (kube-runtime
unstable-runtime-stream-control, the only unstable feature enabled);
uncached owned kinds keep ordinary watches. About 57 -> 19 watch
connections cluster-wide. ADR-0009 §3 amended first: kube's store_shared
never dispatches Delete events, which .owns() and the zone controller need.

Fix: the zone controller watched Endpoints with Api::all in every mode,
which namespace-restricted RBAC does not grant, so a replaced BIND9 pod
waited for the zone's requeue. Endpoints of bindy's Services are now a
label-selected WatchSet kind, one watch per namespace; the zone controller
subscribes to Endpoints and Bind9Instance across all namespaces
(subscribe_all) for cross-namespace zones. No RBAC change.

Tooling: kind targets run with KUBECONFIG set to a dedicated
~/.kube/kind-bindy.yaml (KIND_KUBECONFIG; default path in CI), so a kind
run can no longer write into the caller's kubeconfig.

Docs: ADR-0009 amended, roadmap 01 and ROADMAPS.md, architecture
watching section, threat model v1.8 (M-38, residual risk 7), testing guide.

1623 tests pass (1609 + 14 new).

Signed-off-by: Erick Bourgeois <erick@jeb.ca>
@ebourgeois
ebourgeois merged commit e2d2ed0 into main Oct 4, 2026
51 checks passed
@ebourgeois
ebourgeois deleted the refactor/phaseb2 branch October 4, 2026 10: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.

1 participant