sbr: Add options to configure static gateway IP and preserve default routes#1217
sbr: Add options to configure static gateway IP and preserve default routes#1217squeed merged 1 commit intocontainernetworking:mainfrom
Conversation
78e2abb to
0d9f9b1
Compare
|
Looks nice! |
|
Thanks for the review @squeed!
I'm not sure I fully understand the question. If a user wanted only source-hinted routes without custom tables, I don't think they'd need SBR at all - the kernel already creates these automatically when IPs are assigned. In my case at least, without SBR on my interface at 10.5.0.5, the source-hinted route is already in the main table: The SBR plugin (without this added plugins/plugins/meta/sbr/main.go Lines 396 to 402 in 0d9f9b1 Does that make sense? Please let me know if I've misunderstood your question. |
|
🤦 of course. I don't know what I was thinking. |
karampok
left a comment
There was a problem hiding this comment.
Some comments from my side
- 5 commits seem too many imo, maybe 2 (one for static gateway on for preserveDefaultRoutes) or even 1 (like atomic commits)
- test look a bit thin, like only ipv4 not unhappy path
(Note: I am not maintainer of the repo)
| // PreserveDefaultRoutes keeps subnet routes in the main routing table | ||
| // with proper source IP hints for destination-based routing. | ||
| // This allows packets without an explicit source IP to be routed correctly. | ||
| PreserveDefaultRoutes bool `json:"preserveDefaultRoutes,omitempty"` |
There was a problem hiding this comment.
PreserveDefaultRoutes: is not so clear to me.
The "defaultRoutes" suffix makes think that in the main table I see a default route, which is not true, I only should see the subnet via eth0 src x.y.z.k, is that correct?
thx
There was a problem hiding this comment.
I think this is a good point. I renamed this option to AddSourceHints. Do you think that is more clear?
squeed
left a comment
There was a problem hiding this comment.
Can you please squash your commits? And a v6 test would be good.
3e174b8 to
406a898
Compare
karampok
left a comment
There was a problem hiding this comment.
one nit comment, but lgtm in general
|
/retest |
Add two configuration options:
1. "gateways" ([]string): Static gateway IPs that override prevResult.
Supports dual-stack (one IPv4 and/or one IPv6 address).
2. "addSourceHints" (bool): Preserves subnet routes in the main table
with source IP hints, enabling destination-based routing to work
alongside source-based routing
Example:
{
"type": "sbr",
"gateways": ["10.0.0.1"],
"addSourceHints": true
}
Signed-off-by: David Whyte-Gray <40244437+dagrayvid@users.noreply.github.com>
|
Just following up on this PR |
This PR aims to solve two problems I faced using the source-based router CNI plugin for distributed LLM inference with vLLM / llm-d.
In my environment (IBM Cloud), the DHCP server my secondary high-speed networks does not provide the gateway IP, so I needed a way to override / statically define the gateway IPs to ensure that the custom routing tables included the default route to the gateway.
ping -I 10.0.0.6 10.1.0.7would work, butping 10.1.0.7. With"preserveDefaultRoutes": true, both work.Tested in my environment with this CNI config:
In a Pod, the result of the statically defined gateway:
and the result of preserve default route: