Skip to content

Conversation

joamaki
Copy link
Contributor

@joamaki joamaki commented Aug 4, 2025

As a first step towards replacing LocalNodeStore and NodeManager with a StateDB table of nodes, implement LocalNodeStore as a Table[*node.LocalNode]. While the longer term goal would be a unified table of local and remote nodes this needs more thinking around e.g. how the types.Node would need to evolve etc. So opting for a small incremental change first.

This has the immediate benefit that observers of LocalNodeStore can no longer block the updates to it making it much safer. Most recently we hit this in #40095 (comment) where innocent rate limiting effectively throttled LocalNodeStore update throughput to 1 per second. With this change we'd remove this foot gun.

Another benefit is that we can inspect the local node in cilium shell via 'db/show local-node' (-f json for full contents).

Further motivation behind this change is to simplify multiple control loops in e.g. pkg/loadbalancer that are almost purely around tables with the LocalNodeStore being the exception. Examples of this can be found from #40998, #41000 and #41001 where we can remove clunky atomic pointer side channels.

The last commit fixed flakyness in the wireguard agent tests where IPCache was configured without IdentityAllocator and thus sometimes the test hit the label injection with the local node's prefixes causing it to fail to bump revision and thus causing peer GC to be stuck. Looks like the LocalNodeStore changes here made it easier to trigger.

stress -p 1 go test ./pkg/... -test.count 1 said 1h1m35s: 84 runs so far, 3 failures (3.57%), 1 active with the 3 failures all being a workqueue goroutine leak that #41129 would fix, so doesn't look like there are other obvious flakes due to this change.

@joamaki joamaki added the release-note/misc This PR makes changes that have no direct user impact. label Aug 4, 2025
@github-actions github-actions bot added the sig/policy Impacts whether traffic is allowed or denied based on user-defined policies. label Aug 4, 2025
@joamaki joamaki requested a review from dylandreimerink August 4, 2025 10:10
@joamaki joamaki force-pushed the pr/joamaki/table-node-local-only branch 3 times, most recently from 58c5fc3 to 0c9cb29 Compare August 5, 2025 15:21
@joamaki
Copy link
Contributor Author

joamaki commented Aug 6, 2025

/test

@joamaki
Copy link
Contributor Author

joamaki commented Aug 7, 2025

/test

@joamaki joamaki marked this pull request as ready for review August 7, 2025 12:53
@joamaki joamaki requested review from a team as code owners August 7, 2025 12:53
@joamaki joamaki force-pushed the pr/joamaki/table-node-local-only branch from c8d89f4 to d20e91d Compare August 7, 2025 13:57
@joamaki
Copy link
Contributor Author

joamaki commented Aug 7, 2025

/test

Copy link
Contributor

@smagnani96 smagnani96 left a comment

Choose a reason for hiding this comment

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

Looks good for encryption/wireguard 👍🏼

@joamaki joamaki force-pushed the pr/joamaki/table-node-local-only branch from d20e91d to a60f457 Compare August 8, 2025 13:55
@joamaki joamaki requested a review from bimmlerd August 8, 2025 13:55
@joamaki
Copy link
Contributor Author

joamaki commented Aug 8, 2025

/test

@joamaki joamaki force-pushed the pr/joamaki/table-node-local-only branch from 01172da to f4d850f Compare August 12, 2025 14:49
@joamaki
Copy link
Contributor Author

joamaki commented Aug 12, 2025

/test

@joamaki joamaki force-pushed the pr/joamaki/table-node-local-only branch from f4d850f to 98da628 Compare August 13, 2025 07:41
@joamaki
Copy link
Contributor Author

joamaki commented Aug 13, 2025

/test

Copy link
Member

@sayboras sayboras left a comment

Choose a reason for hiding this comment

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

Looks good for owned files 👍

@joamaki joamaki force-pushed the pr/joamaki/table-node-local-only branch from 98da628 to 0350388 Compare August 14, 2025 11:29
@joamaki
Copy link
Contributor Author

joamaki commented Aug 14, 2025

/test

@joamaki joamaki force-pushed the pr/joamaki/table-node-local-only branch from 0350388 to 642fff7 Compare August 15, 2025 09:11
@joamaki
Copy link
Contributor Author

joamaki commented Aug 15, 2025

/test

@joamaki joamaki force-pushed the pr/joamaki/table-node-local-only branch from 642fff7 to 3c1b027 Compare August 15, 2025 10:32
@joamaki
Copy link
Contributor Author

joamaki commented Aug 15, 2025

/test

@joamaki joamaki force-pushed the pr/joamaki/table-node-local-only branch from 3c1b027 to 44905a8 Compare August 15, 2025 12:34
@joamaki joamaki force-pushed the pr/joamaki/table-node-local-only branch from 44905a8 to 266a9be Compare August 15, 2025 14:30
As the first step of transition towards a unified table of nodes,
add a StateDB table for the local node which will allow us to implement
LocalNodeStore with it.

The type is 'TempLocalNode' so we can replace the existing 'LocalNode'
with it in the next commit.

Eventually we would have also the remote nodes in this table, but until
then to avoid confusion the table is named "local-node" and the type is
'LocalNode'. We'll also need to rethink the role of 'types.Node' which is
the serialization struct for KVStore and we likely want to eventually decouple
that from our internal representation. Baby steps...

Signed-off-by: Jussi Maki <jussi@isovalent.com>
As a first step towards replacing LocalNodeStore and NodeManager with
a StateDB table of nodes, implement LocalNodeStore using the Table[*node.LocalNode].

The 'LocalNode' type now has the attributes relevant only for the local node
behind 'LocalNodeInfo' to make transitioning this into a table of both local
and remote nodes easier. Few tests were also adopted to use 'Eventually' since
now 'LocalNodeStore.Observe' is not synchronous to calls to 'LocalNodeStore.Update'.

This has the immediate benefit that observers of LocalNodeStore can no
longer block the updates to it and that we can inspect the local node
in cilium shell via 'db/show local-node'.

Signed-off-by: Jussi Maki <jussi@isovalent.com>
Without the IdentityAllocator the test sometimes fails in label injection
due to unset local identity allocator if `nodeDiscovery.StartDiscovery()`
has managed to enqueue the prefixes of the local node.

Signed-off-by: Jussi Maki <jussi@isovalent.com>
@joamaki joamaki force-pushed the pr/joamaki/table-node-local-only branch from 266a9be to 249292a Compare August 19, 2025 09:04
@joamaki
Copy link
Contributor Author

joamaki commented Aug 19, 2025

/test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/misc This PR makes changes that have no direct user impact. sig/policy Impacts whether traffic is allowed or denied based on user-defined policies.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants