-
Notifications
You must be signed in to change notification settings - Fork 791
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
bridge: add vlan trunk support #689
Conversation
@dcbw could you take a look on it. |
This is interesting. We had a question in the maintainers' meeting: how do you receive the packets inside the container? Are you using another process to create vlan-tagged interfaces inside? Or are you doing it in userspace? |
Another comment (mostly from @dcbw) -- is trunking a per-port setting? Is it possible / desired for different containers on the same bridge to have different trunking configurations? |
In our scenario, kubevirt will setup another bridge to catch all traffic and let VM handle the VLAN tag
linux equivalent command: ip link add br0 type bridge vlan_filtering 1
ip link set br0 up
ip link set eth0 master br0
ip link add veth-red type veth peer name veth-blue
ip link set veth-red master br0
ip link set veth-red up
ip link add veth-green veth peer name veth-purple
ip link set veth-green master br0
ip link set veth-green up
birdge vlan add dev veth-red vid 100 pvid untagged
bridge vlan add dev veth-red vid 101
bridge vlan add dev veth-red vid 102
bridge vlan add dev veth-green vid 200 pvid untagged
bridge vlan add dev veth-green vid 201
bridge vlan add dev veth-green vid 202 |
@tjjh89017 could you rebase since we merged a fix for ipamDel()? Thanks! |
ea3a18d
to
63adec5
Compare
add vlan trunk support for veth vlan trunk only support L2 only mode without any IPAM refer ovs-cni design https://github.com/k8snetworkplumbingwg/ovs-cni/blob/main/pkg/plugin/plugin.go design: origin "vlan" option will be PVID or untagged vlan for the network. "vlanTrunk" will setup tagged vlan for veth. entry type: `{ "id": 100 }` will specify only tagged vlan 100 `{ "minID": 100, "maxID": 120 }` will specify tagged vlan from 100 to 120 (include 100 and 120) vlanTrunk is a list of above entry type, so you can use this to add tagged vlan `[ { "id": 100 }, { "minID": 1000, "maxID": 2000 } ]` complete config will be like this { "cniVersion": "0.3.1", "name": "mynet", "type": "bridge", "bridge": "mynet0", "vlan": 100, "vlanTrunk": [ { "id": 101 }, { "minID": 1000, "maxID": 2000 }, { "minID": 3000, "maxID": 4000 } ], "ipam": {} } Signed-off-by: Date Huang <date.huang@suse.com>
f7ba457
to
d3272b4
Compare
@dcbw tks for help |
This PR has been untouched for too long without an update. It will be closed in 7 days. |
@dcbw do we have any plan to support this feature? |
This PR has been untouched for too long without an update. It will be closed in 7 days. |
var err error | ||
if n.vlans, err = collectVlanTrunk(n.VlanTrunk); err != nil { |
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.
Would it be more consistent with the rest of the code to use the scoped variable and not define err?
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.
We will still need to copy the value back to n.vlans
later.
So I will consider to keep current code
Please help reopen the issue. We still need this enhancement. |
Arg, I somehow can't reopen. I'm sorry. Can you resubmit? |
I opened a new PR and rebase it again. |
add vlan trunk support for veth
vlan trunk only support L2 only mode without any IPAM
refer ovs-cni design
https://github.com/k8snetworkplumbingwg/ovs-cni/blob/main/pkg/plugin/plugin.go
design:
origin "vlan" option will be PVID or untagged vlan for the network.
"vlanTrunk" will setup tagged vlan for veth.
entry type:
{ "id": 100 }
will specify only tagged vlan 100{ "minID": 100, "maxID": 120 }
will specify tagged vlan from 100 to120 (include 100 and 120)
vlanTrunk is a list of above entry type, so you can use this to add
tagged vlan
[ { "id": 100 }, { "minID": 1000, "maxID": 2000 } ]
complete config will be like this
Signed-off-by: Date Huang date.huang@suse.com