Add ClusterGroup CRD to group Pods based on labels or share IPBlock #1782
Labels
area/network-policy/api
Issues or PRs related to the network policy API.
kind/design
Categorizes issue or PR as related to design.
Milestone
Describe what you are trying to solve
Currently Antrea policies are responsible to specify the security rules that apply to workloads and also responsible to specify how to group the source and destination and the workloads to which the rules apply to. This grouping of workloads is done via the use of resource selectors (podSelector, namespaceSelector...) which has the capabilities of grouping resources by matching labels or expressions on those labels. In case the labels on the workloads are updated, user must go and update each and every policy to update those labelSelectors. Here we propose to separate the function of grouping of workloads from the security aspect of policy. Adding another level of indirection allows users to update grouping membership without having to update individual policy rules. The same applies to sharing of IPBlocks among ACNPs.
Describe the solution you have in mind
Introduce a new CRD to group and share Pods or IPBlock. The group workers can then independently sync the members for the ClusterGroup. These ClusterGroups can be referenced in the AppliedTo and ingress/egress rules of an Antrea ClusterNetworkPolicy in place of stand-alone labelSelectors. Any change in the selector or the IPBlock, can be changed in one place and then reflected in all the affected ClusterNetworkPolicies.
In addition to ClusterNetworkPolicies, these ClusterGroups can be referenced elsewhere in other CRDs as well.
Describe how your solution impacts user flows
Users are expected to create ClusterGroups to group workloads to which they intend to apply policies to. Once the CG are created, users must reference them in ClusterNetworkPolicies in place of stand alone selectors.
Users can continue using the stand alone selectors in policies, but they cannot use both a CG and stand alone selectors in a single ClusterNetworkPolicy.
Describe the main design/architecture of your solution
A CG CRD may look like below:
IPBlock cannot be set with PodSelector/NamespaceSelector.
The CG resource will support a
Status
sub resource to determine the overall status of the CG i.e. whether it has realized GroupMembers or still in Pending state.In addition to the
Status
, antrea-controller will also expose group-membership and group-association APIs.The text was updated successfully, but these errors were encountered: