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
daemon: Enable device auto detection for host-fw when BPF NodePort is disabled #12050
Conversation
test-me-please |
test-me-please |
c0ea924
to
772c580
Compare
test-me-please |
@brb Smoke test failed again :-) |
772c580
to
37531ba
Compare
It was failing due to missing operator image. I've rebased against the master, let's see whether it has been fixed. |
Just for DRY. Also, make the log messages in initKubeProxyReplacementOptions() more consistent and less ambiguous. Signed-off-by: Martynas Pumputis <m@lambda.lt>
Move all the checks which do not depend on option.Config.{DirectRoutingDevice,Devices} above the device auto detection. Signed-off-by: Martynas Pumputis <m@lambda.lt>
We no longer consider that the first device among option.Config.Devices is going to be used for direct routing. Signed-off-by: Martynas Pumputis <m@lambda.lt>
d44860e
to
239f0c1
Compare
The second helper function is supposed to call the device detection, and the third to finish the initialization. It's required, because the host-fw also requires the auto detection, and extending the former helper to consider host-fw is a bit brittle, as any premature return would prevent from the auto-detection for the host-fw. Signed-off-by: Martynas Pumputis <m@lambda.lt>
test-me-please |
|
||
// detectDevicesForNodePortAndHostFirewall tries to detect bpf_host devices | ||
// (if needed). | ||
func detectDevicesForNodePortAndHostFirewall(strict bool) { |
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.
This is probably out of scope of this PR, but do you think it would be possible for us to call all these init functions with config as an argument instead of using global one explicitely? This would make it possible to unit test them to make sure that we don't mess things up, or is there anything aside from config manipulation that makes it unfeasible?
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.
Good idea! Added to my TODO list.
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.
Agree, would be nice to get some test coverage on this entire part of the code (i.e. dependent option handling)
Enable the device auto-detection when BPF NodePort is disabled, but host-fw is enabled. Signed-off-by: Martynas Pumputis <m@lambda.lt>
239f0c1
to
f536867
Compare
test-me-please |
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 with two small nits. Feel free to ignore or defer to follow-up.
len(option.Config.Devices) == 1 | ||
} | ||
|
||
// disableNodePort disables BPF NodePort and friends who are dependent from |
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.
Nit:
// disableNodePort disables BPF NodePort and friends who are dependent from | |
// disableNodePort disables BPF NodePort and friends which are dependent on |
iface, iface) | ||
} | ||
disableNodePort() | ||
log.Warn(fmt.Sprintf("%s. Disabling BPF NodePort.", err)) |
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.
Consider using log.WithError(err)
here?
log.Warn(fmt.Sprintf("%s. Disabling BPF NodePort.", err)) | |
log.WithError(err).Warn("Disabling BPF NodePort.") |
@tklauser I've added those two to my TODO list (CI passed, don't want to re-run). |
This PR:
initKubeProxyReplacementOptions()
, and splits it into two helpers.Reviewable per commit.