diff --git a/apis/kueue/v1beta1/clusterqueue_types.go b/apis/kueue/v1beta1/clusterqueue_types.go index 04060ce3b6..ff2893f672 100644 --- a/apis/kueue/v1beta1/clusterqueue_types.go +++ b/apis/kueue/v1beta1/clusterqueue_types.go @@ -101,7 +101,7 @@ type ClusterQueueSpec struct { // admissionCheckStrategy defines a list of strategies to determine which ResourceFlavors require AdmissionChecks. // This property cannot be used in conjunction with the 'admissionChecks' property. // +optional - AdmissionCheckStrategy []AdmissionCheckStrategy `json:"admissionCheckStrategy,omitempty"` + AdmissionChecksStrategy AdmissionChecksStrategy `json:"admissionChecksStrategy,omitempty"` // stopPolicy - if set to a value different from None, the ClusterQueue is considered Inactive, no new reservation being // made. @@ -119,7 +119,13 @@ type ClusterQueueSpec struct { } // AdmissionCheckStrategy defines a strategy for a AdmissionCheck. -type AdmissionCheckStrategy struct { +type AdmissionChecksStrategy struct { + // admissionChecks is a list of strategies for AdmissionChecks + AdmissionChecks []AdmissionCheckStrategyRule `json:"admissionChecks,omitempty"` +} + +// AdmissionCheckStrategyRule defines rules for a single AdmissionCheck +type AdmissionCheckStrategyRule struct { // name is an AdmissionCheck's name. Name string `json:"name"` diff --git a/apis/kueue/v1beta1/zz_generated.deepcopy.go b/apis/kueue/v1beta1/zz_generated.deepcopy.go index 4d3e461097..70d6ad87f3 100644 --- a/apis/kueue/v1beta1/zz_generated.deepcopy.go +++ b/apis/kueue/v1beta1/zz_generated.deepcopy.go @@ -193,7 +193,7 @@ func (in *AdmissionCheckStatus) DeepCopy() *AdmissionCheckStatus { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AdmissionCheckStrategy) DeepCopyInto(out *AdmissionCheckStrategy) { +func (in *AdmissionCheckStrategyRule) DeepCopyInto(out *AdmissionCheckStrategyRule) { *out = *in if in.OnFlavors != nil { in, out := &in.OnFlavors, &out.OnFlavors @@ -202,12 +202,34 @@ func (in *AdmissionCheckStrategy) DeepCopyInto(out *AdmissionCheckStrategy) { } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AdmissionCheckStrategy. -func (in *AdmissionCheckStrategy) DeepCopy() *AdmissionCheckStrategy { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AdmissionCheckStrategyRule. +func (in *AdmissionCheckStrategyRule) DeepCopy() *AdmissionCheckStrategyRule { if in == nil { return nil } - out := new(AdmissionCheckStrategy) + out := new(AdmissionCheckStrategyRule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AdmissionChecksStrategy) DeepCopyInto(out *AdmissionChecksStrategy) { + *out = *in + if in.AdmissionChecks != nil { + in, out := &in.AdmissionChecks, &out.AdmissionChecks + *out = make([]AdmissionCheckStrategyRule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AdmissionChecksStrategy. +func (in *AdmissionChecksStrategy) DeepCopy() *AdmissionChecksStrategy { + if in == nil { + return nil + } + out := new(AdmissionChecksStrategy) in.DeepCopyInto(out) return out } @@ -377,13 +399,7 @@ func (in *ClusterQueueSpec) DeepCopyInto(out *ClusterQueueSpec) { *out = make([]string, len(*in)) copy(*out, *in) } - if in.AdmissionCheckStrategy != nil { - in, out := &in.AdmissionCheckStrategy, &out.AdmissionCheckStrategy - *out = make([]AdmissionCheckStrategy, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } + in.AdmissionChecksStrategy.DeepCopyInto(&out.AdmissionChecksStrategy) if in.StopPolicy != nil { in, out := &in.StopPolicy, &out.StopPolicy *out = new(StopPolicy) diff --git a/charts/kueue/templates/crd/kueue.x-k8s.io_clusterqueues.yaml b/charts/kueue/templates/crd/kueue.x-k8s.io_clusterqueues.yaml index b649814c94..e8ee8a9994 100644 --- a/charts/kueue/templates/crd/kueue.x-k8s.io_clusterqueues.yaml +++ b/charts/kueue/templates/crd/kueue.x-k8s.io_clusterqueues.yaml @@ -73,28 +73,6 @@ spec: spec: description: ClusterQueueSpec defines the desired state of ClusterQueue properties: - admissionCheckStrategy: - description: |- - admissionCheckStrategy defines a list of strategies to determine which ResourceFlavors require AdmissionChecks. - This property cannot be used in conjunction with the 'admissionChecks' property. - items: - description: AdmissionCheckStrategy defines a strategy for a AdmissionCheck. - properties: - name: - description: name is an AdmissionCheck's name. - type: string - onFlavors: - description: |- - onFlavors is a list of ResourceFlavors' names that this AdmissionCheck should run for. - If empty, the AdmissionCheck will run for all workloads submitted to the ClusterQueue. - items: - type: string - type: array - required: - - name - - onFlavors - type: object - type: array admissionChecks: description: |- admissionChecks lists the AdmissionChecks required by this ClusterQueue. @@ -102,6 +80,33 @@ spec: items: type: string type: array + admissionChecksStrategy: + description: |- + admissionCheckStrategy defines a list of strategies to determine which ResourceFlavors require AdmissionChecks. + This property cannot be used in conjunction with the 'admissionChecks' property. + properties: + admissionChecks: + description: admissionChecks is a list of strategies for AdmissionChecks + items: + description: AdmissionCheckStrategyRule defines rules for a + single AdmissionCheck + properties: + name: + description: name is an AdmissionCheck's name. + type: string + onFlavors: + description: |- + onFlavors is a list of ResourceFlavors' names that this AdmissionCheck should run for. + If empty, the AdmissionCheck will run for all workloads submitted to the ClusterQueue. + items: + type: string + type: array + required: + - name + - onFlavors + type: object + type: array + type: object cohort: description: |- cohort that this ClusterQueue belongs to. CQs that belong to the diff --git a/client-go/applyconfiguration/kueue/v1beta1/admissioncheckstrategy.go b/client-go/applyconfiguration/kueue/v1beta1/admissioncheckstrategy.go deleted file mode 100644 index c0094362d3..0000000000 --- a/client-go/applyconfiguration/kueue/v1beta1/admissioncheckstrategy.go +++ /dev/null @@ -1,49 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1beta1 - -// AdmissionCheckStrategyApplyConfiguration represents an declarative configuration of the AdmissionCheckStrategy type for use -// with apply. -type AdmissionCheckStrategyApplyConfiguration struct { - Name *string `json:"name,omitempty"` - OnFlavors []string `json:"onFlavors,omitempty"` -} - -// AdmissionCheckStrategyApplyConfiguration constructs an declarative configuration of the AdmissionCheckStrategy type for use with -// apply. -func AdmissionCheckStrategy() *AdmissionCheckStrategyApplyConfiguration { - return &AdmissionCheckStrategyApplyConfiguration{} -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *AdmissionCheckStrategyApplyConfiguration) WithName(value string) *AdmissionCheckStrategyApplyConfiguration { - b.Name = &value - return b -} - -// WithOnFlavors adds the given value to the OnFlavors field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the OnFlavors field. -func (b *AdmissionCheckStrategyApplyConfiguration) WithOnFlavors(values ...string) *AdmissionCheckStrategyApplyConfiguration { - for i := range values { - b.OnFlavors = append(b.OnFlavors, values[i]) - } - return b -} diff --git a/client-go/applyconfiguration/kueue/v1beta1/clusterqueuespec.go b/client-go/applyconfiguration/kueue/v1beta1/clusterqueuespec.go index 14c59ec60d..1ae653aa53 100644 --- a/client-go/applyconfiguration/kueue/v1beta1/clusterqueuespec.go +++ b/client-go/applyconfiguration/kueue/v1beta1/clusterqueuespec.go @@ -25,15 +25,15 @@ import ( // ClusterQueueSpecApplyConfiguration represents an declarative configuration of the ClusterQueueSpec type for use // with apply. type ClusterQueueSpecApplyConfiguration struct { - ResourceGroups []ResourceGroupApplyConfiguration `json:"resourceGroups,omitempty"` - Cohort *string `json:"cohort,omitempty"` - QueueingStrategy *kueuev1beta1.QueueingStrategy `json:"queueingStrategy,omitempty"` - NamespaceSelector *v1.LabelSelector `json:"namespaceSelector,omitempty"` - FlavorFungibility *FlavorFungibilityApplyConfiguration `json:"flavorFungibility,omitempty"` - Preemption *ClusterQueuePreemptionApplyConfiguration `json:"preemption,omitempty"` - AdmissionChecks []string `json:"admissionChecks,omitempty"` - AdmissionCheckStrategy []AdmissionCheckStrategyApplyConfiguration `json:"admissionCheckStrategy,omitempty"` - StopPolicy *kueuev1beta1.StopPolicy `json:"stopPolicy,omitempty"` + ResourceGroups []ResourceGroupApplyConfiguration `json:"resourceGroups,omitempty"` + Cohort *string `json:"cohort,omitempty"` + QueueingStrategy *kueuev1beta1.QueueingStrategy `json:"queueingStrategy,omitempty"` + NamespaceSelector *v1.LabelSelector `json:"namespaceSelector,omitempty"` + FlavorFungibility *FlavorFungibilityApplyConfiguration `json:"flavorFungibility,omitempty"` + Preemption *ClusterQueuePreemptionApplyConfiguration `json:"preemption,omitempty"` + AdmissionChecks []string `json:"admissionChecks,omitempty"` + AdmissionChecksStrategy *AdmissionChecksStrategyApplyConfiguration `json:"admissionChecksStrategy,omitempty"` + StopPolicy *kueuev1beta1.StopPolicy `json:"stopPolicy,omitempty"` } // ClusterQueueSpecApplyConfiguration constructs an declarative configuration of the ClusterQueueSpec type for use with @@ -105,16 +105,11 @@ func (b *ClusterQueueSpecApplyConfiguration) WithAdmissionChecks(values ...strin return b } -// WithAdmissionCheckStrategy adds the given value to the AdmissionCheckStrategy field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the AdmissionCheckStrategy field. -func (b *ClusterQueueSpecApplyConfiguration) WithAdmissionCheckStrategy(values ...*AdmissionCheckStrategyApplyConfiguration) *ClusterQueueSpecApplyConfiguration { - for i := range values { - if values[i] == nil { - panic("nil value passed to WithAdmissionCheckStrategy") - } - b.AdmissionCheckStrategy = append(b.AdmissionCheckStrategy, *values[i]) - } +// WithAdmissionChecksStrategy sets the AdmissionChecksStrategy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AdmissionChecksStrategy field is set to the value of the last call. +func (b *ClusterQueueSpecApplyConfiguration) WithAdmissionChecksStrategy(value *AdmissionChecksStrategyApplyConfiguration) *ClusterQueueSpecApplyConfiguration { + b.AdmissionChecksStrategy = value return b } diff --git a/client-go/applyconfiguration/utils.go b/client-go/applyconfiguration/utils.go index 9e6fc3ab2c..8bd03f6f73 100644 --- a/client-go/applyconfiguration/utils.go +++ b/client-go/applyconfiguration/utils.go @@ -54,12 +54,14 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &kueuev1beta1.AdmissionCheckParametersReferenceApplyConfiguration{} case v1beta1.SchemeGroupVersion.WithKind("AdmissionCheckSpec"): return &kueuev1beta1.AdmissionCheckSpecApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("AdmissionChecksStrategy"): + return &kueuev1beta1.AdmissionChecksStrategyApplyConfiguration{} case v1beta1.SchemeGroupVersion.WithKind("AdmissionCheckState"): return &kueuev1beta1.AdmissionCheckStateApplyConfiguration{} case v1beta1.SchemeGroupVersion.WithKind("AdmissionCheckStatus"): return &kueuev1beta1.AdmissionCheckStatusApplyConfiguration{} - case v1beta1.SchemeGroupVersion.WithKind("AdmissionCheckStrategy"): - return &kueuev1beta1.AdmissionCheckStrategyApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("AdmissionCheckStrategyRule"): + return &kueuev1beta1.AdmissionCheckStrategyRuleApplyConfiguration{} case v1beta1.SchemeGroupVersion.WithKind("BorrowWithinCohort"): return &kueuev1beta1.BorrowWithinCohortApplyConfiguration{} case v1beta1.SchemeGroupVersion.WithKind("ClusterQueue"): diff --git a/config/components/crd/bases/kueue.x-k8s.io_clusterqueues.yaml b/config/components/crd/bases/kueue.x-k8s.io_clusterqueues.yaml index 4995dc834f..7b707772f3 100644 --- a/config/components/crd/bases/kueue.x-k8s.io_clusterqueues.yaml +++ b/config/components/crd/bases/kueue.x-k8s.io_clusterqueues.yaml @@ -58,28 +58,6 @@ spec: spec: description: ClusterQueueSpec defines the desired state of ClusterQueue properties: - admissionCheckStrategy: - description: |- - admissionCheckStrategy defines a list of strategies to determine which ResourceFlavors require AdmissionChecks. - This property cannot be used in conjunction with the 'admissionChecks' property. - items: - description: AdmissionCheckStrategy defines a strategy for a AdmissionCheck. - properties: - name: - description: name is an AdmissionCheck's name. - type: string - onFlavors: - description: |- - onFlavors is a list of ResourceFlavors' names that this AdmissionCheck should run for. - If empty, the AdmissionCheck will run for all workloads submitted to the ClusterQueue. - items: - type: string - type: array - required: - - name - - onFlavors - type: object - type: array admissionChecks: description: |- admissionChecks lists the AdmissionChecks required by this ClusterQueue. @@ -87,6 +65,33 @@ spec: items: type: string type: array + admissionChecksStrategy: + description: |- + admissionCheckStrategy defines a list of strategies to determine which ResourceFlavors require AdmissionChecks. + This property cannot be used in conjunction with the 'admissionChecks' property. + properties: + admissionChecks: + description: admissionChecks is a list of strategies for AdmissionChecks + items: + description: AdmissionCheckStrategyRule defines rules for a + single AdmissionCheck + properties: + name: + description: name is an AdmissionCheck's name. + type: string + onFlavors: + description: |- + onFlavors is a list of ResourceFlavors' names that this AdmissionCheck should run for. + If empty, the AdmissionCheck will run for all workloads submitted to the ClusterQueue. + items: + type: string + type: array + required: + - name + - onFlavors + type: object + type: array + type: object cohort: description: |- cohort that this ClusterQueue belongs to. CQs that belong to the diff --git a/pkg/controller/core/workload_controller.go b/pkg/controller/core/workload_controller.go index 9f587c7609..7044db5027 100644 --- a/pkg/controller/core/workload_controller.go +++ b/pkg/controller/core/workload_controller.go @@ -751,7 +751,7 @@ func (w *workloadCqHandler) Update(ctx context.Context, ev event.UpdateEvent, wq if !newCq.DeletionTimestamp.IsZero() || !utilslices.CmpNoOrder(oldCq.Spec.AdmissionChecks, newCq.Spec.AdmissionChecks) || - !cmp.Equal(oldCq.Spec.AdmissionCheckStrategy, newCq.Spec.AdmissionCheckStrategy) || + !cmp.Equal(oldCq.Spec.AdmissionChecksStrategy, newCq.Spec.AdmissionChecksStrategy) || !ptr.Equal(oldCq.Spec.StopPolicy, newCq.Spec.StopPolicy) { w.queueReconcileForWorkloads(ctx, newCq.Name, wq) } diff --git a/pkg/controller/core/workload_controller_test.go b/pkg/controller/core/workload_controller_test.go index 77c23dd722..8ae2ecb838 100644 --- a/pkg/controller/core/workload_controller_test.go +++ b/pkg/controller/core/workload_controller_test.go @@ -334,8 +334,8 @@ func TestReconcile(t *testing.T) { Obj(), cq: utiltesting.MakeClusterQueue("cq"). AdmissionCheckStrategy( - *utiltesting.MakeAdmissionCheckStrategy("ac1", "flavor1").Obj(), - *utiltesting.MakeAdmissionCheckStrategy("ac2").Obj()). + *utiltesting.MakeAdmissionCheckStrategyRule("ac1", "flavor1").Obj(), + *utiltesting.MakeAdmissionCheckStrategyRule("ac2").Obj()). Obj(), lq: utiltesting.MakeLocalQueue("queue", "ns").ClusterQueue("cq").Obj(), wantWorkload: utiltesting.MakeWorkload("wl", "ns"). diff --git a/pkg/util/testing/wrappers.go b/pkg/util/testing/wrappers.go index 61a894607e..dd39edc3bf 100644 --- a/pkg/util/testing/wrappers.go +++ b/pkg/util/testing/wrappers.go @@ -531,8 +531,8 @@ func (c *ClusterQueueWrapper) Cohort(cohort string) *ClusterQueueWrapper { return c } -func (c *ClusterQueueWrapper) AdmissionCheckStrategy(acs ...kueue.AdmissionCheckStrategy) *ClusterQueueWrapper { - c.Spec.AdmissionCheckStrategy = acs +func (c *ClusterQueueWrapper) AdmissionCheckStrategy(acs ...kueue.AdmissionCheckStrategyRule) *ClusterQueueWrapper { + c.Spec.AdmissionChecksStrategy.AdmissionChecks = acs return c } @@ -771,27 +771,27 @@ func MakeAdmissionCheck(name string) *AdmissionCheckWrapper { } } -type AdmissionCheckStrategyWrapper struct{ kueue.AdmissionCheckStrategy } +type AdmissionCheckStrategyRuleWrapper struct{ kueue.AdmissionCheckStrategyRule } -func MakeAdmissionCheckStrategy(name string, flavors ...string) *AdmissionCheckStrategyWrapper { +func MakeAdmissionCheckStrategyRule(name string, flavors ...string) *AdmissionCheckStrategyRuleWrapper { if len(flavors) == 0 { flavors = make([]string, 0) } - return &AdmissionCheckStrategyWrapper{ - AdmissionCheckStrategy: kueue.AdmissionCheckStrategy{ + return &AdmissionCheckStrategyRuleWrapper{ + AdmissionCheckStrategyRule: kueue.AdmissionCheckStrategyRule{ Name: name, OnFlavors: flavors, }, } } -func (acs *AdmissionCheckStrategyWrapper) OnFlavors(flavors []string) *AdmissionCheckStrategyWrapper { - acs.AdmissionCheckStrategy.OnFlavors = flavors +func (acs *AdmissionCheckStrategyRuleWrapper) OnFlavors(flavors []string) *AdmissionCheckStrategyRuleWrapper { + acs.AdmissionCheckStrategyRule.OnFlavors = flavors return acs } -func (acs *AdmissionCheckStrategyWrapper) Obj() *kueue.AdmissionCheckStrategy { - return &acs.AdmissionCheckStrategy +func (acs *AdmissionCheckStrategyRuleWrapper) Obj() *kueue.AdmissionCheckStrategyRule { + return &acs.AdmissionCheckStrategyRule } func (ac *AdmissionCheckWrapper) Active(status metav1.ConditionStatus) *AdmissionCheckWrapper { diff --git a/pkg/webhooks/clusterqueue_webhook.go b/pkg/webhooks/clusterqueue_webhook.go index 6d31ef8d00..1ca1366c4e 100644 --- a/pkg/webhooks/clusterqueue_webhook.go +++ b/pkg/webhooks/clusterqueue_webhook.go @@ -147,7 +147,7 @@ func validatePreemption(preemption *kueue.ClusterQueuePreemption, path *field.Pa func validateCQAdmissionChecks(spec *kueue.ClusterQueueSpec, path *field.Path) field.ErrorList { var allErrs field.ErrorList - if len(spec.AdmissionCheckStrategy) != 0 && len(spec.AdmissionChecks) != 0 { + if len(spec.AdmissionChecksStrategy.AdmissionChecks) != 0 && len(spec.AdmissionChecks) != 0 { allErrs = append(allErrs, field.Invalid(path, spec, "Either AdmissionChecks or AdmissionCheckStrategy can be set, but not both")) } diff --git a/pkg/webhooks/clusterqueue_webhook_test.go b/pkg/webhooks/clusterqueue_webhook_test.go index 51af9a3029..99aa868c27 100644 --- a/pkg/webhooks/clusterqueue_webhook_test.go +++ b/pkg/webhooks/clusterqueue_webhook_test.go @@ -67,7 +67,7 @@ func TestValidateClusterQueue(t *testing.T) { name: "admissionCheckStrategy defined", clusterQueue: testingutil.MakeClusterQueue("cluster-queue"). AdmissionCheckStrategy( - *testingutil.MakeAdmissionCheckStrategy("ac1", "flavor1").Obj(), + *testingutil.MakeAdmissionCheckStrategyRule("ac1", "flavor1").Obj(), ).Obj(), }, { @@ -75,7 +75,7 @@ func TestValidateClusterQueue(t *testing.T) { clusterQueue: testingutil.MakeClusterQueue("cluster-queue"). AdmissionChecks("ac1"). AdmissionCheckStrategy( - *testingutil.MakeAdmissionCheckStrategy("ac1", "flavor1").Obj(), + *testingutil.MakeAdmissionCheckStrategyRule("ac1", "flavor1").Obj(), ).Obj(), wantErr: field.ErrorList{ field.Invalid(specPath, "spec", "Either AdmissionChecks or AdmissionCheckStrategy can be set, but not both"), diff --git a/pkg/workload/workload.go b/pkg/workload/workload.go index c2bd041efb..45b0bb2c49 100644 --- a/pkg/workload/workload.go +++ b/pkg/workload/workload.go @@ -548,7 +548,7 @@ func AdmissionChecksForWorkload(log *logr.Logger, wl *kueue.Workload, cq *kueue. } acNames := sets.New[string]() - for _, acStrategy := range cq.Spec.AdmissionCheckStrategy { + for _, acStrategy := range cq.Spec.AdmissionChecksStrategy.AdmissionChecks { if len(acStrategy.OnFlavors) == 0 { acNames.Insert(acStrategy.Name) continue diff --git a/pkg/workload/workload_test.go b/pkg/workload/workload_test.go index 80903fd9d2..5baa944506 100644 --- a/pkg/workload/workload_test.go +++ b/pkg/workload/workload_test.go @@ -656,7 +656,7 @@ func TestAdmissionCheckStrategy(t *testing.T) { ReserveQuota(utiltesting.MakeAdmission("cq").Assignment("cpu", "flavor1", "1").Obj()). Obj(), cq: utiltesting.MakeClusterQueue("cq"). - AdmissionCheckStrategy(*utiltesting.MakeAdmissionCheckStrategy("ac1", "flavor1").Obj()). + AdmissionCheckStrategy(*utiltesting.MakeAdmissionCheckStrategyRule("ac1", "flavor1").Obj()). Obj(), wantAdmissionChecks: sets.New("ac1"), }, @@ -665,7 +665,7 @@ func TestAdmissionCheckStrategy(t *testing.T) { ReserveQuota(utiltesting.MakeAdmission("cq").Assignment("cpu", "flavor1", "1").Obj()). Obj(), cq: utiltesting.MakeClusterQueue("cq"). - AdmissionCheckStrategy(*utiltesting.MakeAdmissionCheckStrategy("ac1").Obj()). + AdmissionCheckStrategy(*utiltesting.MakeAdmissionCheckStrategyRule("ac1").Obj()). Obj(), wantAdmissionChecks: sets.New("ac1"), }, @@ -675,8 +675,8 @@ func TestAdmissionCheckStrategy(t *testing.T) { Obj(), cq: utiltesting.MakeClusterQueue("cq"). AdmissionCheckStrategy( - *utiltesting.MakeAdmissionCheckStrategy("ac1", "flavor1").Obj(), - *utiltesting.MakeAdmissionCheckStrategy("ac2").Obj()). + *utiltesting.MakeAdmissionCheckStrategyRule("ac1", "flavor1").Obj(), + *utiltesting.MakeAdmissionCheckStrategyRule("ac2").Obj()). Obj(), wantAdmissionChecks: sets.New("ac1", "ac2"), }, @@ -685,8 +685,8 @@ func TestAdmissionCheckStrategy(t *testing.T) { Obj(), cq: utiltesting.MakeClusterQueue("cq"). AdmissionCheckStrategy( - *utiltesting.MakeAdmissionCheckStrategy("ac1", "flavor1").Obj(), - *utiltesting.MakeAdmissionCheckStrategy("ac2").Obj()). + *utiltesting.MakeAdmissionCheckStrategyRule("ac1", "flavor1").Obj(), + *utiltesting.MakeAdmissionCheckStrategyRule("ac2").Obj()). Obj(), wantAdmissionChecks: nil, }, diff --git a/test/integration/scheduler/workload_controller_test.go b/test/integration/scheduler/workload_controller_test.go index aaa92a691d..a8b69f36ec 100644 --- a/test/integration/scheduler/workload_controller_test.go +++ b/test/integration/scheduler/workload_controller_test.go @@ -104,9 +104,9 @@ var _ = ginkgo.Describe("Workload controller with scheduler", func() { clusterQueue = testing.MakeClusterQueue("cluster-queue"). AdmissionCheckStrategy( - *testing.MakeAdmissionCheckStrategy("check1", flavorOnDemand).Obj(), - *testing.MakeAdmissionCheckStrategy("check2").Obj(), - *testing.MakeAdmissionCheckStrategy("check3", reservationFlavor).Obj()). + *testing.MakeAdmissionCheckStrategyRule("check1", flavorOnDemand).Obj(), + *testing.MakeAdmissionCheckStrategyRule("check2").Obj(), + *testing.MakeAdmissionCheckStrategyRule("check3", reservationFlavor).Obj()). ResourceGroup( *testing.MakeFlavorQuotas(reservationFlavor).Resource(resourceGPU, "1", "1").Obj(), *testing.MakeFlavorQuotas(flavorOnDemand).Resource(resourceGPU, "5", "5").Obj()). @@ -157,10 +157,11 @@ var _ = ginkgo.Describe("Workload controller with scheduler", func() { queueKey := client.ObjectKeyFromObject(clusterQueue) gomega.Eventually(func() error { gomega.Expect(k8sClient.Get(ctx, queueKey, &createdQueue)).To(gomega.Succeed()) - createdQueue.Spec.AdmissionCheckStrategy = []kueue.AdmissionCheckStrategy{ - *testing.MakeAdmissionCheckStrategy("check1", flavorOnDemand).Obj(), - *testing.MakeAdmissionCheckStrategy("check2", reservationFlavor).Obj(), - *testing.MakeAdmissionCheckStrategy("check3").Obj()} + + createdQueue.Spec.AdmissionChecksStrategy.AdmissionChecks = []kueue.AdmissionCheckStrategyRule{ + *testing.MakeAdmissionCheckStrategyRule("check1", flavorOnDemand).Obj(), + *testing.MakeAdmissionCheckStrategyRule("check2", reservationFlavor).Obj(), + *testing.MakeAdmissionCheckStrategyRule("check3").Obj()} return k8sClient.Update(ctx, &createdQueue) }, util.Timeout, util.Interval).Should(gomega.Succeed()) })