-
Notifications
You must be signed in to change notification settings - Fork 3.4k
iptables: Manage IP sets independently with the stateDB reconciler #31099
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
iptables: Manage IP sets independently with the stateDB reconciler #31099
Conversation
/test |
3196dd5
to
1da753e
Compare
1da753e
to
e8c781a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did a review because I was curious. Some nits, otherwise looks good to me
c55c6a6
to
75daa3d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, LGTM! Two non-blocking comments only.
Add an immutable set data structure for use in objects stored in StateDB tables. The ImmSet[T] is useful when storing a relatively small set of items (1-1000). Implemented as a sorted slice. Mutations of the set clone the slice and lookups are implemented as binary searches. The benefit of this is a packed presentation, especially for value types (e.g. netip.Addr) which will cause less overhead for GC. Downside is that inserts and deletes become expensive when there are many items. Signed-off-by: Jussi Maki <jussi@isovalent.com> Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
Add a stateDB table to store IP sets. This will be used in later commits to build an IP sets manager able to dynamically reconcile sets with v4 and v6 node IPs. Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
Add an independent cell to manage IP sets and reconcile them dynamically through the stateDB generic reconciler. The cell manages only two different sets, one related to the Node IPv4 addresses and the other one related to the Node IPv6 addresses. Other sets are not touched in any way. When IP sets are disabled, the IP sets manager tries to clean both Cilium managed IP sets at startup, to avoid leaving stale entries from previous runs. When IP sets are enabled, the IP sets manager exports two methods to add and remove IPs from a named set, respectively. The sets are updated in the relative stateDB table and the kernel state reconciled later using the `ipset` utility. The cell will be plumbed in the iptables cell in a later commit. Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
Remove IP sets management from iptables manager and use the new cell based on the stateDB reconciler. The node manager has been changed to use the new ipset manager methods. Also, a fake version of the cell has been added to mock the ipset manager in controlplane testing. Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
ifName is not needed to install masquerading rules, hence remove it from the function signature. Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
75daa3d
to
250a17f
Compare
Removing some reviewers whose codeowners have already been covered. |
/test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CODEOWNERS LGTM
This PR needs approval from current @cilium/tophat, as Dylan dropped from the team. |
Add an independent cell to manage IP sets and reconcile them dynamically through the stateDB generic reconciler.
The cell manages only two different sets, one related to the Node IPv4 addresses and the other one related to the Node IPv6 addresses. Other sets are not touched in any way.
When IP sets are disabled, the IP sets manager tries to clean both Cilium managed IP sets at startup, to avoid leaving stale entries from previous runs.
When IP sets are enabled, the IP sets manager exports two methods to add and remove IPs from a named set, respectively. The sets are updated in the relative stateDB table and the kernel state reconciled later using the
ipset
utility.This is a required step in preparation for the iptables manager refactoring that allows to react to devices and local node info changes. A PoC has already been developed and can be seen here.
Note to the reviewers: please review each commit individually.