-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Validate when Cilium is in ENI mode that IPv4 is enabled #11328
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
Conversation
Please set the appropriate release note label. |
pkg/aws/eni/routing/routing.go
Outdated
IP: ip, | ||
Mask: net.CIDRMask(32, 32), | ||
} | ||
if (option.Config.IPAM == option.IPAMENI) && (ip.To4() != nil) { |
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.
if you invert this if statement this function can return earlier and we can avoid touching the remaining code of this function.
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.
agreed
pkg/aws/eni/routing/routing.go
Outdated
IP: ip, | ||
Mask: net.CIDRMask(32, 32), | ||
} | ||
if (option.Config.IPAM == option.IPAMENI) && (ip.To4() != nil) { |
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.
if you invert this if statement this function can return earlier and we can avoid touching the remaining code of this function.
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.
agreed
d4a6ad0
to
cdcd948
Compare
test-me-please Edit: vagrant failure https://jenkins.cilium.io/job/Cilium-PR-Ginkgo-Tests-Validated/19499/ |
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 for the PR! Overall, I think the changes are good. There's currently this PR pending which should be merging pretty soon. I'd like to get that in before merging this. #11208
I am wondering though if just validating whether we have option.Config.EnableIPv4
and option.Config.IPAM == option.IPAMENI
at the daemon level is enough. We could just have it be fatal if the above condition does not hold. 🤔 /cc @aanm
@joestringer I recall we had a conversation about this in another PR. Any thoughts?
restart-ginkgo Edit: weird flake with vagrant index
|
@christarazi @joestringer At the daemon level there is already a check between IPAMMode and IPv6 and throws an error if IPv6 is configured along with IPAMMode, so I think indirectly it is testing for the IPv4 with IPAMMode there. But there was comment in this bug that said that we are not validating in the calling function. Let me know your thoughts. Also I had added couple of comments in two files where we can split. Let me if that is required. |
pkg/aws/eni/routing/routing.go
Outdated
@@ -139,6 +143,9 @@ func Install(ip net.IP, info *RoutingInfo, mtu int, masq bool) error { | |||
// with this ID, and because this table ID equals the ENI ifindex, it's stable | |||
// to rely on and therefore can be reused. | |||
func Delete(ip net.IP) error { | |||
if (option.Config.IPAM == option.IPAMENI) && (ip.To4() == nil) { |
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.
Same as the other similar spot.
restart-ginkgo |
If we're already validating the commandline arguments to ensure that this case won't be hit, then I think we're satisfying the main concern here. It's slightly nicer to make sure that this errors out if the wrong address type is specified just to future-proof a bit but I wouldn't expect commandline argument combinations to be validated this deep; it should be occurring much earlier in the initial daemon configuration checks. |
2d4f5c5
to
cb84e53
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.
Some minor nits. There also seems to be a conflict, please rebase.
6d32e8f
to
e99a9e2
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.
Looking good, a few minor comments. Also, please add test coverage now that there's an extra case for both functions.
9c0e709
to
e69fa05
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.
Just a minor change and we should be good to go!
The patch checks the Cilium ENI mode and IPv4 when ENI functions are called. Fixes: cilium#11272 Signed-off-by: Swaminathan Vasudevan <svasudevan@suse.com>
e69fa05
to
f62a4a0
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.
🎉
test-me-please |
Added backport label as I'd like to backport this to 1.7 since it'll be a branch we support for a while and this PR has changed code which was recently backported, so it'll be good to keep the divergence to a minimum. |
The patch checks the Cilium ENI mode and IPv4 when ENI functions
are called.
Fixes: #11272
Signed-off-by: Swaminathan Vasudevan svasudevan@suse.com