antrea icon indicating copy to clipboard operation
antrea copied to clipboard

StretchedNetworkPolicy Agent Implementation

Open GraysonWu opened this issue 3 years ago • 22 comments

This PR is based on https://github.com/antrea-io/antrea/pull/3913.

  1. Add implementation of Stretched NetworkPolicy in Antrea agent. 1.1 Add OVS flows with tun_id matching. 1.2 Agent also realizes a security rule using unknown LabelIdentity for each Stretched NetworkPolicy rule.
  2. Add implementation of LabelIdentity on datapath 2.1 Pod will load its LabelIdentity in tun_id in ClassifierFlow. 2.2 Pod Classifier flow will have a different cacheKey for easy updates. 2.3 StretchedNetworkPolicy will sync Pod ClassifierFlow according to Pod/NS/LabelID events.
  3. Add UT and E2E tests.

GraysonWu avatar Jun 19 '22 21:06 GraysonWu

Codecov Report

Merging #3914 (fedfdf5) into main (113fe92) will increase coverage by 0.20%. The diff coverage is 32.25%.

:exclamation: Current head fedfdf5 differs from pull request most recent head d1e79ce. Consider uploading reports for the commit d1e79ce to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3914      +/-   ##
==========================================
+ Coverage   67.87%   68.07%   +0.20%     
==========================================
  Files         402      415      +13     
  Lines       57284    58981    +1697     
==========================================
+ Hits        38879    40151    +1272     
- Misses      15707    16111     +404     
- Partials     2698     2719      +21     
Flag Coverage Δ *Carryforward flag
e2e-tests 39.99% <10.95%> (?)
integration-tests 34.60% <39.21%> (ø) Carriedforward from 113fe92
kind-e2e-tests 47.54% <57.37%> (ø) Carriedforward from 113fe92
unit-tests 56.44% <66.49%> (ø) Carriedforward from 113fe92

*This pull request uses carry forward flags. Click here to find out more.

Impacted Files Coverage Δ
cmd/antrea-agent/agent.go 0.00% <0.00%> (ø)
pkg/agent/cniserver/pod_configuration_windows.go 0.00% <0.00%> (ø)
...multicluster/stretched_networkpolicy_controller.go 0.00% <0.00%> (ø)
pkg/agent/openflow/network_policy.go 78.95% <0.00%> (-0.44%) :arrow_down:
pkg/agent/types/networkpolicy.go 89.58% <ø> (-0.17%) :arrow_down:
pkg/agent/cniserver/pod_configuration.go 58.10% <50.00%> (+0.44%) :arrow_up:
pkg/agent/openflow/pipeline.go 88.53% <53.84%> (-2.54%) :arrow_down:
pkg/agent/openflow/multicluster.go 72.02% <78.94%> (-24.24%) :arrow_down:
pkg/agent/controller/networkpolicy/cache.go 85.63% <79.62%> (-1.12%) :arrow_down:
pkg/agent/controller/networkpolicy/reconciler.go 74.08% <83.33%> (+3.80%) :arrow_up:
... and 55 more

codecov-commenter avatar Jun 19 '22 21:06 codecov-commenter

This pull request introduces 1 alert when merging 0bf305c869a30f07615c3867ce5e1df202951309 into 52bb02e0acdbf46c4756df092e9f008a3e49370d - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

lgtm-com[bot] avatar Jun 19 '22 21:06 lgtm-com[bot]

Hi @GraysonWu Could you update the summary and commit message so reviewer can learn about this PR with more details? thanks.

luolanzone avatar Sep 19 '22 07:09 luolanzone

/test-multicluster-e2e

GraysonWu avatar Sep 19 '22 18:09 GraysonWu

/test-multicluster-e2e

GraysonWu avatar Sep 19 '22 20:09 GraysonWu

Hi @GraysonWu Could you update the summary and commit message so reviewer can learn about this PR with more details? thanks.

Updated.

GraysonWu avatar Sep 20 '22 02:09 GraysonWu

/test-multicluster-e2e

GraysonWu avatar Sep 21 '22 23:09 GraysonWu

/test-multicluster-e2e

GraysonWu avatar Sep 22 '22 03:09 GraysonWu

/test-multicluster-e2e

GraysonWu avatar Sep 22 '22 20:09 GraysonWu

/test-multicluster-e2e

GraysonWu avatar Sep 22 '22 20:09 GraysonWu

/test-multicluster-e2e

GraysonWu avatar Sep 22 '22 22:09 GraysonWu

/test-multicluster-e2e

GraysonWu avatar Sep 27 '22 17:09 GraysonWu

/test-multicluster-e2e

GraysonWu avatar Sep 27 '22 21:09 GraysonWu

/test-multicluster-e2e

GraysonWu avatar Sep 27 '22 21:09 GraysonWu

/test-multicluster-e2e

GraysonWu avatar Sep 28 '22 18:09 GraysonWu

/test-multicluster-e2e

GraysonWu avatar Sep 28 '22 20:09 GraysonWu

/test-multicluster-e2e

GraysonWu avatar Sep 28 '22 22:09 GraysonWu

/test-multicluster-e2e

GraysonWu avatar Sep 28 '22 22:09 GraysonWu

/test-multicluster-e2e

GraysonWu avatar Sep 29 '22 00:09 GraysonWu

/test-multicluster-e2e

GraysonWu avatar Sep 29 '22 18:09 GraysonWu

/test-multicluster-e2e

GraysonWu avatar Oct 05 '22 00:10 GraysonWu

/test-multicluster-e2e

GraysonWu avatar Oct 07 '22 18:10 GraysonWu

/test-multicluster-e2e

GraysonWu avatar Oct 19 '22 02:10 GraysonWu

/test-multicluster-e2e

GraysonWu avatar Oct 20 '22 01:10 GraysonWu

/test-multicluster-e2e

GraysonWu avatar Oct 21 '22 05:10 GraysonWu

/test-multicluster-e2e

GraysonWu avatar Oct 21 '22 06:10 GraysonWu

/test-multicluster-e2e

GraysonWu avatar Oct 25 '22 07:10 GraysonWu

/test-multicluster-e2e

GraysonWu avatar Nov 03 '22 12:11 GraysonWu

/test-multicluster-e2e

GraysonWu avatar Nov 10 '22 05:11 GraysonWu

Hi @wenyingd @hongliangl ,Could you help to take a look at StretchedNetworkPolicy agent part. @GraysonWu and @Dyanngg gave a presentation about the details of StretchedNetworkPolicy on community meeting. You can refer to the pdf and recording to understand the details.

luolanzone avatar Nov 11 '22 00:11 luolanzone