Skip to content

fix(gateway): watch NetworkGateway from NetworkRuleReconciler - #371

Merged
privateip merged 1 commit into
mainfrom
fix/networkrule-watch-gateways
Aug 13, 2026
Merged

fix(gateway): watch NetworkGateway from NetworkRuleReconciler#371
privateip merged 1 commit into
mainfrom
fix/networkrule-watch-gateways

Conversation

@ecv

@ecv ecv commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

A rule created before any gateway node has registered is marked not accepted, correctly, and then forgotten. Nothing re-examined it when the nodes arrived, because the rule reconciler watched only rules. It waited for the informer resync, ten hours by default, and stayed out of every gateway's rule table for that whole window.

On a cluster coming up in the usual order, that reads as broken: rules exist, nodes exist, no traffic flows, nothing explains the wait.

The rule reconciler now watches gateways too, and maps a gateway change to the rules in its namespace. That is the mirror image of the watch the gateway reconciler already has in the other direction, and the same deliberate broadcast, since a rule names no gateway and every rule's acceptance depends on the namespace's whole node pool.

The comment on that path used to say a gateway event re-triggers the rule and then, in the same sentence, that it relies on the resync. It now describes what the code does.

Not in scope

The second half of #367, where withdrawal misses advertisements belonging to nodes that have since left the namespace, is untouched. That needs owner references or a label selector rather than rebuilding names from current membership, which is a design change worth its own PR. The issue stays open for it.

Test plan

  • task lint
  • task build
  • task test:unit, including a new case: a rule parked with no gateway nodes is enqueued when a gateway appears, and then accepted with a primary node
  • task test:e2e

CI is the gate; this machine cannot build the module.

Note this reconciler is not registered by any binary on main yet. That arrives with #352, and the RBAC that lets it watch gateways arrives with #354, so there is no runtime behavior change until both land.

Related to #367

A NetworkRule created before any gateway node registers parks at
Accepted=False with reason NoGatewayNodes. Nothing re-examined it
afterwards: SetupWithManager was For(&NetworkRule{}) only, so no
NetworkGateway event reached this reconciler and no requeue was
scheduled. Since NetworkGatewayReconciler skips rules that are not
Accepted, the rule stayed unprogrammed until the informer's periodic
resync (10 hours by default).

Watch NetworkGateway here and map a gateway change to every
NetworkRule in its namespace, the mirror image of the NetworkRule
watch NetworkGatewayReconciler already has. The rule is re-examined
as soon as a gateway node registers.

Also rewrite the zero-nodes comment, which claimed both that the next
NetworkGateway event re-triggers the rule and that the reconciler
relies on the periodic resync.

Related to #367
@ecv
ecv marked this pull request as ready for review August 13, 2026 01:51
@ecv
ecv requested a review from a team as a code owner August 13, 2026 01:51
@ecv
ecv requested a review from privateip August 13, 2026 01:51
@privateip
privateip merged commit 0442fc3 into main Aug 13, 2026
14 checks passed
@privateip
privateip deleted the fix/networkrule-watch-gateways branch August 13, 2026 14:48
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