Skip to content

fix: Hear a network's deletion at once where no binding declares it - #846

Merged
vvoytovych merged 2 commits into
mainfrom
fix/presence-hears-network-deletion-at-once
Nov 3, 2026
Merged

vvoytovych merged 2 commits into
mainfrom
fix/presence-hears-network-deletion-at-once

Conversation

@vvoytovych

@vvoytovych vvoytovych commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

A presence that no hub binding declares heard its Network's deletion only at its next resync, up to a minute later (the wait): staging's kept-interface test measured 65 s (#829). The replicator mirrors every Network onto the hub (the mirror) and deletes the mirror as soon as the Network is deleted (its delete). The presence controller now watches those mirrors and maps a mirror's deletion to the hub copies of the network's contexts in the same namespace, as it maps an interface copy to its presence; the resync stays for an event that never arrives.

Built on #844, the restart fix, now on main: the map reads the hub's context copies from the informer #844 added.

Changes

change file
The presence controller watches Networks on the hub. A mirror's deletion, or the first update of a deletion a finalizer holds, maps to the hub copies of the network's contexts in its namespace networkpresence_controller.go

Corner cases

case what happens proof
A presence in its grace, its Network deleted Marked and ended within seconds, with the resync set to an hour TestANetworkDeletionReachesAPresenceNothingDeclaresAtOnce
A network in two locations Both presences come back TestANetworkMirrorMapsToItsPresencesInItsNamespace
Another network in the namespace, or the same name in another project Not brought back the same test
A mirror's creation, which every start lists, or its edit Brings nothing back TestOnlyANetworkMirrorGoingBringsItsPresencesBack
A mirror whose deletion a finalizer holds Its first update counts the same test
A mirror deleted while its Network lives The presence reads the Network, which is not being deleted, and marks nothing TestNetworkPresenceMarksOnlyTheContextOfTheNetworkBeingDeleted and the reconcile's own read
The mirror's deletion arrives before the project's cache shows the Network deleting The presence waits, and its resync marks it named, not tested

Cost

  • One informer of Networks on the hub, one object per network. The replicator already watches them there, with the same identity, so no permission is new; the marker records it.
  • On a deletion, one cached list of the namespace's context copies.

Test plan

  • On the restart fix's branch the deletion test fails, with the resync at an hour, and it passes with the change.
  • A planted defect per case turns its test red, 7 of 7, and golangci-lint v2.15.0 passes.
  • On kind, with the NSO manager restarted and its new pod running the presence controller, a presence held past its grace was marked 0.3 s after its Network's deletion, 3 of 3, and the Network went about 3 s after it. Without this change it was marked at the next resync, 37 s and 60 s after.
  • On staging, after the merge, kept_test.py's undeclared network went 4 s after its delete, where it took 65 s on fix: Name a cell's network contexts from the location it serves #833's build.

Closes #829

@vvoytovych vvoytovych self-assigned this Nov 3, 2026
Base automatically changed from fix/presence-reconciles-every-presence-on-start to main November 3, 2026 10:01
A presence that no hub binding declares hears its network's deletion
only at its next resync. With the resync at an hour, this test fails on
the restart fix's branch: the network waits for its context.
The replicator mirrors every Network onto the hub and deletes the mirror
as soon as the Network is deleted. The presence controller now watches
those mirrors and maps a mirror's deletion, or the first update of a
deletion a finalizer holds, to the hub copies of the network's contexts
in the mirror's namespace, as it maps an interface copy to its presence.
The resync stays, for an event that never arrives.

Closes #829
@vvoytovych
vvoytovych force-pushed the fix/presence-hears-network-deletion-at-once branch from e06e37a to 89643f8 Compare November 3, 2026 10:09
@vvoytovych
vvoytovych marked this pull request as ready for review November 3, 2026 13:01
@vvoytovych
vvoytovych requested a review from a team as a code owner November 3, 2026 13:01
@vvoytovych
vvoytovych merged commit 202bbf0 into main Nov 3, 2026
11 checks passed
@vvoytovych
vvoytovych deleted the fix/presence-hears-network-deletion-at-once branch November 3, 2026 13:06
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.

Hear a network's deletion at once where no binding declares it

3 participants