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
datapath: support Hybrid-DSR mode for Geneve dispatch #25553
Conversation
b270d51
to
626ce31
Compare
/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>
626ce31
to
5bd8526
Compare
/test |
@ysksuzuki I don't think we discussed hybrid mode at all during #23890. Was there a reason we didn't enable it right away? 🤔 |
I think it was just an oversight🙈 |
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.
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 && |
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 more concise than == DSR || == Hybrid
but maybe less future proof?
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.
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.
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.
+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
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
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.
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
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.