-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Add table for node addresses #28962
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
Add table for node addresses #28962
Conversation
1483f90
to
cc0f561
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.
I think there's a bug when there's a primary address with a scope > scopeMax, followed by secondary addresses which have smaller scope. But I might just be missing context on what that scope means and that might be an impossible case.
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.
Looks good overall, I think having a table for this will be useful. I'm neither an expert on statedb, nor on node addressing
cc0f561
to
5b6d68b
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.
LGTM! (as mentioned before however, I'm a low-confidence reviewer both for statedb and node addresses)
5b6d68b
to
fb34639
Compare
/test |
fb34639
to
ea9d9b2
Compare
Add support for "*cidr.CIDR" and "[]*cidr.CIDR" in config cells: type ExampleConfig { ExampleCIDRs []*cidr.CIDR } func (def ExampleConfig) Flags(flags *pflag.FlagSet) { flags.StringSlice("example-cidrs", def.ExampleCIDRs, "Set the example CIDRs") } // --example-cidrs=1.2.3.4/24,2001:db8::/64 Signed-off-by: Jussi Maki <jussi@isovalent.com>
Add 'Secondary' to 'DeviceAddress' struct to allow readers to sort the addresses by scope & secondary when picking relevant addresses. 'Secondary' is the same as IF_A_SECONDARY. Signed-off-by: Jussi Maki <jussi@isovalent.com>
To provide modules access to the evolving set of local node's addresses, add Table[NodeAddress] that derives from the low-level Table[*Device] and applies the Cilium-specific heuristics to pick which addresses are considered host IPs and which are used for NodePort and BPF masquerading. To allow user to expand the set of addresses used for NodePort, add the configuration flag "--nodeport-addresses" for specifying from which CIDRs the NodePort addresses are allowed. This mirrors exactly the same kube-proxy flag. If user does not specify this, then the default behavior remains, which is to pick the first IPv4 and IPv6 address of each native device. Signed-off-by: Jussi Maki <jussi@isovalent.com>
The addition of the check to see if routes exists without corresponding device to the devices controller tests caused it to stop the test too early before the test case had passed. As the tests were faulty they didn't catch the bug where the 'Selected' status wasn't rechecked and thus the 'veth-with-default-route' test passed when it shouldn't have. Fix this by always checking if selected status updates. Fixes: 60fd85a ("devices: Flush routes on device delete") Signed-off-by: Jussi Maki <jussi@isovalent.com>
ea9d9b2
to
96e1022
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.
LGTM now! I think the netip stuff would be nice, but won't block the PR on it.
/test |
To provide modules access to the evolving set of local node's addresses,
add Table[NodeAddress] that derives from the low-level Table[*Device] and
applies the Cilium-specific heuristics to pick which addresses are considered
host IPs and which are used for NodePort and BPF masquerading.
To allow user to expand the set of addresses used for NodePort, add the
configuration flag "--nodeport-addresses" for specifying from which CIDRs
the NodePort addresses are allowed. This mirrors exactly the same kube-proxy
flag. If user does not specify this, then the default behavior remains, which
is to pick the first IPv4 and IPv6 address of each native device.
This PR is one of several that aims to replace the global maps in
pkg/node/address.go
containing the NodePort and BPF masquerade addresses with a table that can be watched for changes and allow dynamic reconfiguration when the addresseschange. The next PR will adapt
NodeAddressing
to accessTable[NodeAddress]
and removes the global maps frompkg/node
.Further PRs down the line will switch from
NodeAddressing
toTable[NodeAddress]
and start reconciling on changes.