-
Notifications
You must be signed in to change notification settings - Fork 370
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
[flexible-ipam] Multiple-VLAN support #3247
Conversation
de3f951
to
b1ac1e6
Compare
Codecov Report
@@ Coverage Diff @@
## main #3247 +/- ##
===========================================
- Coverage 65.59% 42.95% -22.65%
===========================================
Files 277 209 -68
Lines 27264 24803 -2461
===========================================
- Hits 17884 10653 -7231
- Misses 7486 13068 +5582
+ Partials 1894 1082 -812
Flags with carried forward coverage won't be shown. Click here to find out more.
|
a82b7e9
to
0e42608
Compare
9e81683
to
bd62b58
Compare
2d67fd0
to
7738f1a
Compare
cd88ae1
to
ce1eccb
Compare
7a165f5
to
3007fc2
Compare
@@ -143,7 +142,7 @@ func (d *AntreaIPAM) Add(args *invoke.Args, k8sArgs *argtypes.K8sArgs, networkCo | |||
|
|||
klog.V(4).InfoS("IP allocation successful", "IP", ip.String(), "Pod", string(k8sArgs.K8S_POD_NAME)) | |||
|
|||
result := IPAMResult{Result: current.Result{CNIVersion: current.ImplementedSpecVersion}, VLANID: parseVLANID(subnetInfo.VLAN)} | |||
result := IPAMResult{Result: current.Result{CNIVersion: current.ImplementedSpecVersion}, VLANID: subnetInfo.VLAN & 0xfff} |
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.
I feel we should check the VLAN value is valid (<=0xffe) and return an error if not.
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.
Thanks. Added minimum
and maximum
in CRD.
09915d1
to
4f8e755
Compare
pkg/agent/openflow/pipeline.go
Outdated
Cookie(cookieID). | ||
MatchInPort(config.UplinkOFPort). | ||
Action().Output(config.BridgeOFPort). | ||
Done(), | ||
// This generates the flow to forward the packets from bridge local port to uplink port. | ||
ClassifierTable.ofTable.BuildFlow(priorityNormal). | ||
ClassifierTable.ofTable.BuildFlow(priorityLow). |
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.
Is this question addressed? @wenyingd I think you were suggesting to keep priorities added in hostBridgeLocalFlows
and podUplinkClassifierFlows
unchanged?
pkg/agent/openflow/pipeline.go
Outdated
Cookie(cookieID). | ||
MatchInPort(config.BridgeOFPort). | ||
Action().Output(config.UplinkOFPort). | ||
Done(), | ||
} | ||
} | ||
|
||
// hostBridgeUplinkVLANFlows generates the flows to match VLAN packets from uplink port. | ||
func (f *featurePodConnectivity) hostBridgeUplinkVLANFlows() []binding.Flow { | ||
vlanMask := uint16(0x1000) |
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.
what does it mean by using 0x1000 mask? Isn't vlan only using 12bits?
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.
At here, we use it to match packet with any VLAN, this is required for popVLAN action.
OXM_OF_VLAN_VID
supports below match cases:
Fully wildcarded
Matches any packet, that is, one without an 802.1Q header
or with an 802.1Q header with any TCI value.
Value 0x0000 (OFPVID_NONE), mask 0xffff (or no mask)
Matches only packets without an 802.1Q header.
Value 0x1000, mask 0x1000
Matches any packet with an 802.1Q header, regardless of
VLAN ID.
Value 0x1009, mask 0xffff (or no mask)
Match only packets with an 802.1Q header with VLAN ID 9.
Value 0x1001, mask 0x1001
Matches only packets that have an 802.1Q header with an
odd-numbered VLAN ID. (This is just an example; one can
match on any desired VLAN ID bit pattern.)
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.
Using openflow13.OFPVID_PRESENT
may be more readable.
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.
Thanks. Fixed.
Signed-off-by: gran <[email protected]>
Signed-off-by: gran <[email protected]>
ef1f0fd
to
b4cad23
Compare
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 overall
pkg/agent/openflow/pipeline.go
Outdated
Cookie(cookieID). | ||
MatchInPort(config.BridgeOFPort). | ||
Action().Output(config.UplinkOFPort). | ||
Done(), | ||
} | ||
} | ||
|
||
// hostBridgeUplinkVLANFlows generates the flows to match VLAN packets from uplink port. | ||
func (f *featurePodConnectivity) hostBridgeUplinkVLANFlows() []binding.Flow { | ||
vlanMask := uint16(0x1000) |
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.
Using openflow13.OFPVID_PRESENT
may be more readable.
Signed-off-by: gran <[email protected]>
Signed-off-by: gran <[email protected]>
Signed-off-by: gran <[email protected]>
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, please squash the commits and include proper description in the commit message.
Hi Quan, |
Sure, I can do it for this PR, but it would be better if you could include a proper description in the first commit in the begining and format it following the convention in the future. |
/test-ipv6-only-networkpolicy |
Support Multiple-VLAN for Antrea FlexibleIPAM.
Update VLAN format from string to integer in CRD.
Traffic from the Pods whose IPPool is configured with VLAN ID will be tagged when leaving Node uplink.
Cross VLAN traffic will be sent to underlay gateway always.
Enable AntreaIPAM will change Antrea DNAT CT zone from 65520 to 4096-8190 (for VLAN 0-4094).
Signed-off-by: gran [email protected]