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

datapath: support Hybrid-DSR mode for Geneve dispatch #25553

Merged

Conversation

julianwiedmann
Copy link
Member

@julianwiedmann julianwiedmann commented May 19, 2023

We've initially had DSR with info dispatch via IP option/extension. Here we support "full" DSR, and also a hybrid mode where TCP connections use DSR, but UDP traffic continues to use NAT and its replies pass back through the LB node.

With #23890 we've added info dispatch via Geneve Options. Here DSR traffic gets Geneve-encapsulated and has DSR info added as needed. But this currently only supports "full" DSR.

Adding support for hybrid mode is easy enough - it's just a few changes in the agent's option processing, we don't even need to touch the BPF datapath.

Add support for Hybrid mode when using DSR with Geneve dispatch.

@julianwiedmann julianwiedmann added sig/datapath Impacts bpf/ or low-level forwarding details, including map management and monitor messages. release-note/misc This PR makes changes that have no direct user impact. labels May 19, 2023
@julianwiedmann
Copy link
Member Author

/test

The DSR validation in initKubeProxyReplacementOptions() only allowed Hybrid
when used with IP-Option dispatch. But we can also support Hybrid mode with
Geneve dispatch, so that UDP traffic goes down the NAT path. It then either
gets get encapsulated without DSR info (tunnel routing), or leaves the
node without encapsulation (native routing).

This just requires a few small changes to the configuration of the
ad-hoc tunnel.

Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
Have all the nodeport modes grouped together, so it's easier to spot that
we have more than just SNAT and full-DSR.

Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
@julianwiedmann
Copy link
Member Author

/test

@julianwiedmann julianwiedmann changed the title 1.14 nodeport geneve hybrid datapath: support Hybrid-DSR mode for Geneve dispatch Jun 1, 2023
@julianwiedmann julianwiedmann added kind/feature This introduces new functionality. release-note/minor This PR changes functionality that users may find relevant to operating Cilium. and removed release-note/misc This PR makes changes that have no direct user impact. labels Jun 1, 2023
@julianwiedmann julianwiedmann marked this pull request as ready for review June 1, 2023 04:24
@julianwiedmann julianwiedmann requested review from a team as code owners June 1, 2023 04:24
@julianwiedmann
Copy link
Member Author

@ysksuzuki I don't think we discussed hybrid mode at all during #23890. Was there a reason we didn't enable it right away? 🤔

@ysksuzuki
Copy link
Member

Was there a reason we didn't enable it right away?

I think it was just an oversight🙈

Copy link
Contributor

@lmb lmb left a comment

Choose a reason for hiding this comment

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

sig-datapath files LGTM.

@@ -143,7 +143,7 @@ func (h *HeaderfileWriter) WriteNodeConfig(w io.Writer, cfg *datapath.LocalNodeC
encapProto := option.Config.TunnelProtocol
if !option.Config.TunnelingEnabled() &&
option.Config.EnableNodePort &&
option.Config.NodePortMode == option.NodePortModeDSR &&
option.Config.NodePortMode != option.NodePortModeSNAT &&
Copy link
Contributor

Choose a reason for hiding this comment

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

This is more concise than == DSR || == Hybrid but maybe less future proof?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ack, not a big fan of it either - for now, I believe this is in sync with how the remaining code does it. But I can follow up with some NodePortUsesDSR() helper.

Copy link
Member

Choose a reason for hiding this comment

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

+1. If we are going to make setting more logical, I also vote for not using the name NodePort to refer to everything related to forwarding traffic

Copy link
Member

@ysksuzuki ysksuzuki left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@viktor-kurchenko viktor-kurchenko left a comment

Choose a reason for hiding this comment

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

LGTM.

@dylandreimerink dylandreimerink self-requested a review June 5, 2023 13:11
Copy link
Member

@dylandreimerink dylandreimerink left a comment

Choose a reason for hiding this comment

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

LGTM

@julianwiedmann julianwiedmann added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Jun 5, 2023
@julianwiedmann julianwiedmann merged commit b1bde1a into cilium:main Jun 5, 2023
61 checks passed
@julianwiedmann julianwiedmann deleted the 1.14-nodeport-geneve-hybrid branch June 5, 2023 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature This introduces new functionality. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/minor This PR changes functionality that users may find relevant to operating Cilium. 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

6 participants