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

bpf: nodeport: split off LB logic in nodeport_lb*() #31590

Merged
merged 2 commits into from
Apr 3, 2024

Conversation

julianwiedmann
Copy link
Member

@julianwiedmann julianwiedmann commented Mar 25, 2024

Navigating this particular function is confusing, and to support #13732 we'll eventually need to cleanly split the LB / NAT paths anyway. So let's bite the bullet and go ahead with it.

Use positive logic in the "use identity forward?" condition. Also limit
the additional sanity-checks for the forwarded identity to this code path.

Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
nodeport_lb*() has grown into a massive function, and its current code
flow is rather confusing:

	if (is-svc-request) {
		/* do svc stuff */
	} else {
		/* do other stuff and return */
	}

	/* do more svc stuff */

Clean this up by pulling all the SVC logic into a separate function.
Long-term this will make it easier to configure BPF masquerading
independently from ENABLE_NODEPORT.

Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Mar 25, 2024
@julianwiedmann julianwiedmann added sig/datapath Impacts bpf/ or low-level forwarding details, including map management and monitor messages. kind/cleanup This includes no functional changes. release-note/misc This PR makes changes that have no direct user impact. area/loadbalancing Impacts load-balancing and Kubernetes service implementations labels Mar 25, 2024
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Mar 25, 2024
@julianwiedmann
Copy link
Member Author

/test

@julianwiedmann julianwiedmann changed the title 1.16 bpf nodeport svc extract bpf: nodeport: split off LB logic in nodeport_lb*() Mar 26, 2024
@julianwiedmann julianwiedmann marked this pull request as ready for review March 26, 2024 08:51
@julianwiedmann julianwiedmann requested a review from a team as a code owner March 26, 2024 08:51
@julianwiedmann
Copy link
Member Author

No clue why the diff for nodeport_lb4() looks so pretty, but nodeport_lb6() is an utter mess :/. Let me know if I should look into that a bit more to help with review.

Copy link
Member

@jibi jibi left a comment

Choose a reason for hiding this comment

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

  • all the svc logic moved into nodeport_svc_lb{4,6}
  • some extra churn due to some values becoming pointers
  • the else branch for the is-not-svc-request case always returned or tailcall'd into another func so should be fine to move all the svc logic inside the is-svc-request branch

LGTM

@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 Apr 3, 2024
@jibi jibi added this pull request to the merge queue Apr 3, 2024
Merged via the queue into cilium:main with commit 399ab5e Apr 3, 2024
63 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/loadbalancing Impacts load-balancing and Kubernetes service implementations kind/cleanup This includes no functional changes. 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. sig/datapath Impacts bpf/ or low-level forwarding details, including map management and monitor messages.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants