forked from antrea-io/antrea
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not realize AntreaNetworkPolicy applied to Pods in other Namespace (…
…antrea-io#4119) When AntreaNetworkPolicy uses Group as AppliedTo, the Group should not select Pods in other Namespaces, otherwise the policy would be applied to other Namespaces. This was prevented by using a validation when creating AppliedToGroup for Group, which ensures that the Group doesn't have a NamespaceSelector. However, the validation could be bypassed by several approaches, the most straightforward one is to use a parent Group as AppliedTo and make one of its child Groups use NamespaceSelector. It's hard to cover all cases if the validation is only in the phase of creating AppliedToGroup because of its dynamic nature. This patch implements a validation when syncing AppliedToGroup. The validation ensures that the AppliedToGroup cannot have any members in other Namespaces if it's derived from a namespaced Group, regardless of the way by which the members are selected. The error encountered when syncing AppliedToGroup will be reflected in the statuses of the NetworkPolicies that use this AppliedToGroup. This patch also unifies the behavior of ClusterNetworkPolicy and AntreaNetworkPolicy when a ClusterGroup/Group used as AppliedTo contains IPBlocks only: it would be treated like empty AppliedTo in both cases. Fixes antrea-io#4116 Signed-off-by: Quan Tian <qtian@vmware.com> Signed-off-by: Quan Tian <qtian@vmware.com>
- Loading branch information
Showing
10 changed files
with
489 additions
and
308 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.