Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modularize ipcache BPF listener #29194

Merged
merged 6 commits into from Nov 27, 2023

Conversation

giorio94
Copy link
Member

@giorio94 giorio94 commented Nov 15, 2023

Convert the ipcache BPF listener module into a cell. Additionally drop the existing ipcache map garbage collection logic, which turned out to be buggy and not really effective, as well as not necessary. Please review commit by commit, and refer to the individual commit messages for additional details.

Related: #28004

@giorio94 giorio94 added kind/cleanup This includes no functional changes. area/daemon Impacts operation of the Cilium daemon. release-note/misc This PR makes changes that have no direct user impact. labels Nov 15, 2023
@giorio94
Copy link
Member Author

/test

@giorio94 giorio94 marked this pull request as ready for review November 15, 2023 15:00
@giorio94 giorio94 requested review from a team as code owners November 15, 2023 15:00
@giorio94 giorio94 force-pushed the mio/ipcache-listener-modularization branch from ad19eae to 7c663f3 Compare November 16, 2023 15:15
They are leftovers from 84901e4 ("bpf, ipcache: unconditionally assume
LPM trie delete/dump support") and not used anymore. Hence, let's just
drop them as a preparatory step to convert the listener into a cell.

Signed-off-by: Marco Iorio <marco.iorio@isovalent.com>
Break the daemon dependency, as a preparation for the subsequent
conversion of the listener into a cell.

Signed-off-by: Marco Iorio <marco.iorio@isovalent.com>
Crafting a dedicated unit test revealed that this logic was broken,
because we considered an entry for deletion if and only if it the
given prefix was not found in the ipcache struct, and the source
of the corresponding identity was either kvstore or local. But
when the prefix is not found, we retrieve the default value of
the identity type, which will never match the source filter.

Now, considering that:

* the ipcache map gets recreated from scratch at every agent restart,
* the garbage collection logic was triggered only when either Cilium
  was configured in kvstore mode or was connected to at least one
  remote cluster,
* the etcd watcher already implements a dedicated logic to replay
  possibly missed deletion events both after relist and in case of
  complete reconnection,
* fixing this logic would likely expose us to even more headaches,
  given that we may remove entries when the ipcache is not yet
  fully synchronized from the other sources, causing the removal
  of valid entries and the disruption of existing connections,

let's just remove it.

Signed-off-by: Marco Iorio <marco.iorio@isovalent.com>
Following the removal of the only non-empty implementation of
OnIPIdentityCacheGC, let's simplify the IPIdentityMappingListener
interface by dropping it altogether. Let's also remove the
ForEachListener ipcache method, which is no longer used.

Signed-off-by: Marco Iorio <marco.iorio@isovalent.com>
This makes explicit which methods are actually used and allows
swapping implementations, e.g., for mocking purposes.

Signed-off-by: Marco Iorio <marco.iorio@isovalent.com>
Convert the ipcache bpf listener into a cell, to increase modularity and
remove its initialization from the main daemon start-up logic. The main
difference being that now we register it into the ipcache module using
AddListener, instead of SetListeners. While this doesn't cause any
differences at the moment (given that we are anticipating the
initialization and the ipcache is still empty at that point), it
prevents possible future ordering issues if any other invoke function
also calls AddListener, as SetListeners would blindly override any
registered listener.

Signed-off-by: Marco Iorio <marco.iorio@isovalent.com>
@giorio94 giorio94 force-pushed the mio/ipcache-listener-modularization branch from 7c663f3 to 92dc5bc Compare November 16, 2023 17:46
@giorio94
Copy link
Member Author

Rebased onto main, let's see if that makes CI happier.

@giorio94
Copy link
Member Author

/test

@giorio94
Copy link
Member Author

@brb @jrajahalme Ping

Copy link
Member

@brb brb left a comment

Choose a reason for hiding this comment

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

The WG changes LGTM, thanks.

Copy link
Member

@jrajahalme jrajahalme left a comment

Choose a reason for hiding this comment

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

Nice to review PRs that mostly remove dead code :-)

@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Nov 27, 2023
@aanm aanm added this pull request to the merge queue Nov 27, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 27, 2023
@aanm aanm added this pull request to the merge queue Nov 27, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 27, 2023
@aanm aanm merged commit 0f97056 into cilium:main Nov 27, 2023
61 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/daemon Impacts operation of the Cilium daemon. kind/cleanup This includes no functional changes. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/misc This PR makes changes that have no direct user impact.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants