lb: Hybrid-DSR using the annotation-based dispatch mode#42788
lb: Hybrid-DSR using the annotation-based dispatch mode#42788julianwiedmann merged 2 commits intocilium:mainfrom
Conversation
julianwiedmann
left a comment
There was a problem hiding this comment.
🚀 Thank you! I added some minor comments below.
For testing, I think we want both controlplane tests (see pkg/loadbalancer/tests) to demonstrate that we're producing the expected frontend entries. And BPF-level tests (see bpf/tests) which call nodeport_uses_dsr4() / nodeport_uses_dsr6() with a fake SVC entry.
192a56b to
96584c8
Compare
96584c8 to
e017301
Compare
julianwiedmann
left a comment
There was a problem hiding this comment.
overall lgtm, thank you! One consideration would be whether we want a full-blown controlplane test that validates the expected BPF map entries (examples in pkg/loadbalancer/tests/testdata/) when hybrid mode is enabled.
We'll also need a quick rebase to latest main, sorry.
As I am not that familiar with it, would the following be ok if we add a full-blown test? @julianwiedmann |
Re-implement Hybrid-DSR mode to use the same flag-based mechanism as annotation mode, eliminating duplicate datapath logic. Changes: - Update ToSVCForwardingMode() to accept optional protocol parameter - For LBModeHybrid, return DSR mode for TCP (proto 6), SNAT otherwise - Pass protocol to ToSVCForwardingMode() in BPF reconciler - Add tests to demonstrate that we're producing the expected frontend entries. This allows the control plane to set SVC_FLAG_FWD_MODE_DSR on a per-frontend basis for TCP services in Hybrid mode, while the datapath uses the same flag-checking logic for all selective DSR modes. Signed-off-by: saiaunghlyanhtet <saiaunghlyanhtet2003@gmail.com>
e017301 to
3ecd7b6
Compare
|
/test |
|
note that when grep'ing for The build & complexity tests we can clean up separately to avoid tons of little conflicts, but the remaining datapath parts need fixing. |
3ecd7b6 to
f60f836
Compare
I have fixed the remaining parts in |
|
/test |
|
Is failing test needed to retrigger as it only fails on arm? @julianwiedmann |
f60f836 to
ce6d71d
Compare
Remove the protocol-based DSR decision logic from the datapath. With Hybrid-DSR now using the annotation-based infrastructure, the datapath only needs to check the SVC_FLAG_FWD_MODE_DSR flag instead of examining both the protocol type and mode. Changes: - Remove ENABLE_DSR_HYBRID conditional from nodeport_uses_dsr() - Replace ENABLE_DSR_HYBRID with ENABLE_DSR_BYUSER in conditional compilation directives for SNAT fallback paths - GENEVE decapsulation for DSR now only happens when DSR is in by-user (flag-based) mode - SNAT tail call now happens when DSR is disabled OR when DSR is not in by-user mode (i.e., in hybrid mode) - Update SVC_FLAG_FWD_MODE_DSR comment to reflect general usage - Set ENABLE_DSR_BYUSER for both Hybrid and annotation modes - Add hybrid_dsr_test This consolidates selective DSR modes (Hybrid and annotation-based) to use a single code path in the datapath. Signed-off-by: saiaunghlyanhtet <saiaunghlyanhtet2003@gmail.com>
ce6d71d to
ce30277
Compare
|
/test |
|
@saiaunghlyanhtet thank you for the contribution! When you have a minute, could please switch over all the remaining |
Yes, I will do it. |
|
I raised the pr @julianwiedmann . |
(see the commit desc)
Fixes: #41690