-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
ipam: Fix invalid PodCIDR in CiliumNode in ENI/Azure/MultiPool mode #26663
Merged
aditighag
merged 2 commits into
cilium:main
from
gandro:pr/gandro/fix-cilium-node-pod-cidr
Aug 29, 2023
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
IIUC, on EKS & AKS, we would install a route using the internal auto-generated IPv4/IPv6AllocRange. Do we have an idea of the potential consequences of that? The second commit suggests that the auto-generated CIDR could clash with real CIDR, although unlikely.
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.
So yes, before this PR installed a route for the auto-generated pod CIDR. It used an auto-generated pod CIDR, because that's Cilium's ancient fall-back if no pod CIDR is configured. That auto-generated pod CIDR is not used anywhere (see also #27018) and we're planning to eventually remove it, since it causes confusion for both engineers and users.
Particularly in EKS and AKS, IPs are not allocated from any pod CIDR (be it auto-generated or manually configured), and so using a node's pod CIDR in AKS or EKS is making assumptions about the IP range that does not hold true. By installing a route for each node's (auto-generated) pod CIDR (as we did before the PR), we routed all traffic belonging to those auto-generated CIDRs to the encrypt device.
I'm not sure, what the consequence of this were. We have not received bug reports about this, I think mostly because the auto-generated CIDR is by design unlikely to clash with a real CIDR. Since the encrypt device is probably also the default egress device, the route might also not have affected any issues for CIDRs that were routable on the default egress device anyway.
In any case, my primary motivation for this PR is the clean up unconditional uses of "pod CIDR" in the agent code, because such code will not be compatible with pod-CIDR-less IPAM modes such as EKS/AKS or Multi-Pool. IPSec already has "subnet encryption" as a pod CIDR replacement, but for some reason it still unconditionally used the pod CIDR, which this PR attempts to fix.
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 did a quick test on EKS to simulate the impact of a clash between the auto-generated CIDR and the pod subnet. Pod subnet was 192.168.0.0/16 and I manually installed a route like the one removed in this PR but with CIDR 192.168.128.0/17.
That caused some existing connections to be interrupted and prevented me from running the connectivity tests. I didn't debug further. There were no drops reported by Cilium or XFRM errors.
I have no idea how unlikely it is for the CIDRs to clash, but maybe we need to add a release note (something like below or can we make the "potential" more precise?) and backport to just v1.14?
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.
Awesome, thanks for that test 🚀
In the end, it depends on user configuration. The auto-generated CIDR is of the form "10.x.0.0/16" where x is derived from the node's IP. So I think clashes can happen - but I'm not aware of any bug reports, probably because most users are using IPs in the range of "10.0.0.0/16".
I think we can absolutely backport this to v1.14. I removed the backport label because there have not been bug reports and this has likely been present for years, but given the risk should be low, it does fit our backporting policy.