Skip to content
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

Merged
merged 5 commits into from Jun 16, 2020

Conversation

brb
Copy link
Member

@brb brb commented Jun 12, 2020

This PR:

  • Restructures initKubeProxyReplacementOptions(), and splits it into two helpers.
  • Enables device auto detection for host-fw.
  • Fixes direct routing iface in the DSR check.

Reviewable per commit.

@brb brb added pending-review area/daemon Impacts operation of the Cilium daemon. dont-merge/needs-rebase This PR needs to be rebased because it has merge conflicts. release-note/misc This PR makes changes that have no direct user impact. labels Jun 12, 2020
@brb brb requested review from pchaigno and a team June 12, 2020 13:17
@maintainer-s-little-helper maintainer-s-little-helper bot added this to In progress in 1.8.0 Jun 12, 2020
@brb brb removed the dont-merge/needs-rebase This PR needs to be rebased because it has merge conflicts. label Jun 12, 2020
@brb
Copy link
Member Author

brb commented Jun 12, 2020

test-me-please

@pchaigno
Copy link
Member

@brb Smoke test failed 😉 (and took 40min to report because of #11976).

@coveralls
Copy link

coveralls commented Jun 12, 2020

Coverage Status

Coverage increased (+0.02%) to 37.061% when pulling f536867 on pr/brb/autodev-hostfw into f3b474a on master.

@maintainer-s-little-helper maintainer-s-little-helper bot added this to Needs backport from master in 1.8.0 Jun 12, 2020
daemon/cmd/daemon_main.go Show resolved Hide resolved
daemon/cmd/daemon_main.go Show resolved Hide resolved
daemon/cmd/daemon_main.go Outdated Show resolved Hide resolved
@brb
Copy link
Member Author

brb commented Jun 12, 2020

test-me-please

@brb brb requested a review from pchaigno June 12, 2020 15:53
daemon/cmd/daemon_main.go Outdated Show resolved Hide resolved
@brb
Copy link
Member Author

brb commented Jun 15, 2020

test-me-please

@pchaigno
Copy link
Member

@brb Smoke test failed again :-)

@brb
Copy link
Member Author

brb commented Jun 15, 2020

@brb Smoke test failed again :-)

It was failing due to missing operator image. I've rebased against the master, let's see whether it has been fixed.

brb added 3 commits June 15, 2020 12:22
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>
@brb brb force-pushed the pr/brb/autodev-hostfw branch 3 times, most recently from d44860e to 239f0c1 Compare June 15, 2020 10:56
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>
@brb
Copy link
Member Author

brb commented Jun 15, 2020

test-me-please


// detectDevicesForNodePortAndHostFirewall tries to detect bpf_host devices
// (if needed).
func detectDevicesForNodePortAndHostFirewall(strict bool) {
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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>
@brb brb requested a review from a team as a code owner June 15, 2020 13:02
@brb
Copy link
Member Author

brb commented Jun 15, 2020

test-me-please

Copy link
Member

@tklauser tklauser left a 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit:

Suggested change
// 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))
Copy link
Member

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?

Suggested change
log.Warn(fmt.Sprintf("%s. Disabling BPF NodePort.", err))
log.WithError(err).Warn("Disabling BPF NodePort.")

@maintainer-s-little-helper maintainer-s-little-helper bot added ready-to-merge This PR has passed all tests and received consensus from code owners to merge. and removed ready-to-merge This PR has passed all tests and received consensus from code owners to merge. labels Jun 15, 2020
@brb
Copy link
Member Author

brb commented Jun 15, 2020

LGTM with two small nits. Feel free to ignore or defer to follow-up.

@tklauser I've added those two to my TODO list (CI passed, don't want to re-run).

@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Jun 16, 2020
@tgraf tgraf merged commit e4bd54c into master Jun 16, 2020
1.8.0 automation moved this from In progress to Merged Jun 16, 2020
@tgraf tgraf deleted the pr/brb/autodev-hostfw branch June 16, 2020 10:56
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Needs backport from master to Backport pending to v1.8 in 1.8.0 Jun 16, 2020
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Backport pending to v1.8 to Backport done to v1.8 in 1.8.0 Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/daemon Impacts operation of the Cilium daemon. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/misc This PR makes changes that have no direct user impact.
Projects
No open projects
1.8.0
  
Merged
1.8.0
Backport done to v1.8
Development

Successfully merging this pull request may close these issues.

None yet

7 participants