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
Fix ClusterSet scoped policy rule not compatible with namespaces
field
#4571
Conversation
/test-multicluster-e2e |
Codecov Report
@@ Coverage Diff @@
## main #4571 +/- ##
==========================================
+ Coverage 68.65% 69.84% +1.18%
==========================================
Files 402 415 +13
Lines 59570 58692 -878
==========================================
+ Hits 40900 40995 +95
+ Misses 15847 14912 -935
+ Partials 2823 2785 -38
*This pull request uses carry forward flags. Click here to find out more.
|
c587578
to
210a517
Compare
/test-multicluster-e2e |
c8fd3d0
to
8a03a27
Compare
/skip-all /test-multicluster-e2e |
ecc5e0d
to
5a71a19
Compare
/test-all /test-multicluster-e2e |
namespaces
field
5a71a19
to
0381965
Compare
/test-all /test-multicluster-e2e |
/test-all /test-multicluster-e2e /test-windows-e2e |
151c919
to
835f99b
Compare
/test-multicluster-e2e |
835f99b
to
ddf61a1
Compare
/test-multicluster-e2e |
/test-all /test-windows-e2e |
ddf61a1
to
a8e6a7f
Compare
/test-all /test-multicluster-e2e /test-windows-e2e |
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, some minor comments
/test-all /test-multicluster-e2e /test-windows-e2e |
c1a102a
to
e4fcc23
Compare
/test-all /test-multicluster-e2e /test-windows-e2e |
/test-multicluster-e2e |
/test-all /test-multicluster-e2e /test-windows-e2e |
@@ -152,17 +155,19 @@ func (n *NetworkPolicyController) toAntreaPeerForCRD(peers []v1alpha1.NetworkPol | |||
// For other cases it uses the IPBlock "0.0.0.0/0" to avoid the overhead | |||
// of handling member updates of the AddressGroup. | |||
if dir == controlplane.DirectionIn || !namedPortExists { | |||
return &matchAllPeer, nil | |||
return &matchAllPeer, nil, sets.NewString() |
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.
return &matchAllPeer, nil, sets.NewString() | |
return &matchAllPeer, nil, nil |
no need to allocate a new map
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 was doing this to avoid nil checks from the caller side. Changed.
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.
nil map or nil slice is not writable but readable, so there was no difference from caller's perspective regardless whether it returns empty or nil map but returning nil map can save an allocation. But the additional nil check added in the latest code could avoid another self-copy, which is better from performance's perspective.
Signed-off-by: Dyanngg <dingyang@vmware.com>
Signed-off-by: Dyanngg <dingyang@vmware.com>
Signed-off-by: Dyanngg <dingyang@vmware.com>
Signed-off-by: Dyanngg <dingyang@vmware.com>
Signed-off-by: Dyanngg <dingyang@vmware.com>
36acb08
to
1910b2e
Compare
/test-all /test-multicluster-e2e |
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
/test-all /test-multicluster-e2e |
…eld (antrea-io#4571) Signed-off-by: Dyanngg <dingyang@vmware.com>
Fixes #4563
Antrea-native policies support the use of
namespaces
field in ingress/egressrules to create per-namespace policy rules, which is useful for creating Namespace
level isolation. This field did not work with MultiCluster NetworkPolicy. This PR adds
the support so that cross-cluster Namespace isolation can be achieved.
In addition, this PR also adds a commit to assign unique podCIDR for member clusters
of the e2e test MCS deployment, which is the pre-req for Pod-to-Pod connectivity.
This enables the new testcase for cross-cluster Namespace isolation to be run correctly.
Signed-off-by: Dyanngg dingyang@vmware.com