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

Add trafficControlController to handle TrafficControl requests #3487

Merged
merged 1 commit into from Jun 10, 2022

Conversation

wenqiq
Copy link
Contributor

@wenqiq wenqiq commented Mar 19, 2022

For #3324

The Antrea Agent is responsible for realizing the traffic control request.
It watches the TrafficControl resources from the K8s API server and manages the container traffic with OpenFlow rules. Specifically, the agent executes the following steps for a TrafficControl resource:

  • Use label selectors to filter Pods running on this Node.
  • Translate the selected Pods to OVS ports, which will be used to filter traffic that should be mirrored or redirected.
  • Translate the target device to the OVS port, which will be used as the target port the traffic should be mirrored or redirected.
  • Install OpenFlow rules calculated using the above arguments.

Signed-off-by: Wenqi Qiu wenqiq@vmware.com
Signed-off-by: Hongliang Liu lhongliang@vmware.com
Signed-off-by: Quan Tian qtian@vmware.com

@codecov-commenter
Copy link

codecov-commenter commented Mar 19, 2022

Codecov Report

Merging #3487 (bc3a01f) into main (dcd1019) will increase coverage by 7.91%.
The diff coverage is 82.84%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3487      +/-   ##
==========================================
+ Coverage   49.22%   57.14%   +7.91%     
==========================================
  Files         258      407     +149     
  Lines       37969    58784   +20815     
==========================================
+ Hits        18691    33591   +14900     
- Misses      17422    22478    +5056     
- Partials     1856     2715     +859     
Flag Coverage Δ
integration-tests 37.44% <ø> (?)
kind-e2e-tests 51.12% <55.87%> (+1.89%) ⬆️
unit-tests 44.73% <70.19%> (?)

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

Impacted Files Coverage Δ
pkg/ovs/ovsconfig/ovs_client.go 47.79% <81.81%> (+1.78%) ⬆️
pkg/agent/controller/trafficcontrol/controller.go 82.64% <82.64%> (ø)
pkg/agent/agent.go 53.92% <100.00%> (+7.60%) ⬆️
...gent/controller/noderoute/node_route_controller.go 56.12% <100.00%> (+15.28%) ⬆️
pkg/agent/interfacestore/types.go 69.44% <100.00%> (+2.77%) ⬆️
pkg/apis/crd/v1alpha2/register.go 90.90% <100.00%> (+0.90%) ⬆️
pkg/agent/nodeportlocal/k8s/annotations.go 84.44% <0.00%> (-15.56%) ⬇️
pkg/controller/networkpolicy/tier.go 50.00% <0.00%> (-5.00%) ⬇️
pkg/agent/nodeportlocal/k8s/npl_controller.go 61.12% <0.00%> (-0.94%) ⬇️
pkg/agent/route/route_linux.go 48.08% <0.00%> (-0.10%) ⬇️
... and 274 more

@wenqiq wenqiq force-pushed the traffic-control branch 3 times, most recently from 2420fab to 31e4dd0 Compare April 12, 2022 15:10
@wenqiq wenqiq changed the title [WIP]Unify AppliedToGroup of NetworkPolicy/Egress and add trafficControl API [WIP]Add trafficControlController to handle TrafficControl requests Apr 12, 2022
@wenqiq wenqiq force-pushed the traffic-control branch 4 times, most recently from 9dd56c3 to a5543b2 Compare April 16, 2022 11:13
@wenqiq wenqiq changed the title [WIP]Add trafficControlController to handle TrafficControl requests Add trafficControlController to handle TrafficControl requests Apr 18, 2022
@wenqiq wenqiq force-pushed the traffic-control branch 2 times, most recently from 35583b4 to 81b6c1f Compare April 21, 2022 01:00
@wenqiq wenqiq marked this pull request as ready for review April 21, 2022 10:47
pkg/agent/controller/trafficcontrol/controller.go Outdated Show resolved Hide resolved
pkg/agent/controller/trafficcontrol/controller.go Outdated Show resolved Hide resolved
pkg/agent/controller/trafficcontrol/controller.go Outdated Show resolved Hide resolved
pkg/agent/controller/trafficcontrol/controller.go Outdated Show resolved Hide resolved
pkg/agent/controller/trafficcontrol/controller.go Outdated Show resolved Hide resolved
pkg/agent/controller/trafficcontrol/controller.go Outdated Show resolved Hide resolved
pkg/agent/controller/trafficcontrol/controller.go Outdated Show resolved Hide resolved
@wenqiq wenqiq force-pushed the traffic-control branch 2 times, most recently from 22b4aa2 to 17721ef Compare April 27, 2022 07:41
@wenqiq wenqiq force-pushed the traffic-control branch 4 times, most recently from ec4041b to 08b62b2 Compare May 4, 2022 06:20
@wenqiq wenqiq force-pushed the traffic-control branch 3 times, most recently from fc4e3ec to d9c8913 Compare May 6, 2022 09:38
pkg/agent/controller/trafficcontrol/controller.go Outdated Show resolved Hide resolved
pkg/agent/controller/trafficcontrol/controller.go Outdated Show resolved Hide resolved
pkg/agent/controller/trafficcontrol/controller.go Outdated Show resolved Hide resolved
pkg/agent/controller/trafficcontrol/controller.go Outdated Show resolved Hide resolved
pkg/agent/controller/trafficcontrol/controller.go Outdated Show resolved Hide resolved
pkg/agent/controller/trafficcontrol/controller.go Outdated Show resolved Hide resolved
pkg/agent/controller/trafficcontrol/controller.go Outdated Show resolved Hide resolved
pkg/ovs/ovsconfig/interfaces.go Outdated Show resolved Hide resolved
@tnqn
Copy link
Member

tnqn commented Jun 8, 2022

@jianjuns @wenyingd will you take another look at this PR? If not, I will merge it after tests pass.

@hongliangl
Copy link
Contributor

/test-ipv6-e2e
/test-ipv6-only-e2e

@hongliangl
Copy link
Contributor

/test-ipv6-e2e

@wenyingd
Copy link
Contributor

wenyingd commented Jun 8, 2022

@jianjuns @wenyingd will you take another look at this PR? If not, I will merge it after tests pass.

No comments from my side.

@tnqn
Copy link
Member

tnqn commented Jun 8, 2022

/test-ipv6-e2e

@jianjuns
Copy link
Contributor

jianjuns commented Jun 8, 2022

I am good too.

@jianjuns
Copy link
Contributor

jianjuns commented Jun 8, 2022

/test-ipv6-e2e
/test-ipv6-only-e2e

@tnqn
Copy link
Member

tnqn commented Jun 9, 2022

/test-ipv6-e2e this should be fixed now

ipv6-only-e2e will be fixed by #3869

@tnqn
Copy link
Member

tnqn commented Jun 9, 2022

    trafficcontrol_test.go:324: Error when waiting for Pod 'pod-to-create-veth-pair' to be in the Running state
=== CONT  TestTrafficControl
    fixtures.go:278: Exporting test logs to '/var/lib/jenkins/workspace/antrea-ipv6-ds-e2e-for-pull-request/antrea-test-logs/TestTrafficControl/beforeTeardown.Jun09-06-18-37'
    fixtures.go:390: Error when exporting kubelet logs: error when running journalctl on Node 'antrea-ipv6-9-0', is it available? Error: <nil>
    fixtures.go:423: Deleting 'testtrafficcontrol-2rc6dkh2' K8s Namespace
I0609 06:18:48.947620   25762 framework.go:643] Deleting Namespace testtrafficcontrol-2rc6dkh2 took 3.959952ms
--- FAIL: TestTrafficControl (147.71s)
    --- PASS: TestTrafficControl/TestMirrorToRemote (3.54s)
    --- PASS: TestTrafficControl/TestMirrorToLocal (4.59s)
    --- FAIL: TestTrafficControl/TestRedirectToLocal (90.02s)

@hongliangl
Copy link
Contributor

hongliangl commented Jun 9, 2022

--- FAIL: TestTrafficControl/TestRedirectToLocal (90.02s)

I'll fix this.

@hongliangl
Copy link
Contributor

/test-ipv6-e2e
/test-ipv6-only-e2e
/test-e2e

@tnqn
Copy link
Member

tnqn commented Jun 9, 2022

Perhaps the issue is because previous failure left stale devices on testbeds, you may clean that port first ip link del dev xxx || true && ip link add ...

@hongliangl
Copy link
Contributor

Perhaps the issue is because previous failure left stale devices on testbeds, you may clean that port first ip link del dev xxx || true && ip link add ...

Make sense.

@hongliangl
Copy link
Contributor

/test-all
/test-ipv6-e2e
/test-ipv6-only-e2e

@hongliangl
Copy link
Contributor

/test-ipv6-e2e
/test-ipv6-only-e2e

@hongliangl
Copy link
Contributor

/test-e2e

@hongliangl
Copy link
Contributor

/test-e2e
/test-ipv6-e2e
/test-ipv6-only-e2e

@hongliangl
Copy link
Contributor

/test-all
/test-ipv6-only-e2e

- Use label selectors to filter Pods running on current Node.
- Translate the selected Pods to OVS ports, which will be used
  to filter the packets that should be mirrored or redirected.
- Translate the target device to the OVS port, which will be
  used as the target port the traffic should be mirrored or
  redirected.
- Install OpenFlow rules calculated using the above arguments.

Signed-off-by: Hongliang Liu <lhongliang@vmware.com>
Co-authored-by: Quan Tian <qtian@vmware.com>
Co-authored-by: Wenqi Qiu <wenqiq@vmware.com>
@hongliangl
Copy link
Contributor

/test-e2e
/test-ipv6-e2e
/test-ipv6-only-e2e

@hongliangl
Copy link
Contributor

/test-ipv6-e2e

@tnqn
Copy link
Member

tnqn commented Jun 10, 2022

/test-integration
/test-networkpolicy
/test-conformance

@tnqn tnqn merged commit 4e60600 into antrea-io:main Jun 10, 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants