Skip to content
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

Merged
merged 5 commits into from
Mar 24, 2022
Merged

Conversation

gran-vmv
Copy link
Contributor

@gran-vmv gran-vmv commented Jan 26, 2022

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]

@gran-vmv gran-vmv self-assigned this Jan 26, 2022
@gran-vmv gran-vmv marked this pull request as draft January 26, 2022 09:22
@gran-vmv gran-vmv force-pushed the ipam-vlan branch 2 times, most recently from de3f951 to b1ac1e6 Compare January 26, 2022 09:57
@codecov-commenter
Copy link

codecov-commenter commented Jan 26, 2022

Codecov Report

Merging #3247 (1c40497) into main (3c88bc2) will decrease coverage by 22.64%.
The diff coverage is 20.19%.

Impacted file tree graph

@@             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     
Flag Coverage Δ
kind-e2e-tests ?
unit-tests 42.95% <20.19%> (-0.15%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/agent/cniserver/ipam/ipam_delegator.go 0.00% <0.00%> (-48.84%) ⬇️
pkg/agent/cniserver/ipam/ipam_service.go 8.69% <0.00%> (-43.48%) ⬇️
pkg/agent/cniserver/pod_configuration_linux.go 0.00% <0.00%> (-66.67%) ⬇️
pkg/agent/openflow/framework.go 91.54% <0.00%> (-2.66%) ⬇️
pkg/ovs/openflow/ofctrl_builder.go 17.91% <0.00%> (-41.61%) ⬇️
pkg/ovs/ovsconfig/ovs_client.go 1.63% <0.00%> (-44.96%) ⬇️
pkg/agent/openflow/pipeline.go 24.51% <9.17%> (-52.42%) ⬇️
pkg/agent/cniserver/pod_configuration.go 35.11% <31.25%> (-18.41%) ⬇️
pkg/agent/cniserver/server.go 46.54% <33.33%> (-19.12%) ⬇️
pkg/ovs/openflow/ofctrl_action.go 11.23% <42.10%> (-59.12%) ⬇️
... and 214 more

@gran-vmv gran-vmv force-pushed the ipam-vlan branch 11 times, most recently from a82b7e9 to 0e42608 Compare January 29, 2022 09:47
@gran-vmv gran-vmv force-pushed the ipam-vlan branch 3 times, most recently from 9e81683 to bd62b58 Compare February 10, 2022 02:37
@gran-vmv gran-vmv force-pushed the ipam-vlan branch 11 times, most recently from 2d67fd0 to 7738f1a Compare February 22, 2022 03:49
@gran-vmv gran-vmv force-pushed the ipam-vlan branch 3 times, most recently from cd88ae1 to ce1eccb Compare March 21, 2022 04:09
pkg/agent/openflow/framework.go Outdated Show resolved Hide resolved
pkg/agent/openflow/pipeline.go Outdated Show resolved Hide resolved
pkg/agent/openflow/pipeline.go Outdated Show resolved Hide resolved
pkg/agent/openflow/pipeline.go Show resolved Hide resolved
pkg/ovs/openflow/ofctrl_action.go Outdated Show resolved Hide resolved
pkg/agent/openflow/pipeline.go Outdated Show resolved Hide resolved
pkg/agent/openflow/pipeline.go Outdated Show resolved Hide resolved
pkg/agent/openflow/pipeline.go Show resolved Hide resolved
pkg/agent/openflow/pipeline.go Show resolved Hide resolved
pkg/agent/openflow/network_policy.go Outdated Show resolved Hide resolved
@gran-vmv gran-vmv force-pushed the ipam-vlan branch 5 times, most recently from 7a165f5 to 3007fc2 Compare March 22, 2022 03:09
@@ -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}
Copy link
Contributor

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.

Copy link
Contributor Author

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.

build/yamls/base/crds.yml Show resolved Hide resolved
@gran-vmv gran-vmv force-pushed the ipam-vlan branch 2 times, most recently from 09915d1 to 4f8e755 Compare March 23, 2022 01:59
pkg/agent/openflow/pipeline.go Outdated Show resolved Hide resolved
pkg/agent/openflow/pipeline.go Show resolved Hide resolved
pkg/agent/openflow/pipeline.go Outdated Show resolved Hide resolved
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).
Copy link
Member

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?

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)
Copy link
Member

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?

Copy link
Contributor Author

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.)

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Fixed.

@gran-vmv gran-vmv force-pushed the ipam-vlan branch 3 times, most recently from ef1f0fd to b4cad23 Compare March 24, 2022 04:07
Copy link
Member

@tnqn tnqn left a 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/fields.go Show resolved Hide resolved
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)
Copy link
Member

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.

pkg/ovs/openflow/ofctrl_builder.go Show resolved Hide resolved
test/e2e/connectivity_test.go Outdated Show resolved Hide resolved
Copy link
Member

@tnqn tnqn left a 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.

@gran-vmv
Copy link
Contributor Author

LGTM, please squash the commits and include proper description in the commit message.

Hi Quan,
Updated PR description.
I think you can squash all commits when merging this PR, is it correct?

@tnqn
Copy link
Member

tnqn commented Mar 24, 2022

LGTM, please squash the commits and include proper description in the commit message.

Hi Quan, Updated PR description. I think you can squash all commits when merging this PR, is it correct?

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.

@gran-vmv
Copy link
Contributor Author

/test-ipv6-only-networkpolicy

@tnqn tnqn merged commit 0e5ca83 into antrea-io:main Mar 24, 2022
@tnqn tnqn added the action/release-note Indicates a PR that should be included in release notes. label Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action/release-note Indicates a PR that should be included in release notes. area/ipam Issues or PRs related to IP address management (IPAM).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants