mirror of
https://github.com/open-cluster-management-io/ocm.git
synced 2026-02-14 18:09:57 +00:00
remove cel from placement decision group (#981)
Signed-off-by: Qing Hao <qhao@redhat.com>
This commit is contained in:
2
go.mod
2
go.mod
@@ -37,7 +37,7 @@ require (
|
||||
k8s.io/kube-aggregator v0.32.1
|
||||
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738
|
||||
open-cluster-management.io/addon-framework v0.12.1-0.20250407131028-9d436ffc2da7
|
||||
open-cluster-management.io/api v0.16.2-0.20250425084048-6c5efe2ab15d
|
||||
open-cluster-management.io/api v0.16.2-0.20250506092504-9143e192a0a7
|
||||
open-cluster-management.io/sdk-go v0.16.1-0.20250428032116-875454003818
|
||||
sigs.k8s.io/cluster-inventory-api v0.0.0-20240730014211-ef0154379848
|
||||
sigs.k8s.io/controller-runtime v0.20.2
|
||||
|
||||
4
go.sum
4
go.sum
@@ -487,8 +487,8 @@ k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6J
|
||||
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||
open-cluster-management.io/addon-framework v0.12.1-0.20250407131028-9d436ffc2da7 h1:oLu9ag44Msf56Hb19b/b+UTNq0J2l9rhlBQ1gh7izCU=
|
||||
open-cluster-management.io/addon-framework v0.12.1-0.20250407131028-9d436ffc2da7/go.mod h1:7AEw1Sq9UEWpQGTU8zV1XPNkFRBYPbyBh8tfhISV++s=
|
||||
open-cluster-management.io/api v0.16.2-0.20250425084048-6c5efe2ab15d h1:uowhuu3pDvGLMU9if/xdRr1IO+DPGlBUqcqd0SpMjqY=
|
||||
open-cluster-management.io/api v0.16.2-0.20250425084048-6c5efe2ab15d/go.mod h1:/OeqXycNBZQoe3WG6ghuWsMgsKGuMZrK8ZpsU6gWL0Y=
|
||||
open-cluster-management.io/api v0.16.2-0.20250506092504-9143e192a0a7 h1:UupwgKlXEy/uyIIy8L6AEIOQUsZkz259C7mr44pJKC0=
|
||||
open-cluster-management.io/api v0.16.2-0.20250506092504-9143e192a0a7/go.mod h1:/OeqXycNBZQoe3WG6ghuWsMgsKGuMZrK8ZpsU6gWL0Y=
|
||||
open-cluster-management.io/sdk-go v0.16.1-0.20250428032116-875454003818 h1:b7HpdTpKPzLEoJ5UtrXCed1PjxaKOxEboJ+kG6FZudI=
|
||||
open-cluster-management.io/sdk-go v0.16.1-0.20250428032116-875454003818/go.mod h1:n89YVVoi5zm3KVpOyVMmTdD4rGOVSsykUtu7Ol3do3M=
|
||||
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0 h1:CPT0ExVicCzcpeN4baWEV2ko2Z/AsiZgEdwgcfwLgMo=
|
||||
|
||||
@@ -121,16 +121,6 @@ spec:
|
||||
description: LabelSelector to select clusters subset
|
||||
by label.
|
||||
properties:
|
||||
celSelector:
|
||||
description: CelSelector represents a selector of
|
||||
ManagedClusters by CEL expressions on ManagedCluster
|
||||
fields
|
||||
properties:
|
||||
celExpressions:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
type: object
|
||||
claimSelector:
|
||||
description: ClaimSelector represents a selector
|
||||
of ManagedClusters by clusterClaims in status
|
||||
|
||||
@@ -779,12 +779,16 @@ func calculateLength(intOrStr *intstr.IntOrString, total int) (int, *framework.S
|
||||
|
||||
// filterClustersBySelector filters clusters based on the provided label selector and returns the matched clusters.
|
||||
func filterClustersBySelector(
|
||||
selector clusterapiv1beta1.ClusterSelector,
|
||||
groupSelector clusterapiv1beta1.GroupClusterSelector,
|
||||
clusters []*clusterapiv1.ManagedCluster,
|
||||
clusterNames sets.Set[string],
|
||||
) ([]clusterapiv1beta1.ClusterDecision, *framework.Status) {
|
||||
var matched []clusterapiv1beta1.ClusterDecision
|
||||
// set CEL env to nil since placement decision groups do not support CEL expressions.
|
||||
selector := clusterapiv1beta1.ClusterSelector{
|
||||
LabelSelector: groupSelector.LabelSelector,
|
||||
ClaimSelector: groupSelector.ClaimSelector,
|
||||
}
|
||||
clusterSelector, err := helpers.NewClusterSelector(selector, nil, nil)
|
||||
if err != nil {
|
||||
status := framework.NewStatus("", framework.Misconfigured, err.Error())
|
||||
|
||||
@@ -158,7 +158,7 @@ func TestSchedulingController_sync(t *testing.T) {
|
||||
DecisionGroups: []clusterapiv1beta1.DecisionGroup{
|
||||
{
|
||||
GroupName: "canary",
|
||||
ClusterSelector: clusterapiv1beta1.ClusterSelector{
|
||||
ClusterSelector: clusterapiv1beta1.GroupClusterSelector{
|
||||
LabelSelector: metav1.LabelSelector{MatchLabels: map[string]string{"cloud": "Azure"}},
|
||||
},
|
||||
},
|
||||
@@ -236,13 +236,13 @@ func TestSchedulingController_sync(t *testing.T) {
|
||||
DecisionGroups: []clusterapiv1beta1.DecisionGroup{
|
||||
{
|
||||
GroupName: "group1",
|
||||
ClusterSelector: clusterapiv1beta1.ClusterSelector{
|
||||
ClusterSelector: clusterapiv1beta1.GroupClusterSelector{
|
||||
LabelSelector: metav1.LabelSelector{MatchLabels: map[string]string{"cloud": "Amazon"}},
|
||||
},
|
||||
},
|
||||
{
|
||||
GroupName: "group2",
|
||||
ClusterSelector: clusterapiv1beta1.ClusterSelector{
|
||||
ClusterSelector: clusterapiv1beta1.GroupClusterSelector{
|
||||
LabelSelector: metav1.LabelSelector{MatchLabels: map[string]string{"cloud": "Azure"}},
|
||||
},
|
||||
},
|
||||
@@ -1071,7 +1071,7 @@ func TestBind(t *testing.T) {
|
||||
DecisionGroups: []clusterapiv1beta1.DecisionGroup{
|
||||
{
|
||||
GroupName: "canary",
|
||||
ClusterSelector: clusterapiv1beta1.ClusterSelector{
|
||||
ClusterSelector: clusterapiv1beta1.GroupClusterSelector{
|
||||
LabelSelector: metav1.LabelSelector{MatchLabels: map[string]string{"cloud": "Azure"}},
|
||||
},
|
||||
},
|
||||
@@ -1144,7 +1144,7 @@ func TestBind(t *testing.T) {
|
||||
DecisionGroups: []clusterapiv1beta1.DecisionGroup{
|
||||
{
|
||||
GroupName: "canary",
|
||||
ClusterSelector: clusterapiv1beta1.ClusterSelector{
|
||||
ClusterSelector: clusterapiv1beta1.GroupClusterSelector{
|
||||
LabelSelector: metav1.LabelSelector{MatchLabels: map[string]string{"cloud": "Azure"}},
|
||||
},
|
||||
},
|
||||
@@ -1177,13 +1177,13 @@ func TestBind(t *testing.T) {
|
||||
DecisionGroups: []clusterapiv1beta1.DecisionGroup{
|
||||
{
|
||||
GroupName: "group1",
|
||||
ClusterSelector: clusterapiv1beta1.ClusterSelector{
|
||||
ClusterSelector: clusterapiv1beta1.GroupClusterSelector{
|
||||
LabelSelector: metav1.LabelSelector{MatchLabels: map[string]string{"cloud": "Amazon"}},
|
||||
},
|
||||
},
|
||||
{
|
||||
GroupName: "group2",
|
||||
ClusterSelector: clusterapiv1beta1.ClusterSelector{
|
||||
ClusterSelector: clusterapiv1beta1.GroupClusterSelector{
|
||||
LabelSelector: metav1.LabelSelector{MatchLabels: map[string]string{"cloud": "Azure"}},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -311,7 +311,7 @@ var _ = ginkgo.Describe("Placement", func() {
|
||||
DecisionGroups: []clusterapiv1beta1.DecisionGroup{
|
||||
{
|
||||
GroupName: "canary",
|
||||
ClusterSelector: clusterapiv1beta1.ClusterSelector{
|
||||
ClusterSelector: clusterapiv1beta1.GroupClusterSelector{
|
||||
LabelSelector: metav1.LabelSelector{MatchLabels: map[string]string{"vendor": "openShift"}},
|
||||
},
|
||||
},
|
||||
|
||||
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@@ -1714,7 +1714,7 @@ open-cluster-management.io/addon-framework/pkg/agent
|
||||
open-cluster-management.io/addon-framework/pkg/assets
|
||||
open-cluster-management.io/addon-framework/pkg/index
|
||||
open-cluster-management.io/addon-framework/pkg/utils
|
||||
# open-cluster-management.io/api v0.16.2-0.20250425084048-6c5efe2ab15d
|
||||
# open-cluster-management.io/api v0.16.2-0.20250506092504-9143e192a0a7
|
||||
## explicit; go 1.23.6
|
||||
open-cluster-management.io/api/addon/v1alpha1
|
||||
open-cluster-management.io/api/client/addon/clientset/versioned
|
||||
|
||||
@@ -121,16 +121,6 @@ spec:
|
||||
description: LabelSelector to select clusters subset
|
||||
by label.
|
||||
properties:
|
||||
celSelector:
|
||||
description: CelSelector represents a selector of
|
||||
ManagedClusters by CEL expressions on ManagedCluster
|
||||
fields
|
||||
properties:
|
||||
celExpressions:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
type: object
|
||||
claimSelector:
|
||||
description: ClaimSelector represents a selector
|
||||
of ManagedClusters by clusterClaims in status
|
||||
|
||||
14
vendor/open-cluster-management.io/api/cluster/v1beta1/types_placement.go
generated
vendored
14
vendor/open-cluster-management.io/api/cluster/v1beta1/types_placement.go
generated
vendored
@@ -112,7 +112,19 @@ type DecisionGroup struct {
|
||||
// LabelSelector to select clusters subset by label.
|
||||
// +kubebuilder:validation:Required
|
||||
// +required
|
||||
ClusterSelector ClusterSelector `json:"groupClusterSelector,omitempty"`
|
||||
ClusterSelector GroupClusterSelector `json:"groupClusterSelector,omitempty"`
|
||||
}
|
||||
|
||||
// GroupClusterSelector represents the AND of the containing selectors for groupClusterSelector. An empty group cluster selector matches all objects.
|
||||
// A null group cluster selector matches no objects.
|
||||
type GroupClusterSelector struct {
|
||||
// LabelSelector represents a selector of ManagedClusters by label
|
||||
// +optional
|
||||
LabelSelector metav1.LabelSelector `json:"labelSelector,omitempty"`
|
||||
|
||||
// ClaimSelector represents a selector of ManagedClusters by clusterClaims in status
|
||||
// +optional
|
||||
ClaimSelector ClusterClaimSelector `json:"claimSelector,omitempty"`
|
||||
}
|
||||
|
||||
// Group the created placementDecision into decision groups based on the number of clusters per decision group.
|
||||
|
||||
18
vendor/open-cluster-management.io/api/cluster/v1beta1/zz_generated.deepcopy.go
generated
vendored
18
vendor/open-cluster-management.io/api/cluster/v1beta1/zz_generated.deepcopy.go
generated
vendored
@@ -177,6 +177,24 @@ func (in *DecisionStrategy) DeepCopy() *DecisionStrategy {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *GroupClusterSelector) DeepCopyInto(out *GroupClusterSelector) {
|
||||
*out = *in
|
||||
in.LabelSelector.DeepCopyInto(&out.LabelSelector)
|
||||
in.ClaimSelector.DeepCopyInto(&out.ClaimSelector)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GroupClusterSelector.
|
||||
func (in *GroupClusterSelector) DeepCopy() *GroupClusterSelector {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(GroupClusterSelector)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *GroupStrategy) DeepCopyInto(out *GroupStrategy) {
|
||||
*out = *in
|
||||
|
||||
@@ -89,6 +89,16 @@ func (DecisionStrategy) SwaggerDoc() map[string]string {
|
||||
return map_DecisionStrategy
|
||||
}
|
||||
|
||||
var map_GroupClusterSelector = map[string]string{
|
||||
"": "GroupClusterSelector represents the AND of the containing selectors for groupClusterSelector. An empty group cluster selector matches all objects. A null group cluster selector matches no objects.",
|
||||
"labelSelector": "LabelSelector represents a selector of ManagedClusters by label",
|
||||
"claimSelector": "ClaimSelector represents a selector of ManagedClusters by clusterClaims in status",
|
||||
}
|
||||
|
||||
func (GroupClusterSelector) SwaggerDoc() map[string]string {
|
||||
return map_GroupClusterSelector
|
||||
}
|
||||
|
||||
var map_GroupStrategy = map[string]string{
|
||||
"": "Group the created placementDecision into decision groups based on the number of clusters per decision group.",
|
||||
"decisionGroups": "DecisionGroups represents a list of predefined groups to put decision results. Decision groups will be constructed based on the DecisionGroups field at first. The clusters not included in the DecisionGroups will be divided to other decision groups afterwards. Each decision group should not have the number of clusters larger than the ClustersPerDecisionGroup.",
|
||||
|
||||
Reference in New Issue
Block a user