(feat): Add hybrid routing to Cilium#41405
(feat): Add hybrid routing to Cilium#41405anubhabMajumdar wants to merge 9 commits intocilium:mainfrom
Conversation
|
@joestringer @pchaigno Raising a draft PR to initiate a discussion about the hybrid routing changes. This PR will provide an overview of exactly what I am trying to achieve. Given its size and complexity, I will break it up into pieces for easier review and merging. |
Signed-off-by: Anubhab Majumdar <anmajumdar@microsoft.com>
Signed-off-by: Anubhab Majumdar <anmajumdar@microsoft.com>
Signed-off-by: Anubhab Majumdar <anmajumdar@microsoft.com>
Signed-off-by: Anubhab Majumdar <anmajumdar@microsoft.com>
Signed-off-by: Anubhab Majumdar <anmajumdar@microsoft.com>
Signed-off-by: Anubhab Majumdar <anmajumdar@microsoft.com>
Signed-off-by: Anubhab Majumdar <anmajumdar@microsoft.com>
Signed-off-by: Anubhab Majumdar <anmajumdar@microsoft.com>
Signed-off-by: Anubhab Majumdar <anmajumdar@microsoft.com>
5089df7 to
4e0b0a8
Compare
There was a problem hiding this comment.
Thanks for the PR. I did a first pass on the control-plane side, I think this needs quite a bit of work still, as it is very bare bones at the moment. I have left some pointers in the review.
Please also consider restructuring your git history into logical commits. I found it a bit hard to review intermediate code that was changed substantially in later commits.
|
How is this intended to interact with masquerading? The CFP doesn't specify much in that regard. What happens if I configure a subnet for native routing but then traffic is not part of the SNAT exclusion CIDR? |
|
This pull request has been automatically marked as stale because it |
|
This pull request has not seen any activity since it was marked stale. |
Note
I have started splitting the draft PR into smaller chunks.
Here's the PR for the datapath - [GH-41867][Part-1][eBPF] Add support for hybrid routing in datapath by anubhabMajumdar · Pull Request #41868 · cilium/cilium .
Description
The motivation behind adding a new routing mode is discussed in this CFP . This PR provides an overview for how this change will be implemented. Given the size and complexity, the changes have been grouped into logical commits. Depending on feedback, will probably create separate smaller PRs to actually merge in the changes to main.
Overview
This feature would allow user to configure Cilium cluster(s) with multiple subnets, and benefit from both tunnel and native routing mode for maximum efficiency (no overhead of tunneling when not needed).
There's a more verbose description here. It goes into much more detail about the changes and how testing was performed, along with diagram explaining the setup.
Motivation
Changes Overview
Datapath
This covers all the C code changes. Files edited/added:
bpf/lib/subnet.h- This has the LPM trie based subnet map, similar to the IPCache map. Has functions for lookup.bpf_lxc.c- Added an extra check toskip_tunnel. Now, skip tunneling if IPs belong to same subnet.bpf_host.c- Added an extra check toskip_tunnel. Now, skip tunneling if IPs belong to same subnet.DBG_SUBNET_CHECKandDBG_TUNNEL_TRACEfor debugging purposes. Will remove these before merging.Userspace
This covers the user side code that watches, reads, parses and update the eBPF map with subnets. All files are under
pkg/subnettopology. The pattern closely resembles other dynamic controllers like dynamic exporter, which reads a file every so many seconds and reconciles the change if it finds any.Configuration
This covers all changes needed to add a new option under
routing-mode. Also. when hybrid routing mode, allow settings for both tunnel and native routing. Files edited:daemon/cmd/daemon_main.gopkg/option/config.goInstall
YAML file changes to add the new hybrid routing related options.
NOTE: Will revert back to runnel mode as default routing option in
values.yaml.Testing Done
I haven't added any new tests to verify this change yet. Part of the reason for this change to have a discussion here as to how this should be tested going forward. I think we would probably need to setup new infrastructure to test it in Cluster Mesh with dynamic subnets.
Here's how I have tested this change in single/multi-cluster scenarios. All testing were done on following
Single cluster
to-overlayflows on the client node.same_subnet=false.to-stack/networkflows on the client node.same_subnet=true.Cluster Mesh
podcidr1,podcidr2).to-stack/networkflows on the client node.same_subnet=true.podcidr1;podcidr2(means no direct routing possible between two CIDR range).to-overlayflows on the client node.same_subnet=false.Notes
values.yamlPlease ensure your pull request adheres to the following guidelines:
description and a
Fixes: #XXXline if the commit addresses a particularGitHub issue.
Fixes: <commit-id>tag, thenplease add the commit author[s] as reviewer[s] to this issue.
Fixes: #issue-number