Skip to content

Commit

Permalink
Add same-labels e2e testcase
Browse files Browse the repository at this point in the history
Signed-off-by: Dyanngg <[email protected]>
  • Loading branch information
Dyanngg committed Jan 18, 2023
1 parent cdf7892 commit 7eb27f7
Show file tree
Hide file tree
Showing 7 changed files with 295 additions and 39 deletions.
96 changes: 80 additions & 16 deletions multicluster/build/yamls/antrea-multicluster-leader-global.yml
Original file line number Diff line number Diff line change
Expand Up @@ -935,9 +935,17 @@ spec:
ingress/egress rules. Cannot be set with NamespaceSelector.'
properties:
match:
description: NamespaceMatchType describes Namespace
matching strategy.
description: Selects from the same Namespace of
the appliedTo workloads.
type: string
sameLabels:
description: Selects Namespaces that share the
same values for the given set of label keys
with the appliedTo Namespace. Namespaces must
have all the label keys.
items:
type: string
type: array
type: object
nodeSelector:
description: Select certain Nodes which match the
Expand Down Expand Up @@ -1315,9 +1323,17 @@ spec:
ingress/egress rules. Cannot be set with NamespaceSelector.'
properties:
match:
description: NamespaceMatchType describes Namespace
matching strategy.
description: Selects from the same Namespace of
the appliedTo workloads.
type: string
sameLabels:
description: Selects Namespaces that share the
same values for the given set of label keys
with the appliedTo Namespace. Namespaces must
have all the label keys.
items:
type: string
type: array
type: object
nodeSelector:
description: Select certain Nodes which match the
Expand Down Expand Up @@ -1823,9 +1839,17 @@ spec:
ingress/egress rules. Cannot be set with NamespaceSelector.'
properties:
match:
description: NamespaceMatchType describes Namespace
matching strategy.
description: Selects from the same Namespace of
the appliedTo workloads.
type: string
sameLabels:
description: Selects Namespaces that share the
same values for the given set of label keys
with the appliedTo Namespace. Namespaces must
have all the label keys.
items:
type: string
type: array
type: object
nodeSelector:
description: Select certain Nodes which match the
Expand Down Expand Up @@ -2203,9 +2227,17 @@ spec:
ingress/egress rules. Cannot be set with NamespaceSelector.'
properties:
match:
description: NamespaceMatchType describes Namespace
matching strategy.
description: Selects from the same Namespace of
the appliedTo workloads.
type: string
sameLabels:
description: Selects Namespaces that share the
same values for the given set of label keys
with the appliedTo Namespace. Namespaces must
have all the label keys.
items:
type: string
type: array
type: object
nodeSelector:
description: Select certain Nodes which match the
Expand Down Expand Up @@ -3627,9 +3659,17 @@ spec:
ingress/egress rules. Cannot be set with NamespaceSelector.'
properties:
match:
description: NamespaceMatchType describes Namespace
matching strategy.
description: Selects from the same Namespace of
the appliedTo workloads.
type: string
sameLabels:
description: Selects Namespaces that share the
same values for the given set of label keys
with the appliedTo Namespace. Namespaces must
have all the label keys.
items:
type: string
type: array
type: object
nodeSelector:
description: Select certain Nodes which match the
Expand Down Expand Up @@ -4007,9 +4047,17 @@ spec:
ingress/egress rules. Cannot be set with NamespaceSelector.'
properties:
match:
description: NamespaceMatchType describes Namespace
matching strategy.
description: Selects from the same Namespace of
the appliedTo workloads.
type: string
sameLabels:
description: Selects Namespaces that share the
same values for the given set of label keys
with the appliedTo Namespace. Namespaces must
have all the label keys.
items:
type: string
type: array
type: object
nodeSelector:
description: Select certain Nodes which match the
Expand Down Expand Up @@ -4515,9 +4563,17 @@ spec:
ingress/egress rules. Cannot be set with NamespaceSelector.'
properties:
match:
description: NamespaceMatchType describes Namespace
matching strategy.
description: Selects from the same Namespace of
the appliedTo workloads.
type: string
sameLabels:
description: Selects Namespaces that share the
same values for the given set of label keys
with the appliedTo Namespace. Namespaces must
have all the label keys.
items:
type: string
type: array
type: object
nodeSelector:
description: Select certain Nodes which match the
Expand Down Expand Up @@ -4895,9 +4951,17 @@ spec:
ingress/egress rules. Cannot be set with NamespaceSelector.'
properties:
match:
description: NamespaceMatchType describes Namespace
matching strategy.
description: Selects from the same Namespace of
the appliedTo workloads.
type: string
sameLabels:
description: Selects Namespaces that share the
same values for the given set of label keys
with the appliedTo Namespace. Namespaces must
have all the label keys.
items:
type: string
type: array
type: object
nodeSelector:
description: Select certain Nodes which match the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -630,9 +630,17 @@ spec:
ingress/egress rules. Cannot be set with NamespaceSelector.'
properties:
match:
description: NamespaceMatchType describes Namespace
matching strategy.
description: Selects from the same Namespace of
the appliedTo workloads.
type: string
sameLabels:
description: Selects Namespaces that share the
same values for the given set of label keys
with the appliedTo Namespace. Namespaces must
have all the label keys.
items:
type: string
type: array
type: object
nodeSelector:
description: Select certain Nodes which match the
Expand Down Expand Up @@ -1010,9 +1018,17 @@ spec:
ingress/egress rules. Cannot be set with NamespaceSelector.'
properties:
match:
description: NamespaceMatchType describes Namespace
matching strategy.
description: Selects from the same Namespace of
the appliedTo workloads.
type: string
sameLabels:
description: Selects Namespaces that share the
same values for the given set of label keys
with the appliedTo Namespace. Namespaces must
have all the label keys.
items:
type: string
type: array
type: object
nodeSelector:
description: Select certain Nodes which match the
Expand Down Expand Up @@ -1518,9 +1534,17 @@ spec:
ingress/egress rules. Cannot be set with NamespaceSelector.'
properties:
match:
description: NamespaceMatchType describes Namespace
matching strategy.
description: Selects from the same Namespace of
the appliedTo workloads.
type: string
sameLabels:
description: Selects Namespaces that share the
same values for the given set of label keys
with the appliedTo Namespace. Namespaces must
have all the label keys.
items:
type: string
type: array
type: object
nodeSelector:
description: Select certain Nodes which match the
Expand Down Expand Up @@ -1898,9 +1922,17 @@ spec:
ingress/egress rules. Cannot be set with NamespaceSelector.'
properties:
match:
description: NamespaceMatchType describes Namespace
matching strategy.
description: Selects from the same Namespace of
the appliedTo workloads.
type: string
sameLabels:
description: Selects Namespaces that share the
same values for the given set of label keys
with the appliedTo Namespace. Namespaces must
have all the label keys.
items:
type: string
type: array
type: object
nodeSelector:
description: Select certain Nodes which match the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -628,9 +628,17 @@ spec:
ingress/egress rules. Cannot be set with NamespaceSelector.'
properties:
match:
description: NamespaceMatchType describes Namespace
matching strategy.
description: Selects from the same Namespace of
the appliedTo workloads.
type: string
sameLabels:
description: Selects Namespaces that share the
same values for the given set of label keys
with the appliedTo Namespace. Namespaces must
have all the label keys.
items:
type: string
type: array
type: object
nodeSelector:
description: Select certain Nodes which match the
Expand Down Expand Up @@ -1008,9 +1016,17 @@ spec:
ingress/egress rules. Cannot be set with NamespaceSelector.'
properties:
match:
description: NamespaceMatchType describes Namespace
matching strategy.
description: Selects from the same Namespace of
the appliedTo workloads.
type: string
sameLabels:
description: Selects Namespaces that share the
same values for the given set of label keys
with the appliedTo Namespace. Namespaces must
have all the label keys.
items:
type: string
type: array
type: object
nodeSelector:
description: Select certain Nodes which match the
Expand Down Expand Up @@ -1516,9 +1532,17 @@ spec:
ingress/egress rules. Cannot be set with NamespaceSelector.'
properties:
match:
description: NamespaceMatchType describes Namespace
matching strategy.
description: Selects from the same Namespace of
the appliedTo workloads.
type: string
sameLabels:
description: Selects Namespaces that share the
same values for the given set of label keys
with the appliedTo Namespace. Namespaces must
have all the label keys.
items:
type: string
type: array
type: object
nodeSelector:
description: Select certain Nodes which match the
Expand Down Expand Up @@ -1896,9 +1920,17 @@ spec:
ingress/egress rules. Cannot be set with NamespaceSelector.'
properties:
match:
description: NamespaceMatchType describes Namespace
matching strategy.
description: Selects from the same Namespace of
the appliedTo workloads.
type: string
sameLabels:
description: Selects Namespaces that share the
same values for the given set of label keys
with the appliedTo Namespace. Namespaces must
have all the label keys.
items:
type: string
type: array
type: object
nodeSelector:
description: Select certain Nodes which match the
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/networkpolicy/clusternetworkpolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (n *NetworkPolicyController) filterPerNamespaceRuleACNPsByNSLabels(nsLabels

peerNamespacesSelectorExists := func(peers []crdv1alpha1.NetworkPolicyPeer) bool {
for _, peer := range peers {
if peer.Namespaces != nil && peer.Namespaces.Match == crdv1alpha1.NamespaceMatchSelf {
if peer.Namespaces != nil {
return true
}
}
Expand Down
Loading

0 comments on commit 7eb27f7

Please sign in to comment.