From a594b77a736deb881d1d16f38c4dbbb6d4c0823c Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Thu, 13 Jun 2024 17:25:39 +0200 Subject: [PATCH] DRA: remove immediate allocation As agreed in https://github.com/kubernetes/enhancements/pull/4709, immediate allocation is one of those features which can be removed because it makes no sense for structured parameters and the justification for classic DRA is weak. --- api/openapi-spec/swagger.json | 4 - ...is__resource.k8s.io__v1alpha2_openapi.json | 4 - pkg/api/testing/defaulting_test.go | 4 - pkg/apis/resource/fuzzer/fuzzer.go | 16 +- pkg/apis/resource/types.go | 28 +- pkg/apis/resource/v1alpha2/defaults.go | 7 - pkg/apis/resource/v1alpha2/defaults_test.go | 75 ---- .../v1alpha2/zz_generated.conversion.go | 2 - .../v1alpha2/zz_generated.defaults.go | 29 -- pkg/apis/resource/validation/validation.go | 5 - .../validation_resourceclaim_test.go | 25 -- .../validation_resourceclaimtemplate_test.go | 24 -- pkg/controller/resourceclaim/controller.go | 19 +- .../resourceclaim/controller_test.go | 76 +---- pkg/generated/openapi/zz_generated.openapi.go | 7 - pkg/printers/internalversion/printers.go | 6 +- .../resourceclaim/storage/storage_test.go | 1 - .../resource/resourceclaim/strategy_test.go | 1 - .../storage/storage_test.go | 1 - .../resourceclaimtemplate/strategy_test.go | 1 - .../dynamicresources/dynamicresources.go | 85 ++--- .../dynamicresources/dynamicresources_test.go | 246 ++++---------- pkg/scheduler/testing/wrappers.go | 6 - .../api/resource/v1alpha2/generated.pb.go | 320 ++++++++---------- .../api/resource/v1alpha2/generated.proto | 5 - .../src/k8s.io/api/resource/v1alpha2/types.go | 26 -- .../v1alpha2/types_swagger_doc_generated.go | 1 - ...esource.k8s.io.v1alpha2.ResourceClaim.json | 3 +- .../resource.k8s.io.v1alpha2.ResourceClaim.pb | Bin 1031 -> 1010 bytes ...esource.k8s.io.v1alpha2.ResourceClaim.yaml | 1 - ...k8s.io.v1alpha2.ResourceClaimTemplate.json | 3 +- ...e.k8s.io.v1alpha2.ResourceClaimTemplate.pb | Bin 861 -> 840 bytes ...k8s.io.v1alpha2.ResourceClaimTemplate.yaml | 1 - ...1alpha2.ResourceClaim.after_roundtrip.json | 99 ++++++ ....v1alpha2.ResourceClaim.after_roundtrip.pb | Bin 0 -> 667 bytes ...1alpha2.ResourceClaim.after_roundtrip.yaml | 65 ++++ ...ResourceClaimTemplate.after_roundtrip.json | 98 ++++++ ...2.ResourceClaimTemplate.after_roundtrip.pb | Bin 0 -> 840 bytes ...ResourceClaimTemplate.after_roundtrip.yaml | 73 ++++ ...1alpha2.ResourceClaim.after_roundtrip.json | 139 ++++++++ ....v1alpha2.ResourceClaim.after_roundtrip.pb | Bin 0 -> 1010 bytes ...1alpha2.ResourceClaim.after_roundtrip.yaml | 91 +++++ ...ResourceClaimTemplate.after_roundtrip.json | 98 ++++++ ...2.ResourceClaimTemplate.after_roundtrip.pb | Bin 0 -> 840 bytes ...ResourceClaimTemplate.after_roundtrip.yaml | 73 ++++ .../applyconfigurations/internal/internal.go | 3 - .../resource/v1alpha2/resourceclaimspec.go | 13 - .../controller/controller.go | 47 +-- .../controller/controller_test.go | 198 +++-------- test/e2e/dra/dra.go | 286 +++++----------- 50 files changed, 1125 insertions(+), 1190 deletions(-) delete mode 100644 pkg/apis/resource/v1alpha2/defaults_test.go create mode 100644 staging/src/k8s.io/api/testdata/v1.29.0/resource.k8s.io.v1alpha2.ResourceClaim.after_roundtrip.json create mode 100644 staging/src/k8s.io/api/testdata/v1.29.0/resource.k8s.io.v1alpha2.ResourceClaim.after_roundtrip.pb create mode 100644 staging/src/k8s.io/api/testdata/v1.29.0/resource.k8s.io.v1alpha2.ResourceClaim.after_roundtrip.yaml create mode 100644 staging/src/k8s.io/api/testdata/v1.29.0/resource.k8s.io.v1alpha2.ResourceClaimTemplate.after_roundtrip.json create mode 100644 staging/src/k8s.io/api/testdata/v1.29.0/resource.k8s.io.v1alpha2.ResourceClaimTemplate.after_roundtrip.pb create mode 100644 staging/src/k8s.io/api/testdata/v1.29.0/resource.k8s.io.v1alpha2.ResourceClaimTemplate.after_roundtrip.yaml create mode 100644 staging/src/k8s.io/api/testdata/v1.30.0/resource.k8s.io.v1alpha2.ResourceClaim.after_roundtrip.json create mode 100644 staging/src/k8s.io/api/testdata/v1.30.0/resource.k8s.io.v1alpha2.ResourceClaim.after_roundtrip.pb create mode 100644 staging/src/k8s.io/api/testdata/v1.30.0/resource.k8s.io.v1alpha2.ResourceClaim.after_roundtrip.yaml create mode 100644 staging/src/k8s.io/api/testdata/v1.30.0/resource.k8s.io.v1alpha2.ResourceClaimTemplate.after_roundtrip.json create mode 100644 staging/src/k8s.io/api/testdata/v1.30.0/resource.k8s.io.v1alpha2.ResourceClaimTemplate.after_roundtrip.pb create mode 100644 staging/src/k8s.io/api/testdata/v1.30.0/resource.k8s.io.v1alpha2.ResourceClaimTemplate.after_roundtrip.yaml diff --git a/api/openapi-spec/swagger.json b/api/openapi-spec/swagger.json index f8106bd989296..9647c094395bc 100644 --- a/api/openapi-spec/swagger.json +++ b/api/openapi-spec/swagger.json @@ -15484,10 +15484,6 @@ "io.k8s.api.resource.v1alpha2.ResourceClaimSpec": { "description": "ResourceClaimSpec defines how a resource is to be allocated.", "properties": { - "allocationMode": { - "description": "Allocation can start immediately or when a Pod wants to use the resource. \"WaitForFirstConsumer\" is the default.", - "type": "string" - }, "parametersRef": { "$ref": "#/definitions/io.k8s.api.resource.v1alpha2.ResourceClaimParametersReference", "description": "ParametersRef references a separate object with arbitrary parameters that will be used by the driver when allocating a resource for the claim.\n\nThe object must be in the same namespace as the ResourceClaim." diff --git a/api/openapi-spec/v3/apis__resource.k8s.io__v1alpha2_openapi.json b/api/openapi-spec/v3/apis__resource.k8s.io__v1alpha2_openapi.json index abe72129b03fb..9744839793281 100644 --- a/api/openapi-spec/v3/apis__resource.k8s.io__v1alpha2_openapi.json +++ b/api/openapi-spec/v3/apis__resource.k8s.io__v1alpha2_openapi.json @@ -762,10 +762,6 @@ "io.k8s.api.resource.v1alpha2.ResourceClaimSpec": { "description": "ResourceClaimSpec defines how a resource is to be allocated.", "properties": { - "allocationMode": { - "description": "Allocation can start immediately or when a Pod wants to use the resource. \"WaitForFirstConsumer\" is the default.", - "type": "string" - }, "parametersRef": { "allOf": [ { diff --git a/pkg/api/testing/defaulting_test.go b/pkg/api/testing/defaulting_test.go index 07c63b4c0085e..a442b14dfbfc0 100644 --- a/pkg/api/testing/defaulting_test.go +++ b/pkg/api/testing/defaulting_test.go @@ -135,10 +135,6 @@ func TestDefaulting(t *testing.T) { {Group: "rbac.authorization.k8s.io", Version: "v1", Kind: "ClusterRoleBindingList"}: {}, {Group: "rbac.authorization.k8s.io", Version: "v1", Kind: "RoleBinding"}: {}, {Group: "rbac.authorization.k8s.io", Version: "v1", Kind: "RoleBindingList"}: {}, - {Group: "resource.k8s.io", Version: "v1alpha2", Kind: "ResourceClaim"}: {}, - {Group: "resource.k8s.io", Version: "v1alpha2", Kind: "ResourceClaimList"}: {}, - {Group: "resource.k8s.io", Version: "v1alpha2", Kind: "ResourceClaimTemplate"}: {}, - {Group: "resource.k8s.io", Version: "v1alpha2", Kind: "ResourceClaimTemplateList"}: {}, {Group: "admissionregistration.k8s.io", Version: "v1alpha1", Kind: "ValidatingAdmissionPolicy"}: {}, {Group: "admissionregistration.k8s.io", Version: "v1alpha1", Kind: "ValidatingAdmissionPolicyList"}: {}, {Group: "admissionregistration.k8s.io", Version: "v1alpha1", Kind: "ValidatingAdmissionPolicyBinding"}: {}, diff --git a/pkg/apis/resource/fuzzer/fuzzer.go b/pkg/apis/resource/fuzzer/fuzzer.go index 5cf5b5e635bc2..5f9b5273900c0 100644 --- a/pkg/apis/resource/fuzzer/fuzzer.go +++ b/pkg/apis/resource/fuzzer/fuzzer.go @@ -17,24 +17,10 @@ limitations under the License. package fuzzer import ( - fuzz "github.com/google/gofuzz" - runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer" - "k8s.io/kubernetes/pkg/apis/resource" ) // Funcs contains the fuzzer functions for the resource group. var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} { - return []interface{}{ - func(obj *resource.ResourceClaimSpec, c fuzz.Continue) { - c.FuzzNoCustom(obj) // fuzz self without calling this function again - - // Custom fuzzing for allocation mode: pick one valid mode randomly. - modes := []resource.AllocationMode{ - resource.AllocationModeImmediate, - resource.AllocationModeWaitForFirstConsumer, - } - obj.AllocationMode = modes[c.Rand.Intn(len(modes))] - }, - } + return nil } diff --git a/pkg/apis/resource/types.go b/pkg/apis/resource/types.go index fa3fba7f39ef4..6a633c1782c44 100644 --- a/pkg/apis/resource/types.go +++ b/pkg/apis/resource/types.go @@ -62,33 +62,7 @@ type ResourceClaimSpec struct { // The object must be in the same namespace as the ResourceClaim. // +optional ParametersRef *ResourceClaimParametersReference - - // Allocation can start immediately or when a Pod wants to use the - // resource. "WaitForFirstConsumer" is the default. - // +optional - AllocationMode AllocationMode -} - -// AllocationMode describes whether a ResourceClaim gets allocated immediately -// when it gets created (AllocationModeImmediate) or whether allocation is -// delayed until it is needed for a Pod -// (AllocationModeWaitForFirstConsumer). Other modes might get added in the -// future. -type AllocationMode string - -const ( - // When a ResourceClaim has AllocationModeWaitForFirstConsumer, allocation is - // delayed until a Pod gets scheduled that needs the ResourceClaim. The - // scheduler will consider all resource requirements of that Pod and - // trigger allocation for a node that fits the Pod. - AllocationModeWaitForFirstConsumer AllocationMode = "WaitForFirstConsumer" - - // When a ResourceClaim has AllocationModeImmediate, allocation starts - // as soon as the ResourceClaim gets created. This is done without - // considering the needs of Pods that will use the ResourceClaim - // because those Pods are not known yet. - AllocationModeImmediate AllocationMode = "Immediate" -) +} // ResourceClaimStatus tracks whether the resource has been allocated and what // the resulting attributes are. diff --git a/pkg/apis/resource/v1alpha2/defaults.go b/pkg/apis/resource/v1alpha2/defaults.go index a6c681f8bf54d..8682b9a2a88f8 100644 --- a/pkg/apis/resource/v1alpha2/defaults.go +++ b/pkg/apis/resource/v1alpha2/defaults.go @@ -17,16 +17,9 @@ limitations under the License. package v1alpha2 import ( - "k8s.io/api/resource/v1alpha2" "k8s.io/apimachinery/pkg/runtime" ) func addDefaultingFuncs(scheme *runtime.Scheme) error { return RegisterDefaults(scheme) } - -func SetDefaults_ResourceClaimSpec(obj *v1alpha2.ResourceClaimSpec) { - if obj.AllocationMode == "" { - obj.AllocationMode = v1alpha2.AllocationModeWaitForFirstConsumer - } -} diff --git a/pkg/apis/resource/v1alpha2/defaults_test.go b/pkg/apis/resource/v1alpha2/defaults_test.go deleted file mode 100644 index 7f5b0d01046ef..0000000000000 --- a/pkg/apis/resource/v1alpha2/defaults_test.go +++ /dev/null @@ -1,75 +0,0 @@ -/* -Copyright 2022 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. -*/ - -package v1alpha2_test - -import ( - "reflect" - "testing" - - v1alpha2 "k8s.io/api/resource/v1alpha2" - "k8s.io/apimachinery/pkg/runtime" - - // ensure types are installed - "k8s.io/kubernetes/pkg/api/legacyscheme" - _ "k8s.io/kubernetes/pkg/apis/resource/install" -) - -func TestSetDefaultAllocationMode(t *testing.T) { - claim := &v1alpha2.ResourceClaim{} - - // field should be defaulted - defaultMode := v1alpha2.AllocationModeWaitForFirstConsumer - output := roundTrip(t, runtime.Object(claim)).(*v1alpha2.ResourceClaim) - outMode := output.Spec.AllocationMode - if outMode != defaultMode { - t.Errorf("Expected AllocationMode to be defaulted to: %+v, got: %+v", defaultMode, outMode) - } - - // field should not change - nonDefaultMode := v1alpha2.AllocationModeImmediate - claim = &v1alpha2.ResourceClaim{ - Spec: v1alpha2.ResourceClaimSpec{ - AllocationMode: nonDefaultMode, - }, - } - output = roundTrip(t, runtime.Object(claim)).(*v1alpha2.ResourceClaim) - outMode = output.Spec.AllocationMode - if outMode != v1alpha2.AllocationModeImmediate { - t.Errorf("Expected AllocationMode to remain %+v, got: %+v", nonDefaultMode, outMode) - } -} - -func roundTrip(t *testing.T, obj runtime.Object) runtime.Object { - codec := legacyscheme.Codecs.LegacyCodec(v1alpha2.SchemeGroupVersion) - data, err := runtime.Encode(codec, obj) - if err != nil { - t.Errorf("%v\n %#v", err, obj) - return nil - } - obj2, err := runtime.Decode(codec, data) - if err != nil { - t.Errorf("%v\nData: %s\nSource: %#v", err, string(data), obj) - return nil - } - obj3 := reflect.New(reflect.TypeOf(obj).Elem()).Interface().(runtime.Object) - err = legacyscheme.Scheme.Convert(obj2, obj3, nil) - if err != nil { - t.Errorf("%v\nSource: %#v", err, obj2) - return nil - } - return obj3 -} diff --git a/pkg/apis/resource/v1alpha2/zz_generated.conversion.go b/pkg/apis/resource/v1alpha2/zz_generated.conversion.go index c49d690c705c2..862ccac3ddd9c 100644 --- a/pkg/apis/resource/v1alpha2/zz_generated.conversion.go +++ b/pkg/apis/resource/v1alpha2/zz_generated.conversion.go @@ -1159,7 +1159,6 @@ func Convert_resource_ResourceClaimSchedulingStatus_To_v1alpha2_ResourceClaimSch func autoConvert_v1alpha2_ResourceClaimSpec_To_resource_ResourceClaimSpec(in *v1alpha2.ResourceClaimSpec, out *resource.ResourceClaimSpec, s conversion.Scope) error { out.ResourceClassName = in.ResourceClassName out.ParametersRef = (*resource.ResourceClaimParametersReference)(unsafe.Pointer(in.ParametersRef)) - out.AllocationMode = resource.AllocationMode(in.AllocationMode) return nil } @@ -1171,7 +1170,6 @@ func Convert_v1alpha2_ResourceClaimSpec_To_resource_ResourceClaimSpec(in *v1alph func autoConvert_resource_ResourceClaimSpec_To_v1alpha2_ResourceClaimSpec(in *resource.ResourceClaimSpec, out *v1alpha2.ResourceClaimSpec, s conversion.Scope) error { out.ResourceClassName = in.ResourceClassName out.ParametersRef = (*v1alpha2.ResourceClaimParametersReference)(unsafe.Pointer(in.ParametersRef)) - out.AllocationMode = v1alpha2.AllocationMode(in.AllocationMode) return nil } diff --git a/pkg/apis/resource/v1alpha2/zz_generated.defaults.go b/pkg/apis/resource/v1alpha2/zz_generated.defaults.go index bcf5e1aa5bbc9..7e0a05edc9500 100644 --- a/pkg/apis/resource/v1alpha2/zz_generated.defaults.go +++ b/pkg/apis/resource/v1alpha2/zz_generated.defaults.go @@ -22,7 +22,6 @@ limitations under the License. package v1alpha2 import ( - v1alpha2 "k8s.io/api/resource/v1alpha2" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -30,33 +29,5 @@ import ( // Public to allow building arbitrary schemes. // All generated defaulters are covering - they call all nested defaulters. func RegisterDefaults(scheme *runtime.Scheme) error { - scheme.AddTypeDefaultingFunc(&v1alpha2.ResourceClaim{}, func(obj interface{}) { SetObjectDefaults_ResourceClaim(obj.(*v1alpha2.ResourceClaim)) }) - scheme.AddTypeDefaultingFunc(&v1alpha2.ResourceClaimList{}, func(obj interface{}) { SetObjectDefaults_ResourceClaimList(obj.(*v1alpha2.ResourceClaimList)) }) - scheme.AddTypeDefaultingFunc(&v1alpha2.ResourceClaimTemplate{}, func(obj interface{}) { SetObjectDefaults_ResourceClaimTemplate(obj.(*v1alpha2.ResourceClaimTemplate)) }) - scheme.AddTypeDefaultingFunc(&v1alpha2.ResourceClaimTemplateList{}, func(obj interface{}) { - SetObjectDefaults_ResourceClaimTemplateList(obj.(*v1alpha2.ResourceClaimTemplateList)) - }) return nil } - -func SetObjectDefaults_ResourceClaim(in *v1alpha2.ResourceClaim) { - SetDefaults_ResourceClaimSpec(&in.Spec) -} - -func SetObjectDefaults_ResourceClaimList(in *v1alpha2.ResourceClaimList) { - for i := range in.Items { - a := &in.Items[i] - SetObjectDefaults_ResourceClaim(a) - } -} - -func SetObjectDefaults_ResourceClaimTemplate(in *v1alpha2.ResourceClaimTemplate) { - SetDefaults_ResourceClaimSpec(&in.Spec.Spec) -} - -func SetObjectDefaults_ResourceClaimTemplateList(in *v1alpha2.ResourceClaimTemplateList) { - for i := range in.Items { - a := &in.Items[i] - SetObjectDefaults_ResourceClaimTemplate(a) - } -} diff --git a/pkg/apis/resource/validation/validation.go b/pkg/apis/resource/validation/validation.go index 7b93aae7db4a9..39db1d71b66c1 100644 --- a/pkg/apis/resource/validation/validation.go +++ b/pkg/apis/resource/validation/validation.go @@ -46,14 +46,9 @@ func validateResourceClaimSpec(spec *resource.ResourceClaimSpec, fldPath *field. allErrs = append(allErrs, field.Invalid(fldPath.Child("resourceClassName"), spec.ResourceClassName, msg)) } allErrs = append(allErrs, validateResourceClaimParametersRef(spec.ParametersRef, fldPath.Child("parametersRef"))...) - if !supportedAllocationModes.Has(string(spec.AllocationMode)) { - allErrs = append(allErrs, field.NotSupported(fldPath.Child("allocationMode"), spec.AllocationMode, supportedAllocationModes.List())) - } return allErrs } -var supportedAllocationModes = sets.NewString(string(resource.AllocationModeImmediate), string(resource.AllocationModeWaitForFirstConsumer)) - // It would have been nice to use Go generics to reuse the same validation // function for Kind and Name in both types, but generics cannot be used to // access common fields in structs. diff --git a/pkg/apis/resource/validation/validation_resourceclaim_test.go b/pkg/apis/resource/validation/validation_resourceclaim_test.go index 5c735baef5386..3836e0d9f4447 100644 --- a/pkg/apis/resource/validation/validation_resourceclaim_test.go +++ b/pkg/apis/resource/validation/validation_resourceclaim_test.go @@ -42,14 +42,11 @@ func testClaim(name, namespace string, spec resource.ResourceClaimSpec) *resourc } func TestValidateClaim(t *testing.T) { - validMode := resource.AllocationModeImmediate - invalidMode := resource.AllocationMode("invalid") goodName := "foo" badName := "!@#$%^" goodNS := "ns" goodClaimSpec := resource.ResourceClaimSpec{ ResourceClassName: goodName, - AllocationMode: validMode, } now := metav1.Now() badValue := "spaces not allowed" @@ -200,14 +197,6 @@ func TestValidateClaim(t *testing.T) { return claim }(), }, - "bad-mode": { - wantFailures: field.ErrorList{field.NotSupported(field.NewPath("spec", "allocationMode"), invalidMode, supportedAllocationModes.List())}, - claim: func() *resource.ResourceClaim { - claim := testClaim(goodName, goodNS, goodClaimSpec) - claim.Spec.AllocationMode = invalidMode - return claim - }(), - }, "good-parameters": { claim: func() *resource.ResourceClaim { claim := testClaim(goodName, goodNS, goodClaimSpec) @@ -279,7 +268,6 @@ func TestValidateClaimUpdate(t *testing.T) { } validClaim := testClaim("foo", "ns", resource.ResourceClaimSpec{ ResourceClassName: name, - AllocationMode: resource.AllocationModeImmediate, ParametersRef: parameters, }) @@ -316,18 +304,6 @@ func TestValidateClaimUpdate(t *testing.T) { return claim }, }, - "invalid-update-mode": { - wantFailures: field.ErrorList{field.Invalid(field.NewPath("spec"), func() resource.ResourceClaimSpec { - spec := validClaim.Spec.DeepCopy() - spec.AllocationMode = resource.AllocationModeWaitForFirstConsumer - return *spec - }(), "field is immutable")}, - oldClaim: validClaim, - update: func(claim *resource.ResourceClaim) *resource.ResourceClaim { - claim.Spec.AllocationMode = resource.AllocationModeWaitForFirstConsumer - return claim - }, - }, } for name, scenario := range scenarios { @@ -343,7 +319,6 @@ func TestValidateClaimStatusUpdate(t *testing.T) { invalidName := "!@#$%^" validClaim := testClaim("foo", "ns", resource.ResourceClaimSpec{ ResourceClassName: "valid", - AllocationMode: resource.AllocationModeImmediate, }) validAllocatedClaim := validClaim.DeepCopy() diff --git a/pkg/apis/resource/validation/validation_resourceclaimtemplate_test.go b/pkg/apis/resource/validation/validation_resourceclaimtemplate_test.go index 3f6c55041476e..ba51420c26888 100644 --- a/pkg/apis/resource/validation/validation_resourceclaimtemplate_test.go +++ b/pkg/apis/resource/validation/validation_resourceclaimtemplate_test.go @@ -40,14 +40,11 @@ func testClaimTemplate(name, namespace string, spec resource.ResourceClaimSpec) } func TestValidateClaimTemplate(t *testing.T) { - validMode := resource.AllocationModeImmediate - invalidMode := resource.AllocationMode("invalid") goodName := "foo" badName := "!@#$%^" goodNS := "ns" goodClaimSpec := resource.ResourceClaimSpec{ ResourceClassName: goodName, - AllocationMode: validMode, } now := metav1.Now() badValue := "spaces not allowed" @@ -198,14 +195,6 @@ func TestValidateClaimTemplate(t *testing.T) { return template }(), }, - "bad-mode": { - wantFailures: field.ErrorList{field.NotSupported(field.NewPath("spec", "spec", "allocationMode"), invalidMode, supportedAllocationModes.List())}, - template: func() *resource.ResourceClaimTemplate { - template := testClaimTemplate(goodName, goodNS, goodClaimSpec) - template.Spec.Spec.AllocationMode = invalidMode - return template - }(), - }, "good-parameters": { template: func() *resource.ResourceClaimTemplate { template := testClaimTemplate(goodName, goodNS, goodClaimSpec) @@ -277,7 +266,6 @@ func TestValidateClaimTemplateUpdate(t *testing.T) { } validClaimTemplate := testClaimTemplate("foo", "ns", resource.ResourceClaimSpec{ ResourceClassName: name, - AllocationMode: resource.AllocationModeImmediate, ParametersRef: parameters, }) @@ -314,18 +302,6 @@ func TestValidateClaimTemplateUpdate(t *testing.T) { return template }, }, - "invalid-update-mode": { - wantFailures: field.ErrorList{field.Invalid(field.NewPath("spec"), func() resource.ResourceClaimTemplateSpec { - spec := validClaimTemplate.Spec.DeepCopy() - spec.Spec.AllocationMode = resource.AllocationModeWaitForFirstConsumer - return *spec - }(), "field is immutable")}, - oldClaimTemplate: validClaimTemplate, - update: func(template *resource.ResourceClaimTemplate) *resource.ResourceClaimTemplate { - template.Spec.Spec.AllocationMode = resource.AllocationModeWaitForFirstConsumer - return template - }, - }, } for name, scenario := range scenarios { diff --git a/pkg/controller/resourceclaim/controller.go b/pkg/controller/resourceclaim/controller.go index daa000ee92ac9..e9da966f85ad4 100644 --- a/pkg/controller/resourceclaim/controller.go +++ b/pkg/controller/resourceclaim/controller.go @@ -329,8 +329,7 @@ func (ec *Controller) podNeedsWork(pod *v1.Pod) (bool, string) { // - a user created a pod with spec.nodeName set, perhaps for testing // - some scheduler was used which is unaware of DRA // - DRA was not enabled in kube-scheduler (version skew, configuration) - if claim.Spec.AllocationMode == resourcev1alpha2.AllocationModeWaitForFirstConsumer && - claim.Status.Allocation == nil { + if claim.Status.Allocation == nil { scheduling, err := ec.podSchedulingLister.PodSchedulingContexts(pod.Namespace).Get(pod.Name) if apierrors.IsNotFound(err) { return true, "need to create PodSchedulingContext for scheduled pod" @@ -533,8 +532,7 @@ func (ec *Controller) syncPod(ctx context.Context, namespace, name string) error return err } } - if claim.Spec.AllocationMode == resourcev1alpha2.AllocationModeWaitForFirstConsumer && - claim.Status.Allocation == nil { + if claim.Status.Allocation == nil { logger.V(5).Info("create PodSchedulingContext because claim needs to be allocated", "resourceClaim", klog.KObj(claim)) return ec.ensurePodSchedulingContext(ctx, pod) } @@ -864,19 +862,14 @@ func (ec *Controller) syncClaim(ctx context.Context, namespace, name string) err // for such claims and not checking for them keeps this code simpler. if len(valid) == 0 { if builtinControllerFinalizer >= 0 { - if claim.Spec.AllocationMode == resourcev1alpha2.AllocationModeWaitForFirstConsumer || - claim.DeletionTimestamp != nil { - // Allocated by scheduler with structured parameters. We can "deallocate" - // by clearing the allocation. - claim.Status.Allocation = nil - } - } else if claim.Spec.AllocationMode == resourcev1alpha2.AllocationModeWaitForFirstConsumer { + // Allocated by scheduler with structured parameters. We can "deallocate" + // by clearing the allocation. + claim.Status.Allocation = nil + } else { // DRA driver controller in the control plane // needs to do the deallocation. claim.Status.DeallocationRequested = true } - // In all other cases, we keep the claim allocated, in particular for immediate allocation - // with a control plane controller. } claim, err := ec.kubeClient.ResourceV1alpha2().ResourceClaims(claim.Namespace).UpdateStatus(ctx, claim, metav1.UpdateOptions{}) diff --git a/pkg/controller/resourceclaim/controller_test.go b/pkg/controller/resourceclaim/controller_test.go index b089c74c95122..d1a48afee6920 100644 --- a/pkg/controller/resourceclaim/controller_test.go +++ b/pkg/controller/resourceclaim/controller_test.go @@ -281,7 +281,7 @@ func TestSyncHandler(t *testing.T) { expectedMetrics: expectedMetrics{0, 0}, }, { - name: "clear-reserved-delayed-allocation", + name: "clear-reserved", pods: []*v1.Pod{}, key: claimKey(testClaimReserved), claims: []*resourcev1alpha2.ResourceClaim{testClaimReserved}, @@ -293,7 +293,7 @@ func TestSyncHandler(t *testing.T) { expectedMetrics: expectedMetrics{0, 0}, }, { - name: "clear-reserved-delayed-allocation-structured", + name: "clear-reserved-structured", pods: []*v1.Pod{}, key: claimKey(testClaimReserved), claims: []*resourcev1alpha2.ResourceClaim{structuredParameters(testClaimReserved)}, @@ -306,7 +306,7 @@ func TestSyncHandler(t *testing.T) { expectedMetrics: expectedMetrics{0, 0}, }, { - name: "dont-clear-reserved-delayed-allocation-structured", + name: "dont-clear-reserved-structured", pods: []*v1.Pod{testPodWithResource}, key: claimKey(testClaimReserved), claims: func() []*resourcev1alpha2.ResourceClaim { @@ -318,50 +318,16 @@ func TestSyncHandler(t *testing.T) { expectedMetrics: expectedMetrics{0, 0}, }, { - name: "clear-reserved-immediate-allocation", - pods: []*v1.Pod{}, - key: claimKey(testClaimReserved), - claims: func() []*resourcev1alpha2.ResourceClaim { - claim := testClaimReserved.DeepCopy() - claim.Spec.AllocationMode = resourcev1alpha2.AllocationModeImmediate - return []*resourcev1alpha2.ResourceClaim{claim} - }(), - expectedClaims: func() []resourcev1alpha2.ResourceClaim { - claim := testClaimAllocated.DeepCopy() - claim.Spec.AllocationMode = resourcev1alpha2.AllocationModeImmediate - return []resourcev1alpha2.ResourceClaim{*claim} - }(), - expectedMetrics: expectedMetrics{0, 0}, - }, - { - name: "clear-reserved-immediate-allocation-structured", + name: "clear-reserved-structured-deleted", pods: []*v1.Pod{}, key: claimKey(testClaimReserved), claims: func() []*resourcev1alpha2.ResourceClaim { claim := structuredParameters(testClaimReserved.DeepCopy()) - claim.Spec.AllocationMode = resourcev1alpha2.AllocationModeImmediate - return []*resourcev1alpha2.ResourceClaim{claim} - }(), - expectedClaims: func() []resourcev1alpha2.ResourceClaim { - claim := structuredParameters(testClaimAllocated.DeepCopy()) - claim.Spec.AllocationMode = resourcev1alpha2.AllocationModeImmediate - return []resourcev1alpha2.ResourceClaim{*claim} - }(), - expectedMetrics: expectedMetrics{0, 0}, - }, - { - name: "clear-reserved-immediate-allocation-structured-deleted", - pods: []*v1.Pod{}, - key: claimKey(testClaimReserved), - claims: func() []*resourcev1alpha2.ResourceClaim { - claim := structuredParameters(testClaimReserved.DeepCopy()) - claim.Spec.AllocationMode = resourcev1alpha2.AllocationModeImmediate claim.DeletionTimestamp = &metav1.Time{} return []*resourcev1alpha2.ResourceClaim{claim} }(), expectedClaims: func() []resourcev1alpha2.ResourceClaim { claim := structuredParameters(testClaimAllocated.DeepCopy()) - claim.Spec.AllocationMode = resourcev1alpha2.AllocationModeImmediate claim.DeletionTimestamp = &metav1.Time{} claim.Finalizers = []string{} claim.Status.Allocation = nil @@ -370,18 +336,16 @@ func TestSyncHandler(t *testing.T) { expectedMetrics: expectedMetrics{0, 0}, }, { - name: "immediate-allocation-structured-deleted", + name: "structured-deleted", pods: []*v1.Pod{}, key: claimKey(testClaimReserved), claims: func() []*resourcev1alpha2.ResourceClaim { claim := structuredParameters(testClaimAllocated.DeepCopy()) - claim.Spec.AllocationMode = resourcev1alpha2.AllocationModeImmediate claim.DeletionTimestamp = &metav1.Time{} return []*resourcev1alpha2.ResourceClaim{claim} }(), expectedClaims: func() []resourcev1alpha2.ResourceClaim { claim := structuredParameters(testClaimAllocated.DeepCopy()) - claim.Spec.AllocationMode = resourcev1alpha2.AllocationModeImmediate claim.DeletionTimestamp = &metav1.Time{} claim.Finalizers = []string{} claim.Status.Allocation = nil @@ -390,7 +354,7 @@ func TestSyncHandler(t *testing.T) { expectedMetrics: expectedMetrics{0, 0}, }, { - name: "clear-reserved-when-done-delayed-allocation", + name: "clear-reserved-when-done", pods: func() []*v1.Pod { pods := []*v1.Pod{testPodWithResource.DeepCopy()} pods[0].Status.Phase = v1.PodSucceeded @@ -410,28 +374,6 @@ func TestSyncHandler(t *testing.T) { }(), expectedMetrics: expectedMetrics{0, 0}, }, - { - name: "clear-reserved-when-done-immediate-allocation", - pods: func() []*v1.Pod { - pods := []*v1.Pod{testPodWithResource.DeepCopy()} - pods[0].Status.Phase = v1.PodSucceeded - return pods - }(), - key: claimKey(testClaimReserved), - claims: func() []*resourcev1alpha2.ResourceClaim { - claims := []*resourcev1alpha2.ResourceClaim{testClaimReserved.DeepCopy()} - claims[0].OwnerReferences = nil - claims[0].Spec.AllocationMode = resourcev1alpha2.AllocationModeImmediate - return claims - }(), - expectedClaims: func() []resourcev1alpha2.ResourceClaim { - claims := []resourcev1alpha2.ResourceClaim{*testClaimAllocated.DeepCopy()} - claims[0].OwnerReferences = nil - claims[0].Spec.AllocationMode = resourcev1alpha2.AllocationModeImmediate - return claims - }(), - expectedMetrics: expectedMetrics{0, 0}, - }, { name: "remove-reserved", pods: []*v1.Pod{testPod}, @@ -587,7 +529,6 @@ func makeClaim(name, namespace, classname string, owner *metav1.OwnerReference) ObjectMeta: metav1.ObjectMeta{Name: name, Namespace: namespace}, Spec: resourcev1alpha2.ResourceClaimSpec{ ResourceClassName: classname, - AllocationMode: resourcev1alpha2.AllocationModeWaitForFirstConsumer, }, } if owner != nil { @@ -607,7 +548,6 @@ func makeGeneratedClaim(podClaimName, generateName, namespace, classname string, }, Spec: resourcev1alpha2.ResourceClaimSpec{ ResourceClassName: classname, - AllocationMode: resourcev1alpha2.AllocationModeWaitForFirstConsumer, }, } if owner != nil { @@ -709,10 +649,6 @@ func normalizeClaims(claims []resourcev1alpha2.ResourceClaim) []resourcev1alpha2 if len(claims[i].Status.ReservedFor) == 0 { claims[i].Status.ReservedFor = nil } - if claims[i].Spec.AllocationMode == "" { - // This emulates defaulting. - claims[i].Spec.AllocationMode = resourcev1alpha2.AllocationModeWaitForFirstConsumer - } } return claims } diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/pkg/generated/openapi/zz_generated.openapi.go index b9f01a3a04dc7..0a07378e22aa4 100644 --- a/pkg/generated/openapi/zz_generated.openapi.go +++ b/pkg/generated/openapi/zz_generated.openapi.go @@ -46369,13 +46369,6 @@ func schema_k8sio_api_resource_v1alpha2_ResourceClaimSpec(ref common.ReferenceCa Ref: ref("k8s.io/api/resource/v1alpha2.ResourceClaimParametersReference"), }, }, - "allocationMode": { - SchemaProps: spec.SchemaProps{ - Description: "Allocation can start immediately or when a Pod wants to use the resource. \"WaitForFirstConsumer\" is the default.", - Type: []string{"string"}, - Format: "", - }, - }, }, Required: []string{"resourceClassName"}, }, diff --git a/pkg/printers/internalversion/printers.go b/pkg/printers/internalversion/printers.go index 0a4ddc4572aed..bc30899a19409 100644 --- a/pkg/printers/internalversion/printers.go +++ b/pkg/printers/internalversion/printers.go @@ -634,7 +634,6 @@ func AddHandlers(h printers.PrintHandler) { resourceClaimColumnDefinitions := []metav1.TableColumnDefinition{ {Name: "Name", Type: "string", Format: "name", Description: metav1.ObjectMeta{}.SwaggerDoc()["name"]}, {Name: "ResourceClassName", Type: "string", Description: resourcev1alpha2.ResourceClaimSpec{}.SwaggerDoc()["resourceClassName"]}, - {Name: "AllocationMode", Type: "string", Description: resourcev1alpha2.ResourceClaimSpec{}.SwaggerDoc()["allocationMode"]}, {Name: "State", Type: "string", Description: "A summary of the current state (allocated, pending, reserved, etc.)."}, {Name: "Age", Type: "string", Description: metav1.ObjectMeta{}.SwaggerDoc()["creationTimestamp"]}, } @@ -644,7 +643,6 @@ func AddHandlers(h printers.PrintHandler) { resourceClaimTemplateColumnDefinitions := []metav1.TableColumnDefinition{ {Name: "Name", Type: "string", Format: "name", Description: metav1.ObjectMeta{}.SwaggerDoc()["name"]}, {Name: "ResourceClassName", Type: "string", Description: resourcev1alpha2.ResourceClaimSpec{}.SwaggerDoc()["resourceClassName"]}, - {Name: "AllocationMode", Type: "string", Description: resourcev1alpha2.ResourceClaimSpec{}.SwaggerDoc()["allocationMode"]}, {Name: "Age", Type: "string", Description: metav1.ObjectMeta{}.SwaggerDoc()["creationTimestamp"]}, } _ = h.TableHandler(resourceClaimTemplateColumnDefinitions, printResourceClaimTemplate) @@ -3002,7 +3000,7 @@ func printResourceClaim(obj *resource.ResourceClaim, options printers.GenerateOp row := metav1.TableRow{ Object: runtime.RawExtension{Object: obj}, } - row.Cells = append(row.Cells, obj.Name, obj.Spec.ResourceClassName, string(obj.Spec.AllocationMode), resourceClaimState(obj), translateTimestampSince(obj.CreationTimestamp)) + row.Cells = append(row.Cells, obj.Name, obj.Spec.ResourceClassName, resourceClaimState(obj), translateTimestampSince(obj.CreationTimestamp)) return []metav1.TableRow{row}, nil } @@ -3043,7 +3041,7 @@ func printResourceClaimTemplate(obj *resource.ResourceClaimTemplate, options pri row := metav1.TableRow{ Object: runtime.RawExtension{Object: obj}, } - row.Cells = append(row.Cells, obj.Name, obj.Spec.Spec.ResourceClassName, string(obj.Spec.Spec.AllocationMode), translateTimestampSince(obj.CreationTimestamp)) + row.Cells = append(row.Cells, obj.Name, obj.Spec.Spec.ResourceClassName, translateTimestampSince(obj.CreationTimestamp)) return []metav1.TableRow{row}, nil } diff --git a/pkg/registry/resource/resourceclaim/storage/storage_test.go b/pkg/registry/resource/resourceclaim/storage/storage_test.go index 613d3c80467b7..114c5f36b914b 100644 --- a/pkg/registry/resource/resourceclaim/storage/storage_test.go +++ b/pkg/registry/resource/resourceclaim/storage/storage_test.go @@ -58,7 +58,6 @@ func validNewClaim(name, ns string) *resource.ResourceClaim { }, Spec: resource.ResourceClaimSpec{ ResourceClassName: "example", - AllocationMode: resource.AllocationModeImmediate, }, Status: resource.ResourceClaimStatus{}, } diff --git a/pkg/registry/resource/resourceclaim/strategy_test.go b/pkg/registry/resource/resourceclaim/strategy_test.go index d4091893b5b2e..e99439234b03d 100644 --- a/pkg/registry/resource/resourceclaim/strategy_test.go +++ b/pkg/registry/resource/resourceclaim/strategy_test.go @@ -31,7 +31,6 @@ var resourceClaim = &resource.ResourceClaim{ }, Spec: resource.ResourceClaimSpec{ ResourceClassName: "valid-class", - AllocationMode: resource.AllocationModeImmediate, }, } diff --git a/pkg/registry/resource/resourceclaimtemplate/storage/storage_test.go b/pkg/registry/resource/resourceclaimtemplate/storage/storage_test.go index 642938b3bc2cb..332cfc2e8514e 100644 --- a/pkg/registry/resource/resourceclaimtemplate/storage/storage_test.go +++ b/pkg/registry/resource/resourceclaimtemplate/storage/storage_test.go @@ -55,7 +55,6 @@ func validNewClaimTemplate(name string) *resource.ResourceClaimTemplate { Spec: resource.ResourceClaimTemplateSpec{ Spec: resource.ResourceClaimSpec{ ResourceClassName: "valid-class", - AllocationMode: resource.AllocationModeImmediate, }, }, } diff --git a/pkg/registry/resource/resourceclaimtemplate/strategy_test.go b/pkg/registry/resource/resourceclaimtemplate/strategy_test.go index 47e2537532160..1eb8ad05c77e3 100644 --- a/pkg/registry/resource/resourceclaimtemplate/strategy_test.go +++ b/pkg/registry/resource/resourceclaimtemplate/strategy_test.go @@ -32,7 +32,6 @@ var resourceClaimTemplate = &resource.ResourceClaimTemplate{ Spec: resource.ResourceClaimTemplateSpec{ Spec: resource.ResourceClaimSpec{ ResourceClassName: "valid-class", - AllocationMode: resource.AllocationModeImmediate, }, }, } diff --git a/pkg/scheduler/framework/plugins/dynamicresources/dynamicresources.go b/pkg/scheduler/framework/plugins/dynamicresources/dynamicresources.go index 90039854a1471..1bcc40cbf5ad8 100644 --- a/pkg/scheduler/framework/plugins/dynamicresources/dynamicresources.go +++ b/pkg/scheduler/framework/plugins/dynamicresources/dynamicresources.go @@ -713,8 +713,7 @@ func (pl *dynamicResources) isSchedulableAfterPodSchedulingContextChange(logger // we allow backoff. pendingDelayedClaims := 0 if err := pl.foreachPodResourceClaim(pod, func(podResourceName string, claim *resourcev1alpha2.ResourceClaim) { - if claim.Spec.AllocationMode == resourcev1alpha2.AllocationModeWaitForFirstConsumer && - claim.Status.Allocation == nil && + if claim.Status.Allocation == nil && !podSchedulingHasClaimInfo(podScheduling, podResourceName) { pendingDelayedClaims++ } @@ -970,9 +969,6 @@ func (pl *dynamicResources) PreFilter(ctx context.Context, state *framework.Cycl } s.informationsForClaim[index].controller = controller needResourceInformation = true - } else if claim.Spec.AllocationMode == resourcev1alpha2.AllocationModeImmediate { - // This will get resolved by the resource driver. - return nil, statusUnschedulable(logger, "unallocated immediate resourceclaim", "pod", klog.KObj(pod), "resourceclaim", klog.KObj(claim)) } } } @@ -1161,74 +1157,63 @@ func (pl *dynamicResources) Filter(ctx context.Context, cs *framework.CycleState var unavailableClaims []int for index, claim := range state.claims { logger.V(10).Info("filtering based on resource claims of the pod", "pod", klog.KObj(pod), "node", klog.KObj(node), "resourceclaim", klog.KObj(claim)) - switch { - case claim.Status.Allocation != nil: + + if claim.Status.Allocation != nil { if nodeSelector := state.informationsForClaim[index].availableOnNode; nodeSelector != nil { if !nodeSelector.Match(node) { logger.V(5).Info("AvailableOnNodes does not match", "pod", klog.KObj(pod), "node", klog.KObj(node), "resourceclaim", klog.KObj(claim)) unavailableClaims = append(unavailableClaims, index) } } - case claim.Status.DeallocationRequested: + continue + } + + if claim.Status.DeallocationRequested { // We shouldn't get here. PreFilter already checked this. return statusUnschedulable(logger, "resourceclaim must be reallocated", "pod", klog.KObj(pod), "node", klog.KObj(node), "resourceclaim", klog.KObj(claim)) - case claim.Spec.AllocationMode == resourcev1alpha2.AllocationModeWaitForFirstConsumer || - state.informationsForClaim[index].structuredParameters: - if selector := state.informationsForClaim[index].availableOnNode; selector != nil { - if matches := selector.Match(node); !matches { - return statusUnschedulable(logger, "excluded by resource class node filter", "pod", klog.KObj(pod), "node", klog.KObj(node), "resourceclassName", claim.Spec.ResourceClassName) - } + } + + if selector := state.informationsForClaim[index].availableOnNode; selector != nil { + if matches := selector.Match(node); !matches { + return statusUnschedulable(logger, "excluded by resource class node filter", "pod", klog.KObj(pod), "node", klog.KObj(node), "resourceclassName", claim.Spec.ResourceClassName) } - // Can the builtin controller tell us whether the node is suitable? - if state.informationsForClaim[index].structuredParameters { - suitable, err := state.informationsForClaim[index].controller.nodeIsSuitable(ctx, node.Name, state.resources) - if err != nil { - // An error indicates that something wasn't configured correctly, for example - // writing a CEL expression which doesn't handle a map lookup error. Normally - // this should never fail. We could return an error here, but then the pod - // would get retried. Instead we ignore the node. - return statusUnschedulable(logger, fmt.Sprintf("checking structured parameters failed: %v", err), "pod", klog.KObj(pod), "node", klog.KObj(node), "resourceclaim", klog.KObj(claim)) - } - if !suitable { - return statusUnschedulable(logger, "resourceclaim cannot be allocated for the node (unsuitable)", "pod", klog.KObj(pod), "node", klog.KObj(node), "resourceclaim", klog.KObj(claim)) - } - } else { - if status := state.informationsForClaim[index].status; status != nil { - for _, unsuitableNode := range status.UnsuitableNodes { - if node.Name == unsuitableNode { - return statusUnschedulable(logger, "resourceclaim cannot be allocated for the node (unsuitable)", "pod", klog.KObj(pod), "node", klog.KObj(node), "resourceclaim", klog.KObj(claim), "unsuitablenodes", status.UnsuitableNodes) - } + } + // Can the builtin controller tell us whether the node is suitable? + if state.informationsForClaim[index].structuredParameters { + suitable, err := state.informationsForClaim[index].controller.nodeIsSuitable(ctx, node.Name, state.resources) + if err != nil { + // An error indicates that something wasn't configured correctly, for example + // writing a CEL expression which doesn't handle a map lookup error. Normally + // this should never fail. We could return an error here, but then the pod + // would get retried. Instead we ignore the node. + return statusUnschedulable(logger, fmt.Sprintf("checking structured parameters failed: %v", err), "pod", klog.KObj(pod), "node", klog.KObj(node), "resourceclaim", klog.KObj(claim)) + } + if !suitable { + return statusUnschedulable(logger, "resourceclaim cannot be allocated for the node (unsuitable)", "pod", klog.KObj(pod), "node", klog.KObj(node), "resourceclaim", klog.KObj(claim)) + } + } else { + if status := state.informationsForClaim[index].status; status != nil { + for _, unsuitableNode := range status.UnsuitableNodes { + if node.Name == unsuitableNode { + return statusUnschedulable(logger, "resourceclaim cannot be allocated for the node (unsuitable)", "pod", klog.KObj(pod), "node", klog.KObj(node), "resourceclaim", klog.KObj(claim), "unsuitablenodes", status.UnsuitableNodes) } } } - default: - // This claim should have been handled above. - // Immediate allocation with control plane controller - // was already checked for in PreFilter. - return statusError(logger, fmt.Errorf("internal error, unexpected allocation mode %v", claim.Spec.AllocationMode)) } } if len(unavailableClaims) > 0 { + // Remember all unavailable claims. This might be observed + // concurrently, so we have to lock the state before writing. state.mutex.Lock() defer state.mutex.Unlock() + if state.unavailableClaims == nil { state.unavailableClaims = sets.New[int]() } for _, index := range unavailableClaims { - claim := state.claims[index] - // Deallocation makes more sense for claims with - // delayed allocation. Claims with immediate allocation - // would just get allocated again for a random node, - // which is unlikely to help the pod. - // - // Claims with builtin controller are handled like - // claims with delayed allocation. - if claim.Spec.AllocationMode == resourcev1alpha2.AllocationModeWaitForFirstConsumer || - state.informationsForClaim[index].controller != nil { - state.unavailableClaims.Insert(index) - } + state.unavailableClaims.Insert(index) } return statusUnschedulable(logger, "resourceclaim not available on the node", "pod", klog.KObj(pod)) } diff --git a/pkg/scheduler/framework/plugins/dynamicresources/dynamicresources_test.go b/pkg/scheduler/framework/plugins/dynamicresources/dynamicresources_test.go index fb46fb443bde7..f06f1740d36f7 100644 --- a/pkg/scheduler/framework/plugins/dynamicresources/dynamicresources_test.go +++ b/pkg/scheduler/framework/plugins/dynamicresources/dynamicresources_test.go @@ -165,53 +165,39 @@ var ( Namespace(namespace). ResourceClassName(className). Obj() - pendingImmediateClaim = st.FromResourceClaim(claim). - AllocationMode(resourcev1alpha2.AllocationModeImmediate). - Obj() - structuredAllocatedImmediateClaim = st.FromResourceClaim(pendingImmediateClaim). - Allocation("some-driver", &resourcev1alpha2.AllocationResult{}). - Structured("worker", "instance-1"). - Obj() - pendingDelayedClaim = st.FromResourceClaim(claim). - OwnerReference(podName, podUID, podKind). - AllocationMode(resourcev1alpha2.AllocationModeWaitForFirstConsumer). - Obj() - pendingDelayedClaim2 = st.FromResourceClaim(pendingDelayedClaim). - Name(claimName2). - Obj() - deallocatingClaim = st.FromResourceClaim(pendingImmediateClaim). + pendingClaim = st.FromResourceClaim(claim). + OwnerReference(podName, podUID, podKind). + Obj() + pendingClaim2 = st.FromResourceClaim(pendingClaim). + Name(claimName2). + Obj() + deallocatingClaim = st.FromResourceClaim(pendingClaim). Allocation("some-driver", &resourcev1alpha2.AllocationResult{}). DeallocationRequested(true). Obj() - inUseClaim = st.FromResourceClaim(pendingImmediateClaim). + inUseClaim = st.FromResourceClaim(pendingClaim). Allocation("some-driver", &resourcev1alpha2.AllocationResult{}). ReservedForPod(podName, types.UID(podUID)). Obj() structuredInUseClaim = st.FromResourceClaim(inUseClaim). Structured("worker", "instance-1"). Obj() - allocatedClaim = st.FromResourceClaim(pendingDelayedClaim). + allocatedClaim = st.FromResourceClaim(pendingClaim). Allocation("some-driver", &resourcev1alpha2.AllocationResult{}). Obj() - pendingDelayedClaimWithParams = st.FromResourceClaim(pendingDelayedClaim).ParametersRef(claimName).Obj() + pendingClaimWithParams = st.FromResourceClaim(pendingClaim).ParametersRef(claimName).Obj() structuredAllocatedClaim = st.FromResourceClaim(allocatedClaim).Structured("worker", "instance-1").Obj() structuredAllocatedClaimWithParams = st.FromResourceClaim(structuredAllocatedClaim).ParametersRef(claimName).Obj() otherStructuredAllocatedClaim = st.FromResourceClaim(structuredAllocatedClaim).Name(structuredAllocatedClaim.Name + "-other").Obj() - allocatedDelayedClaimWithWrongTopology = st.FromResourceClaim(allocatedClaim). - Allocation("some-driver", &resourcev1alpha2.AllocationResult{AvailableOnNodes: st.MakeNodeSelector().In("no-such-label", []string{"no-such-value"}).Obj()}). - Obj() - structuredAllocatedDelayedClaimWithWrongTopology = st.FromResourceClaim(allocatedDelayedClaimWithWrongTopology). - Structured("worker-2", "instance-1"). - Obj() - allocatedImmediateClaimWithWrongTopology = st.FromResourceClaim(allocatedDelayedClaimWithWrongTopology). - AllocationMode(resourcev1alpha2.AllocationModeImmediate). + allocatedClaimWithWrongTopology = st.FromResourceClaim(allocatedClaim). + Allocation("some-driver", &resourcev1alpha2.AllocationResult{AvailableOnNodes: st.MakeNodeSelector().In("no-such-label", []string{"no-such-value"}).Obj()}). + Obj() + structuredAllocatedClaimWithWrongTopology = st.FromResourceClaim(allocatedClaimWithWrongTopology). + Structured("worker-2", "instance-1"). Obj() - structuredAllocatedImmediateClaimWithWrongTopology = st.FromResourceClaim(allocatedImmediateClaimWithWrongTopology). - Structured("worker-2", "instance-1"). - Obj() allocatedClaimWithGoodTopology = st.FromResourceClaim(allocatedClaim). Allocation("some-driver", &resourcev1alpha2.AllocationResult{AvailableOnNodes: st.MakeNodeSelector().In("kubernetes.io/hostname", []string{"worker"}).Obj()}). Obj() @@ -483,22 +469,9 @@ func TestPlugin(t *testing.T) { }, }, }, - "waiting-for-immediate-allocation": { + "structured-no-resources": { pod: podWithClaimName, - claims: []*resourcev1alpha2.ResourceClaim{pendingImmediateClaim}, - classes: []*resourcev1alpha2.ResourceClass{resourceClass}, - want: want{ - prefilter: result{ - status: framework.NewStatus(framework.UnschedulableAndUnresolvable, `unallocated immediate resourceclaim`), - }, - postfilter: result{ - status: framework.NewStatus(framework.Unschedulable, `no new claims to deallocate`), - }, - }, - }, - "immediate-allocation-structured-no-resources": { - pod: podWithClaimName, - claims: []*resourcev1alpha2.ResourceClaim{pendingImmediateClaim}, + claims: []*resourcev1alpha2.ResourceClaim{pendingClaim}, classes: []*resourcev1alpha2.ResourceClass{structuredResourceClass}, want: want{ filter: perNodeResult{ @@ -511,51 +484,9 @@ func TestPlugin(t *testing.T) { }, }, }, - "immediate-allocation-structured-with-resources": { + "structured-with-resources": { pod: podWithClaimName, - claims: []*resourcev1alpha2.ResourceClaim{pendingImmediateClaim}, - classes: []*resourcev1alpha2.ResourceClass{structuredResourceClass}, - objs: []apiruntime.Object{workerNodeSlice}, - want: want{ - reserve: result{ - inFlightClaim: structuredAllocatedImmediateClaim, - }, - prebind: result{ - assumedClaim: reserve(structuredAllocatedImmediateClaim, podWithClaimName), - changes: change{ - claim: func(claim *resourcev1alpha2.ResourceClaim) *resourcev1alpha2.ResourceClaim { - if claim.Name == claimName { - claim = claim.DeepCopy() - claim.Finalizers = structuredAllocatedImmediateClaim.Finalizers - claim.Status = structuredInUseClaim.Status - } - return claim - }, - }, - }, - postbind: result{ - assumedClaim: reserve(structuredAllocatedImmediateClaim, podWithClaimName), - }, - }, - }, - "delayed-allocation-structured-no-resources": { - pod: podWithClaimName, - claims: []*resourcev1alpha2.ResourceClaim{pendingDelayedClaim}, - classes: []*resourcev1alpha2.ResourceClass{structuredResourceClass}, - want: want{ - filter: perNodeResult{ - workerNode.Name: { - status: framework.NewStatus(framework.UnschedulableAndUnresolvable, `resourceclaim cannot be allocated for the node (unsuitable)`), - }, - }, - postfilter: result{ - status: framework.NewStatus(framework.Unschedulable, `still not schedulable`), - }, - }, - }, - "delayed-allocation-structured-with-resources": { - pod: podWithClaimName, - claims: []*resourcev1alpha2.ResourceClaim{pendingDelayedClaim}, + claims: []*resourcev1alpha2.ResourceClaim{pendingClaim}, classes: []*resourcev1alpha2.ResourceClass{structuredResourceClass}, objs: []apiruntime.Object{workerNodeSlice}, want: want{ @@ -580,12 +511,12 @@ func TestPlugin(t *testing.T) { }, }, }, - "delayed-allocation-structured-with-resources-has-finalizer": { + "structured-with-resources-has-finalizer": { // As before. but the finalizer is already set. Could happen if // the scheduler got interrupted. pod: podWithClaimName, claims: func() []*resourcev1alpha2.ResourceClaim { - claim := pendingDelayedClaim.DeepCopy() + claim := pendingClaim.DeepCopy() claim.Finalizers = structuredAllocatedClaim.Finalizers return []*resourcev1alpha2.ResourceClaim{claim} }(), @@ -612,12 +543,12 @@ func TestPlugin(t *testing.T) { }, }, }, - "delayed-allocation-structured-with-resources-finalizer-gets-removed": { + "structured-with-resources-finalizer-gets-removed": { // As before. but the finalizer is already set. Then it gets // removed before the scheduler reaches PreBind. pod: podWithClaimName, claims: func() []*resourcev1alpha2.ResourceClaim { - claim := pendingDelayedClaim.DeepCopy() + claim := pendingClaim.DeepCopy() claim.Finalizers = structuredAllocatedClaim.Finalizers return []*resourcev1alpha2.ResourceClaim{claim} }(), @@ -653,11 +584,11 @@ func TestPlugin(t *testing.T) { }, }, }, - "delayed-allocation-structured-with-resources-finalizer-gets-added": { + "structured-with-resources-finalizer-gets-added": { // No finalizer initially, then it gets added before // the scheduler reaches PreBind. Shouldn't happen? pod: podWithClaimName, - claims: []*resourcev1alpha2.ResourceClaim{pendingDelayedClaim}, + claims: []*resourcev1alpha2.ResourceClaim{pendingClaim}, classes: []*resourcev1alpha2.ResourceClass{structuredResourceClass}, objs: []apiruntime.Object{workerNodeSlice}, prepare: prepare{ @@ -689,9 +620,9 @@ func TestPlugin(t *testing.T) { }, }, }, - "delayed-allocation-structured-skip-bind": { + "structured-skip-bind": { pod: podWithClaimName, - claims: []*resourcev1alpha2.ResourceClaim{pendingDelayedClaim}, + claims: []*resourcev1alpha2.ResourceClaim{pendingClaim}, classes: []*resourcev1alpha2.ResourceClass{structuredResourceClass}, objs: []apiruntime.Object{workerNodeSlice}, want: want{ @@ -701,9 +632,9 @@ func TestPlugin(t *testing.T) { unreserveBeforePreBind: &result{}, }, }, - "delayed-allocation-structured-exhausted-resources": { + "structured-exhausted-resources": { pod: podWithClaimName, - claims: []*resourcev1alpha2.ResourceClaim{pendingDelayedClaim, otherStructuredAllocatedClaim}, + claims: []*resourcev1alpha2.ResourceClaim{pendingClaim, otherStructuredAllocatedClaim}, classes: []*resourcev1alpha2.ResourceClass{structuredResourceClass}, objs: []apiruntime.Object{workerNodeSlice}, want: want{ @@ -720,7 +651,7 @@ func TestPlugin(t *testing.T) { "with-parameters": { pod: podWithClaimName, - claims: []*resourcev1alpha2.ResourceClaim{pendingDelayedClaimWithParams}, + claims: []*resourcev1alpha2.ResourceClaim{pendingClaimWithParams}, classes: []*resourcev1alpha2.ResourceClass{structuredResourceClassWithParams}, objs: []apiruntime.Object{claimParameters, classParameters, workerNodeSlice}, want: want{ @@ -748,7 +679,7 @@ func TestPlugin(t *testing.T) { "with-translated-parameters": { pod: podWithClaimName, - claims: []*resourcev1alpha2.ResourceClaim{claimWithCRD(pendingDelayedClaimWithParams)}, + claims: []*resourcev1alpha2.ResourceClaim{claimWithCRD(pendingClaimWithParams)}, classes: []*resourcev1alpha2.ResourceClass{classWithCRD(structuredResourceClassWithCRD)}, objs: []apiruntime.Object{claimParameters, claimParametersOtherNamespace /* must be ignored */, classParameters, workerNodeSlice}, want: want{ @@ -776,7 +707,7 @@ func TestPlugin(t *testing.T) { "missing-class-parameters": { pod: podWithClaimName, - claims: []*resourcev1alpha2.ResourceClaim{pendingDelayedClaimWithParams}, + claims: []*resourcev1alpha2.ResourceClaim{pendingClaimWithParams}, classes: []*resourcev1alpha2.ResourceClass{structuredResourceClassWithParams}, objs: []apiruntime.Object{claimParameters, workerNodeSlice}, want: want{ @@ -791,7 +722,7 @@ func TestPlugin(t *testing.T) { "missing-claim-parameters": { pod: podWithClaimName, - claims: []*resourcev1alpha2.ResourceClaim{pendingDelayedClaimWithParams}, + claims: []*resourcev1alpha2.ResourceClaim{pendingClaimWithParams}, classes: []*resourcev1alpha2.ResourceClass{structuredResourceClassWithParams}, objs: []apiruntime.Object{classParameters, workerNodeSlice}, want: want{ @@ -806,7 +737,7 @@ func TestPlugin(t *testing.T) { "missing-translated-class-parameters": { pod: podWithClaimName, - claims: []*resourcev1alpha2.ResourceClaim{claimWithCRD(pendingDelayedClaimWithParams)}, + claims: []*resourcev1alpha2.ResourceClaim{claimWithCRD(pendingClaimWithParams)}, classes: []*resourcev1alpha2.ResourceClass{classWithCRD(structuredResourceClassWithCRD)}, objs: []apiruntime.Object{claimParameters, workerNodeSlice}, want: want{ @@ -821,7 +752,7 @@ func TestPlugin(t *testing.T) { "missing-translated-claim-parameters": { pod: podWithClaimName, - claims: []*resourcev1alpha2.ResourceClaim{claimWithCRD(pendingDelayedClaimWithParams)}, + claims: []*resourcev1alpha2.ResourceClaim{claimWithCRD(pendingClaimWithParams)}, classes: []*resourcev1alpha2.ResourceClass{classWithCRD(structuredResourceClassWithCRD)}, objs: []apiruntime.Object{classParameters, workerNodeSlice}, want: want{ @@ -836,7 +767,7 @@ func TestPlugin(t *testing.T) { "too-many-translated-class-parameters": { pod: podWithClaimName, - claims: []*resourcev1alpha2.ResourceClaim{claimWithCRD(pendingDelayedClaimWithParams)}, + claims: []*resourcev1alpha2.ResourceClaim{claimWithCRD(pendingClaimWithParams)}, classes: []*resourcev1alpha2.ResourceClass{classWithCRD(structuredResourceClassWithCRD)}, objs: []apiruntime.Object{claimParameters, classParameters, st.FromClassParameters(classParameters).Name("other").Obj() /* too many */, workerNodeSlice}, want: want{ @@ -851,7 +782,7 @@ func TestPlugin(t *testing.T) { "too-many-translated-claim-parameters": { pod: podWithClaimName, - claims: []*resourcev1alpha2.ResourceClaim{claimWithCRD(pendingDelayedClaimWithParams)}, + claims: []*resourcev1alpha2.ResourceClaim{claimWithCRD(pendingClaimWithParams)}, classes: []*resourcev1alpha2.ResourceClass{classWithCRD(structuredResourceClassWithCRD)}, objs: []apiruntime.Object{claimParameters, st.FromClaimParameters(claimParameters).Name("other").Obj() /* too many */, classParameters, workerNodeSlice}, want: want{ @@ -866,7 +797,7 @@ func TestPlugin(t *testing.T) { "claim-parameters-CEL-runtime-error": { pod: podWithClaimName, - claims: []*resourcev1alpha2.ResourceClaim{pendingDelayedClaimWithParams}, + claims: []*resourcev1alpha2.ResourceClaim{pendingClaimWithParams}, classes: []*resourcev1alpha2.ResourceClass{structuredResourceClassWithParams}, objs: []apiruntime.Object{breakCELInClaimParameters(claimParameters), classParameters, workerNodeSlice}, want: want{ @@ -883,7 +814,7 @@ func TestPlugin(t *testing.T) { "class-parameters-CEL-runtime-error": { pod: podWithClaimName, - claims: []*resourcev1alpha2.ResourceClaim{pendingDelayedClaimWithParams}, + claims: []*resourcev1alpha2.ResourceClaim{pendingClaimWithParams}, classes: []*resourcev1alpha2.ResourceClass{structuredResourceClassWithParams}, objs: []apiruntime.Object{claimParameters, breakCELInClassParameters(classParameters), workerNodeSlice}, want: want{ @@ -910,9 +841,9 @@ func TestPlugin(t *testing.T) { }, }, }, - "delayed-allocation-missing-class": { + "missing-class": { pod: podWithClaimName, - claims: []*resourcev1alpha2.ResourceClaim{pendingDelayedClaim}, + claims: []*resourcev1alpha2.ResourceClaim{pendingClaim}, want: want{ prefilter: result{ status: framework.NewStatus(framework.UnschedulableAndUnresolvable, fmt.Sprintf("resource class %s does not exist", className)), @@ -922,11 +853,11 @@ func TestPlugin(t *testing.T) { }, }, }, - "delayed-allocation-scheduling-select-immediately": { + "scheduling-select-immediately": { // Create the PodSchedulingContext object, ask for information // and select a node. pod: podWithClaimName, - claims: []*resourcev1alpha2.ResourceClaim{pendingDelayedClaim}, + claims: []*resourcev1alpha2.ResourceClaim{pendingClaim}, classes: []*resourcev1alpha2.ResourceClass{resourceClass}, want: want{ prebind: result{ @@ -935,12 +866,12 @@ func TestPlugin(t *testing.T) { }, }, }, - "delayed-allocation-scheduling-ask": { + "scheduling-ask": { // Create the PodSchedulingContext object, ask for // information, but do not select a node because // there are multiple claims. pod: podWithTwoClaimNames, - claims: []*resourcev1alpha2.ResourceClaim{pendingDelayedClaim, pendingDelayedClaim2}, + claims: []*resourcev1alpha2.ResourceClaim{pendingClaim, pendingClaim2}, classes: []*resourcev1alpha2.ResourceClass{resourceClass}, want: want{ prebind: result{ @@ -949,11 +880,11 @@ func TestPlugin(t *testing.T) { }, }, }, - "delayed-allocation-scheduling-finish": { + "scheduling-finish": { // Use the populated PodSchedulingContext object to select a // node. pod: podWithClaimName, - claims: []*resourcev1alpha2.ResourceClaim{pendingDelayedClaim}, + claims: []*resourcev1alpha2.ResourceClaim{pendingClaim}, schedulings: []*resourcev1alpha2.PodSchedulingContext{schedulingInfo}, classes: []*resourcev1alpha2.ResourceClass{resourceClass}, want: want{ @@ -969,11 +900,11 @@ func TestPlugin(t *testing.T) { }, }, }, - "delayed-allocation-scheduling-finish-concurrent-label-update": { + "scheduling-finish-concurrent-label-update": { // Use the populated PodSchedulingContext object to select a // node. pod: podWithClaimName, - claims: []*resourcev1alpha2.ResourceClaim{pendingDelayedClaim}, + claims: []*resourcev1alpha2.ResourceClaim{pendingClaim}, schedulings: []*resourcev1alpha2.PodSchedulingContext{schedulingInfo}, classes: []*resourcev1alpha2.ResourceClass{resourceClass}, prepare: prepare{ @@ -994,7 +925,7 @@ func TestPlugin(t *testing.T) { }, }, }, - "delayed-allocation-scheduling-completed": { + "scheduling-completed": { // Remove PodSchedulingContext object once the pod is scheduled. pod: podWithClaimName, claims: []*resourcev1alpha2.ResourceClaim{allocatedClaim}, @@ -1031,11 +962,11 @@ func TestPlugin(t *testing.T) { }, }, }, - "wrong-topology-delayed-allocation": { + "wrong-topology": { // PostFilter tries to get the pod scheduleable by // deallocating the claim. pod: podWithClaimName, - claims: []*resourcev1alpha2.ResourceClaim{allocatedDelayedClaimWithWrongTopology}, + claims: []*resourcev1alpha2.ResourceClaim{allocatedClaimWithWrongTopology}, want: want{ filter: perNodeResult{ workerNode.Name: { @@ -1055,29 +986,11 @@ func TestPlugin(t *testing.T) { }, }, }, - "wrong-topology-immediate-allocation": { - // PostFilter tries to get the pod scheduleable by - // deallocating the claim. - pod: podWithClaimName, - claims: []*resourcev1alpha2.ResourceClaim{allocatedImmediateClaimWithWrongTopology}, - want: want{ - filter: perNodeResult{ - workerNode.Name: { - status: framework.NewStatus(framework.UnschedulableAndUnresolvable, `resourceclaim not available on the node`), - }, - }, - postfilter: result{ - // Claims with immediate allocation don't. They would just get allocated again right - // away, without considering the needs of the pod. - status: framework.NewStatus(framework.Unschedulable, `still not schedulable`), - }, - }, - }, - "wrong-topology-delayed-allocation-structured": { + "wrong-topology-structured": { // PostFilter tries to get the pod scheduleable by // deallocating the claim. pod: podWithClaimName, - claims: []*resourcev1alpha2.ResourceClaim{structuredAllocatedDelayedClaimWithWrongTopology}, + claims: []*resourcev1alpha2.ResourceClaim{structuredAllocatedClaimWithWrongTopology}, want: want{ filter: perNodeResult{ workerNode.Name: { @@ -1097,25 +1010,6 @@ func TestPlugin(t *testing.T) { }, }, }, - "wrong-topology-immediate-allocation-structured": { - // PostFilter tries to get the pod scheduleable by - // deallocating the claim. - pod: podWithClaimName, - claims: []*resourcev1alpha2.ResourceClaim{structuredAllocatedImmediateClaimWithWrongTopology}, - want: want{ - filter: perNodeResult{ - workerNode.Name: { - status: framework.NewStatus(framework.UnschedulableAndUnresolvable, `resourceclaim not available on the node`), - }, - }, - postfilter: result{ - // Claims with immediate allocation don't. The allocation is considered - // more important than the pod and pods need to wait for the node to - // become available again. - status: framework.NewStatus(framework.Unschedulable, `still not schedulable`), - }, - }, - }, "good-topology": { pod: podWithClaimName, claims: []*resourcev1alpha2.ResourceClaim{allocatedClaimWithGoodTopology}, @@ -1665,22 +1559,22 @@ func Test_isSchedulableAfterClaimChange(t *testing.T) { }, "queue-on-add": { pod: podWithClaimName, - newObj: pendingImmediateClaim, + newObj: pendingClaim, expectedHint: framework.Queue, }, "backoff-wrong-old-object": { pod: podWithClaimName, - claims: []*resourcev1alpha2.ResourceClaim{pendingDelayedClaim}, + claims: []*resourcev1alpha2.ResourceClaim{pendingClaim}, oldObj: "not-a-claim", - newObj: pendingImmediateClaim, + newObj: pendingClaim, expectedErr: true, }, "skip-adding-finalizer": { pod: podWithClaimName, - claims: []*resourcev1alpha2.ResourceClaim{pendingImmediateClaim}, - oldObj: pendingImmediateClaim, + claims: []*resourcev1alpha2.ResourceClaim{pendingClaim}, + oldObj: pendingClaim, newObj: func() *resourcev1alpha2.ResourceClaim { - claim := pendingImmediateClaim.DeepCopy() + claim := pendingClaim.DeepCopy() claim.Finalizers = append(claim.Finalizers, "foo") return claim }(), @@ -1688,10 +1582,10 @@ func Test_isSchedulableAfterClaimChange(t *testing.T) { }, "queue-on-status-change": { pod: podWithClaimName, - claims: []*resourcev1alpha2.ResourceClaim{pendingImmediateClaim}, - oldObj: pendingImmediateClaim, + claims: []*resourcev1alpha2.ResourceClaim{pendingClaim}, + oldObj: pendingClaim, newObj: func() *resourcev1alpha2.ResourceClaim { - claim := pendingImmediateClaim.DeepCopy() + claim := pendingClaim.DeepCopy() claim.Status.Allocation = &resourcev1alpha2.AllocationResult{} return claim }(), @@ -1699,7 +1593,7 @@ func Test_isSchedulableAfterClaimChange(t *testing.T) { }, "structured-claim-deallocate": { pod: podWithClaimName, - claims: []*resourcev1alpha2.ResourceClaim{pendingDelayedClaim, otherStructuredAllocatedClaim}, + claims: []*resourcev1alpha2.ResourceClaim{pendingClaim, otherStructuredAllocatedClaim}, oldObj: otherStructuredAllocatedClaim, newObj: func() *resourcev1alpha2.ResourceClaim { claim := otherStructuredAllocatedClaim.DeepCopy() @@ -1804,7 +1698,7 @@ func Test_isSchedulableAfterPodSchedulingContextChange(t *testing.T) { }, "skip-unrelated-object": { pod: podWithClaimTemplate, - claims: []*resourcev1alpha2.ResourceClaim{pendingDelayedClaim}, + claims: []*resourcev1alpha2.ResourceClaim{pendingClaim}, newObj: func() *resourcev1alpha2.PodSchedulingContext { scheduling := scheduling.DeepCopy() scheduling.Name += "-foo" @@ -1826,21 +1720,21 @@ func Test_isSchedulableAfterPodSchedulingContextChange(t *testing.T) { }, "skip-missing-infos": { pod: podWithClaimTemplateInStatus, - claims: []*resourcev1alpha2.ResourceClaim{pendingDelayedClaim}, + claims: []*resourcev1alpha2.ResourceClaim{pendingClaim}, oldObj: scheduling, newObj: scheduling, expectedHint: framework.QueueSkip, }, "queue-new-infos": { pod: podWithClaimTemplateInStatus, - claims: []*resourcev1alpha2.ResourceClaim{pendingDelayedClaim}, + claims: []*resourcev1alpha2.ResourceClaim{pendingClaim}, oldObj: scheduling, newObj: schedulingInfo, expectedHint: framework.Queue, }, "queue-bad-selected-node": { pod: podWithClaimTemplateInStatus, - claims: []*resourcev1alpha2.ResourceClaim{pendingDelayedClaim}, + claims: []*resourcev1alpha2.ResourceClaim{pendingClaim}, oldObj: func() *resourcev1alpha2.PodSchedulingContext { scheduling := schedulingInfo.DeepCopy() scheduling.Spec.SelectedNode = workerNode.Name @@ -1856,7 +1750,7 @@ func Test_isSchedulableAfterPodSchedulingContextChange(t *testing.T) { }, "skip-spec-changes": { pod: podWithClaimTemplateInStatus, - claims: []*resourcev1alpha2.ResourceClaim{pendingDelayedClaim}, + claims: []*resourcev1alpha2.ResourceClaim{pendingClaim}, oldObj: schedulingInfo, newObj: func() *resourcev1alpha2.PodSchedulingContext { scheduling := schedulingInfo.DeepCopy() @@ -1867,7 +1761,7 @@ func Test_isSchedulableAfterPodSchedulingContextChange(t *testing.T) { }, "backoff-other-changes": { pod: podWithClaimTemplateInStatus, - claims: []*resourcev1alpha2.ResourceClaim{pendingDelayedClaim}, + claims: []*resourcev1alpha2.ResourceClaim{pendingClaim}, oldObj: schedulingInfo, newObj: func() *resourcev1alpha2.PodSchedulingContext { scheduling := schedulingInfo.DeepCopy() diff --git a/pkg/scheduler/testing/wrappers.go b/pkg/scheduler/testing/wrappers.go index 3ddd79cb61db4..8c1abaf4d25fd 100644 --- a/pkg/scheduler/testing/wrappers.go +++ b/pkg/scheduler/testing/wrappers.go @@ -946,12 +946,6 @@ func (wrapper *ResourceClaimWrapper) OwnerReference(name, uid string, gvk schema return wrapper } -// AllocationMode sets the allocation mode of the inner object. -func (wrapper *ResourceClaimWrapper) AllocationMode(a resourcev1alpha2.AllocationMode) *ResourceClaimWrapper { - wrapper.ResourceClaim.Spec.AllocationMode = a - return wrapper -} - // ParametersRef sets a reference to a ResourceClaimParameters.resource.k8s.io. func (wrapper *ResourceClaimWrapper) ParametersRef(name string) *ResourceClaimWrapper { wrapper.ResourceClaim.Spec.ParametersRef = &resourcev1alpha2.ResourceClaimParametersReference{ diff --git a/staging/src/k8s.io/api/resource/v1alpha2/generated.pb.go b/staging/src/k8s.io/api/resource/v1alpha2/generated.pb.go index 6c6ba438e3869..72deb49412727 100644 --- a/staging/src/k8s.io/api/resource/v1alpha2/generated.pb.go +++ b/staging/src/k8s.io/api/resource/v1alpha2/generated.pb.go @@ -1331,148 +1331,146 @@ func init() { } var fileDescriptor_4312f5b44a31ec02 = []byte{ - // 2242 bytes of a gzipped FileDescriptorProto + // 2219 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x1a, 0x4d, 0x6c, 0x1c, 0x57, - 0xd9, 0xb3, 0xbb, 0x89, 0xd7, 0x9f, 0xed, 0xb5, 0x33, 0xb6, 0xe3, 0x4d, 0xea, 0xee, 0x6e, 0x47, - 0x20, 0x2c, 0x70, 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x99, 0x75, 0x61, 0xd0, 0xaf, 0xce, - 0x36, 0xd9, 0x0a, 0x07, 0x15, 0xdb, 0xaa, 0x03, 0xb3, 0xfc, 0x17, 0x17, 0x68, 0x86, 0x09, 0xf4, - 0x4a, 0x16, 0x81, 0x9a, 0x21, 0x3a, 0x4f, 0xf1, 0x91, 0x05, 0xce, 0x2b, 0xca, 0x41, 0xfd, 0x22, - 0x4c, 0x1f, 0x62, 0xd7, 0x0b, 0xb1, 0x32, 0x30, 0xd1, 0x16, 0x07, 0xfd, 0xea, 0xdc, 0x2e, 0x5f, - 0xe2, 0xf0, 0x3e, 0x80, 0xb6, 0x05, 0xcb, 0x32, 0xaf, 0xab, 0x56, 0x9b, 0x62, 0x57, 0xdd, 0x80, - 0x22, 0x11, 0x55, 0x45, 0xb8, 0x6d, 0x10, 0x40, 0x7e, 0xb5, 0x41, 0x01, 0x84, 0xf6, 0x1b, 0x05, - 0x4e, 0xc7, 0x75, 0x48, 0xa8, 0x61, 0xb7, 0xc6, 0xf1, 0x7d, 0x0b, 0x20, 0x70, 0x41, 0x2f, 0x93, - 0x78, 0xc1, 0xfd, 0xf2, 0x44, 0x6e, 0x1f, 0xa6, 0xae, 0x60, 0x89, 0xa0, 0x08, 0x71, 0xed, 0xe2, - 0xb0, 0x98, 0xc2, 0x9a, 0x6b, 0x50, 0xb0, 0x6c, 0xca, 0x6b, 0x7b, 0x5e, 0x2f, 0x7a, 0x22, 0x6e, - 0xdb, 0x94, 0x20, 0xb6, 0xaa, 0xbd, 0x0e, 0x2b, 0xb1, 0x62, 0xc4, 0x53, 0x47, 0x46, 0x35, 0x3d, - 0x18, 0xca, 0x11, 0xc1, 0x0f, 0x15, 0xc3, 0x8c, 0x25, 0x74, 0xe6, 0x77, 0x18, 0x19, 0x9d, 0x96, - 0x23, 0x87, 0x85, 0xdc, 0x5f, 0x21, 0x28, 0xa4, 0xac, 0xe9, 0x70, 0x26, 0xd5, 0xb7, 0xd4, 0xcf, - 0xc3, 0x34, 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41, 0x4d, 0xf9, 0xc7, + 0xa0, 0xa6, 0x7c, 0xf4, 0xcf, 0xda, 0xd4, 0x7b, 0x6b, 0xa3, 0xfe, 0x9d, 0xef, 0xbf, 0x01, 0x00, + 0x00, 0xff, 0xff, 0xaf, 0x16, 0x22, 0xd5, 0xed, 0x27, 0x00, 0x00, } func (m *AllocationResult) Marshal() (dAtA []byte, err error) { @@ -2539,11 +2537,6 @@ func (m *ResourceClaimSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - i -= len(m.AllocationMode) - copy(dAtA[i:], m.AllocationMode) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.AllocationMode))) - i-- - dAtA[i] = 0x1a if m.ParametersRef != nil { { size, err := m.ParametersRef.MarshalToSizedBuffer(dAtA[:i]) @@ -3886,8 +3879,6 @@ func (m *ResourceClaimSpec) Size() (n int) { l = m.ParametersRef.Size() n += 1 + l + sovGenerated(uint64(l)) } - l = len(m.AllocationMode) - n += 1 + l + sovGenerated(uint64(l)) return n } @@ -4536,7 +4527,6 @@ func (this *ResourceClaimSpec) String() string { s := strings.Join([]string{`&ResourceClaimSpec{`, `ResourceClassName:` + fmt.Sprintf("%v", this.ResourceClassName) + `,`, `ParametersRef:` + strings.Replace(this.ParametersRef.String(), "ResourceClaimParametersReference", "ResourceClaimParametersReference", 1) + `,`, - `AllocationMode:` + fmt.Sprintf("%v", this.AllocationMode) + `,`, `}`, }, "") return s @@ -7889,38 +7879,6 @@ func (m *ResourceClaimSpec) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AllocationMode", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AllocationMode = AllocationMode(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) diff --git a/staging/src/k8s.io/api/resource/v1alpha2/generated.proto b/staging/src/k8s.io/api/resource/v1alpha2/generated.proto index 8c46531086d36..25727d8fe4afb 100644 --- a/staging/src/k8s.io/api/resource/v1alpha2/generated.proto +++ b/staging/src/k8s.io/api/resource/v1alpha2/generated.proto @@ -411,11 +411,6 @@ message ResourceClaimSpec { // The object must be in the same namespace as the ResourceClaim. // +optional optional ResourceClaimParametersReference parametersRef = 2; - - // Allocation can start immediately or when a Pod wants to use the - // resource. "WaitForFirstConsumer" is the default. - // +optional - optional string allocationMode = 3; } // ResourceClaimStatus tracks whether the resource has been allocated and what diff --git a/staging/src/k8s.io/api/resource/v1alpha2/types.go b/staging/src/k8s.io/api/resource/v1alpha2/types.go index fa0f2cd707f6c..1915391209c88 100644 --- a/staging/src/k8s.io/api/resource/v1alpha2/types.go +++ b/staging/src/k8s.io/api/resource/v1alpha2/types.go @@ -72,34 +72,8 @@ type ResourceClaimSpec struct { // The object must be in the same namespace as the ResourceClaim. // +optional ParametersRef *ResourceClaimParametersReference `json:"parametersRef,omitempty" protobuf:"bytes,2,opt,name=parametersRef"` - - // Allocation can start immediately or when a Pod wants to use the - // resource. "WaitForFirstConsumer" is the default. - // +optional - AllocationMode AllocationMode `json:"allocationMode,omitempty" protobuf:"bytes,3,opt,name=allocationMode"` } -// AllocationMode describes whether a ResourceClaim gets allocated immediately -// when it gets created (AllocationModeImmediate) or whether allocation is -// delayed until it is needed for a Pod -// (AllocationModeWaitForFirstConsumer). Other modes might get added in the -// future. -type AllocationMode string - -const ( - // When a ResourceClaim has AllocationModeWaitForFirstConsumer, allocation is - // delayed until a Pod gets scheduled that needs the ResourceClaim. The - // scheduler will consider all resource requirements of that Pod and - // trigger allocation for a node that fits the Pod. - AllocationModeWaitForFirstConsumer AllocationMode = "WaitForFirstConsumer" - - // When a ResourceClaim has AllocationModeImmediate, allocation starts - // as soon as the ResourceClaim gets created. This is done without - // considering the needs of Pods that will use the ResourceClaim - // because those Pods are not known yet. - AllocationModeImmediate AllocationMode = "Immediate" -) - // ResourceClaimStatus tracks whether the resource has been allocated and what // the resulting attributes are. type ResourceClaimStatus struct { diff --git a/staging/src/k8s.io/api/resource/v1alpha2/types_swagger_doc_generated.go b/staging/src/k8s.io/api/resource/v1alpha2/types_swagger_doc_generated.go index 11f9ffbead2a1..7799e3ca68430 100644 --- a/staging/src/k8s.io/api/resource/v1alpha2/types_swagger_doc_generated.go +++ b/staging/src/k8s.io/api/resource/v1alpha2/types_swagger_doc_generated.go @@ -187,7 +187,6 @@ var map_ResourceClaimSpec = map[string]string{ "": "ResourceClaimSpec defines how a resource is to be allocated.", "resourceClassName": "ResourceClassName references the driver and additional parameters via the name of a ResourceClass that was created as part of the driver deployment.", "parametersRef": "ParametersRef references a separate object with arbitrary parameters that will be used by the driver when allocating a resource for the claim.\n\nThe object must be in the same namespace as the ResourceClaim.", - "allocationMode": "Allocation can start immediately or when a Pod wants to use the resource. \"WaitForFirstConsumer\" is the default.", } func (ResourceClaimSpec) SwaggerDoc() map[string]string { diff --git a/staging/src/k8s.io/api/testdata/HEAD/resource.k8s.io.v1alpha2.ResourceClaim.json b/staging/src/k8s.io/api/testdata/HEAD/resource.k8s.io.v1alpha2.ResourceClaim.json index 3b370ead83328..811ee6ee80c9b 100644 --- a/staging/src/k8s.io/api/testdata/HEAD/resource.k8s.io.v1alpha2.ResourceClaim.json +++ b/staging/src/k8s.io/api/testdata/HEAD/resource.k8s.io.v1alpha2.ResourceClaim.json @@ -49,8 +49,7 @@ "apiGroup": "apiGroupValue", "kind": "kindValue", "name": "nameValue" - }, - "allocationMode": "allocationModeValue" + } }, "status": { "driverName": "driverNameValue", diff --git a/staging/src/k8s.io/api/testdata/HEAD/resource.k8s.io.v1alpha2.ResourceClaim.pb b/staging/src/k8s.io/api/testdata/HEAD/resource.k8s.io.v1alpha2.ResourceClaim.pb index b6709816fd46d14bce388c8133669e2431fee03d..9bb22e33b60428b528e440ce270f6eabe8da9f01 100644 GIT binary patch delta 23 fcmZqY_{2WJfN{@8!&F8_`^nQ89X7vVlx6||V!j8q delta 38 ucmeyw-p(<>fbrr+!&FAbkjc{-9r%P3b8_;N6H7Al^L+DDHeX;=VgdjIbqz8A diff --git a/staging/src/k8s.io/api/testdata/HEAD/resource.k8s.io.v1alpha2.ResourceClaim.yaml b/staging/src/k8s.io/api/testdata/HEAD/resource.k8s.io.v1alpha2.ResourceClaim.yaml index 41079295502cf..d3e59e6a65b13 100644 --- a/staging/src/k8s.io/api/testdata/HEAD/resource.k8s.io.v1alpha2.ResourceClaim.yaml +++ b/staging/src/k8s.io/api/testdata/HEAD/resource.k8s.io.v1alpha2.ResourceClaim.yaml @@ -33,7 +33,6 @@ metadata: selfLink: selfLinkValue uid: uidValue spec: - allocationMode: allocationModeValue parametersRef: apiGroup: apiGroupValue kind: kindValue diff --git a/staging/src/k8s.io/api/testdata/HEAD/resource.k8s.io.v1alpha2.ResourceClaimTemplate.json b/staging/src/k8s.io/api/testdata/HEAD/resource.k8s.io.v1alpha2.ResourceClaimTemplate.json index b1e363fa351e4..060fa386e95e4 100644 --- a/staging/src/k8s.io/api/testdata/HEAD/resource.k8s.io.v1alpha2.ResourceClaimTemplate.json +++ b/staging/src/k8s.io/api/testdata/HEAD/resource.k8s.io.v1alpha2.ResourceClaimTemplate.json @@ -92,8 +92,7 @@ "apiGroup": "apiGroupValue", "kind": "kindValue", "name": "nameValue" - }, - "allocationMode": "allocationModeValue" + } } } } \ No newline at end of file diff --git a/staging/src/k8s.io/api/testdata/HEAD/resource.k8s.io.v1alpha2.ResourceClaimTemplate.pb b/staging/src/k8s.io/api/testdata/HEAD/resource.k8s.io.v1alpha2.ResourceClaimTemplate.pb index b251edf164d8ed9fe858c88a6ac322b4a986166c..d8e02713279d6541bd285b1099307ee6b95cc0cf 100644 GIT binary patch delta 31 ncmcc1c7kn!1ydK><^_x?jEqY*&u2_!WVD~m%Iv_*pu_+Gq<9Ep delta 52 zcmX@Xc9(5}1=D=C%?lV)7#VkNp3j)d$QUx2mDxc;I58(DKRK}^Ge6HaKP5FRF{d1We4apdVbT==>Z%dP6qxqT2=nAdB^MD_R<)Jn zY8!Jwd?wNQVk4IuKYTo8OWH|XJ$}B#RTD1DU{KV-RGi|Gl~<+Q=r~Y7jQJr7V-nde z&AjEz^*$ILVd}7*>UXAUDn%5KSs^=mUFXFfVTh8OSfJ#&*E_H@Kn(RUmw;99gNgq{ zzCBOl#2((pUkfFz7L#G>ii=U8k~zpi=Ju{p5>aQGgbei%RudqOU5IJ6)&`id%wz6H zfja-EEBjf8qRYt;^K>0_wwkX!i%-1h7Ow1|BNHh`>4T8!z=Okw4hNR{ed*oC2}}xS}MuICBz{Qge#E zQ!9nIAxyB2Bqc7s#Js%xlEf0AAz*0%BtBS8mMIr!c4i*LVkw0CmEf+?;!iBdM0SV) zqXlCTe_CcE z0veW@lTsW~SpW$cD;6%M>RKm(;?g8|NPq)%3G-+u(>|2#xx`?>4ou|5#qbm?q{_t$ UObqTt`K1MrNXD9Wq!^SK0Om?2Jpcdz literal 0 HcmV?d00001 diff --git a/staging/src/k8s.io/api/testdata/v1.29.0/resource.k8s.io.v1alpha2.ResourceClaimTemplate.after_roundtrip.yaml b/staging/src/k8s.io/api/testdata/v1.29.0/resource.k8s.io.v1alpha2.ResourceClaimTemplate.after_roundtrip.yaml new file mode 100644 index 0000000000000..855e06411e472 --- /dev/null +++ b/staging/src/k8s.io/api/testdata/v1.29.0/resource.k8s.io.v1alpha2.ResourceClaimTemplate.after_roundtrip.yaml @@ -0,0 +1,73 @@ +apiVersion: resource.k8s.io/v1alpha2 +kind: ResourceClaimTemplate +metadata: + annotations: + annotationsKey: annotationsValue + creationTimestamp: "2008-01-01T01:01:01Z" + deletionGracePeriodSeconds: 10 + deletionTimestamp: "2009-01-01T01:01:01Z" + finalizers: + - finalizersValue + generateName: generateNameValue + generation: 7 + labels: + labelsKey: labelsValue + managedFields: + - apiVersion: apiVersionValue + fieldsType: fieldsTypeValue + fieldsV1: {} + manager: managerValue + operation: operationValue + subresource: subresourceValue + time: "2004-01-01T01:01:01Z" + name: nameValue + namespace: namespaceValue + ownerReferences: + - apiVersion: apiVersionValue + blockOwnerDeletion: true + controller: true + kind: kindValue + name: nameValue + uid: uidValue + resourceVersion: resourceVersionValue + selfLink: selfLinkValue + uid: uidValue +spec: + metadata: + annotations: + annotationsKey: annotationsValue + creationTimestamp: "2008-01-01T01:01:01Z" + deletionGracePeriodSeconds: 10 + deletionTimestamp: "2009-01-01T01:01:01Z" + finalizers: + - finalizersValue + generateName: generateNameValue + generation: 7 + labels: + labelsKey: labelsValue + managedFields: + - apiVersion: apiVersionValue + fieldsType: fieldsTypeValue + fieldsV1: {} + manager: managerValue + operation: operationValue + subresource: subresourceValue + time: "2004-01-01T01:01:01Z" + name: nameValue + namespace: namespaceValue + ownerReferences: + - apiVersion: apiVersionValue + blockOwnerDeletion: true + controller: true + kind: kindValue + name: nameValue + uid: uidValue + resourceVersion: resourceVersionValue + selfLink: selfLinkValue + uid: uidValue + spec: + parametersRef: + apiGroup: apiGroupValue + kind: kindValue + name: nameValue + resourceClassName: resourceClassNameValue diff --git a/staging/src/k8s.io/api/testdata/v1.30.0/resource.k8s.io.v1alpha2.ResourceClaim.after_roundtrip.json b/staging/src/k8s.io/api/testdata/v1.30.0/resource.k8s.io.v1alpha2.ResourceClaim.after_roundtrip.json new file mode 100644 index 0000000000000..811ee6ee80c9b --- /dev/null +++ b/staging/src/k8s.io/api/testdata/v1.30.0/resource.k8s.io.v1alpha2.ResourceClaim.after_roundtrip.json @@ -0,0 +1,139 @@ +{ + "kind": "ResourceClaim", + "apiVersion": "resource.k8s.io/v1alpha2", + "metadata": { + "name": "nameValue", + "generateName": "generateNameValue", + "namespace": "namespaceValue", + "selfLink": "selfLinkValue", + "uid": "uidValue", + "resourceVersion": "resourceVersionValue", + "generation": 7, + "creationTimestamp": "2008-01-01T01:01:01Z", + "deletionTimestamp": "2009-01-01T01:01:01Z", + "deletionGracePeriodSeconds": 10, + "labels": { + "labelsKey": "labelsValue" + }, + "annotations": { + "annotationsKey": "annotationsValue" + }, + "ownerReferences": [ + { + "apiVersion": "apiVersionValue", + "kind": "kindValue", + "name": "nameValue", + "uid": "uidValue", + "controller": true, + "blockOwnerDeletion": true + } + ], + "finalizers": [ + "finalizersValue" + ], + "managedFields": [ + { + "manager": "managerValue", + "operation": "operationValue", + "apiVersion": "apiVersionValue", + "time": "2004-01-01T01:01:01Z", + "fieldsType": "fieldsTypeValue", + "fieldsV1": {}, + "subresource": "subresourceValue" + } + ] + }, + "spec": { + "resourceClassName": "resourceClassNameValue", + "parametersRef": { + "apiGroup": "apiGroupValue", + "kind": "kindValue", + "name": "nameValue" + } + }, + "status": { + "driverName": "driverNameValue", + "allocation": { + "resourceHandles": [ + { + "driverName": "driverNameValue", + "data": "dataValue", + "structuredData": { + "vendorClassParameters": { + "apiVersion": "example.com/v1", + "kind": "CustomType", + "spec": { + "replicas": 1 + }, + "status": { + "available": 1 + } + }, + "vendorClaimParameters": { + "apiVersion": "example.com/v1", + "kind": "CustomType", + "spec": { + "replicas": 1 + }, + "status": { + "available": 1 + } + }, + "nodeName": "nodeNameValue", + "results": [ + { + "vendorRequestParameters": { + "apiVersion": "example.com/v1", + "kind": "CustomType", + "spec": { + "replicas": 1 + }, + "status": { + "available": 1 + } + }, + "namedResources": { + "name": "nameValue" + } + } + ] + } + } + ], + "availableOnNodes": { + "nodeSelectorTerms": [ + { + "matchExpressions": [ + { + "key": "keyValue", + "operator": "operatorValue", + "values": [ + "valuesValue" + ] + } + ], + "matchFields": [ + { + "key": "keyValue", + "operator": "operatorValue", + "values": [ + "valuesValue" + ] + } + ] + } + ] + }, + "shareable": true + }, + "reservedFor": [ + { + "apiGroup": "apiGroupValue", + "resource": "resourceValue", + "name": "nameValue", + "uid": "uidValue" + } + ], + "deallocationRequested": true + } +} \ No newline at end of file diff --git a/staging/src/k8s.io/api/testdata/v1.30.0/resource.k8s.io.v1alpha2.ResourceClaim.after_roundtrip.pb b/staging/src/k8s.io/api/testdata/v1.30.0/resource.k8s.io.v1alpha2.ResourceClaim.after_roundtrip.pb new file mode 100644 index 0000000000000000000000000000000000000000..9bb22e33b60428b528e440ce270f6eabe8da9f01 GIT binary patch literal 1010 zcmcgr&x+GP7*D!|ZNHkf8$?P@GN53Q>Q;o(i?DkTRAgCX58fupx9gb6OqfZEwe$tN z`v9JO1bu>qz4!#;!LvSrP9~-)s|Qbe`{wuk|9!tnX4-)}FjA;xp(30lGd*GQ-eRBf z>=m8*-tiyLA*U?$KkvfV7IXzo@r3dM{k=03sA!JQYbfZKUY*gX3L&0Ge)^1w#Ab{; z1&ggUyDohQcn_~YDINAPk4T~0&f`YA5`US-;hkU*ab zA#<9WBGx_JdfS-S522edQ8f;l`N?LQ@qlJ*dyxC?%vFO^CMaib&49MfJ2!-DDHZe# zl?D91%*y@i@q^1{h}q%W#jl;AGd0DK$NI%GtC*R$p|x5c40RE1n6RWif*UnpXxDnf zt$zzVGv;F@i>zw@&#i*@Z5YIgEl@S7=R5GT^*7v&X-;je@s}3F5Uxl=1ep_jL(`1o zB$BC71-VN~8V!C}=v=1dE(X&XMr6Js3Ny|ks>ytRZBTQO!q}$bf--Y4j-_MmUr86@ z2^lxC92Zx#oCm$_4{{7ga2q-aE~|rim0n~epP;uWFJ6hu|IfIQ8$7tAgTSi=W4n+> N;mv=$=>`sQegm;BSaJXW literal 0 HcmV?d00001 diff --git a/staging/src/k8s.io/api/testdata/v1.30.0/resource.k8s.io.v1alpha2.ResourceClaim.after_roundtrip.yaml b/staging/src/k8s.io/api/testdata/v1.30.0/resource.k8s.io.v1alpha2.ResourceClaim.after_roundtrip.yaml new file mode 100644 index 0000000000000..d3e59e6a65b13 --- /dev/null +++ b/staging/src/k8s.io/api/testdata/v1.30.0/resource.k8s.io.v1alpha2.ResourceClaim.after_roundtrip.yaml @@ -0,0 +1,91 @@ +apiVersion: resource.k8s.io/v1alpha2 +kind: ResourceClaim +metadata: + annotations: + annotationsKey: annotationsValue + creationTimestamp: "2008-01-01T01:01:01Z" + deletionGracePeriodSeconds: 10 + deletionTimestamp: "2009-01-01T01:01:01Z" + finalizers: + - finalizersValue + generateName: generateNameValue + generation: 7 + labels: + labelsKey: labelsValue + managedFields: + - apiVersion: apiVersionValue + fieldsType: fieldsTypeValue + fieldsV1: {} + manager: managerValue + operation: operationValue + subresource: subresourceValue + time: "2004-01-01T01:01:01Z" + name: nameValue + namespace: namespaceValue + ownerReferences: + - apiVersion: apiVersionValue + blockOwnerDeletion: true + controller: true + kind: kindValue + name: nameValue + uid: uidValue + resourceVersion: resourceVersionValue + selfLink: selfLinkValue + uid: uidValue +spec: + parametersRef: + apiGroup: apiGroupValue + kind: kindValue + name: nameValue + resourceClassName: resourceClassNameValue +status: + allocation: + availableOnNodes: + nodeSelectorTerms: + - matchExpressions: + - key: keyValue + operator: operatorValue + values: + - valuesValue + matchFields: + - key: keyValue + operator: operatorValue + values: + - valuesValue + resourceHandles: + - data: dataValue + driverName: driverNameValue + structuredData: + nodeName: nodeNameValue + results: + - namedResources: + name: nameValue + vendorRequestParameters: + apiVersion: example.com/v1 + kind: CustomType + spec: + replicas: 1 + status: + available: 1 + vendorClaimParameters: + apiVersion: example.com/v1 + kind: CustomType + spec: + replicas: 1 + status: + available: 1 + vendorClassParameters: + apiVersion: example.com/v1 + kind: CustomType + spec: + replicas: 1 + status: + available: 1 + shareable: true + deallocationRequested: true + driverName: driverNameValue + reservedFor: + - apiGroup: apiGroupValue + name: nameValue + resource: resourceValue + uid: uidValue diff --git a/staging/src/k8s.io/api/testdata/v1.30.0/resource.k8s.io.v1alpha2.ResourceClaimTemplate.after_roundtrip.json b/staging/src/k8s.io/api/testdata/v1.30.0/resource.k8s.io.v1alpha2.ResourceClaimTemplate.after_roundtrip.json new file mode 100644 index 0000000000000..060fa386e95e4 --- /dev/null +++ b/staging/src/k8s.io/api/testdata/v1.30.0/resource.k8s.io.v1alpha2.ResourceClaimTemplate.after_roundtrip.json @@ -0,0 +1,98 @@ +{ + "kind": "ResourceClaimTemplate", + "apiVersion": "resource.k8s.io/v1alpha2", + "metadata": { + "name": "nameValue", + "generateName": "generateNameValue", + "namespace": "namespaceValue", + "selfLink": "selfLinkValue", + "uid": "uidValue", + "resourceVersion": "resourceVersionValue", + "generation": 7, + "creationTimestamp": "2008-01-01T01:01:01Z", + "deletionTimestamp": "2009-01-01T01:01:01Z", + "deletionGracePeriodSeconds": 10, + "labels": { + "labelsKey": "labelsValue" + }, + "annotations": { + "annotationsKey": "annotationsValue" + }, + "ownerReferences": [ + { + "apiVersion": "apiVersionValue", + "kind": "kindValue", + "name": "nameValue", + "uid": "uidValue", + "controller": true, + "blockOwnerDeletion": true + } + ], + "finalizers": [ + "finalizersValue" + ], + "managedFields": [ + { + "manager": "managerValue", + "operation": "operationValue", + "apiVersion": "apiVersionValue", + "time": "2004-01-01T01:01:01Z", + "fieldsType": "fieldsTypeValue", + "fieldsV1": {}, + "subresource": "subresourceValue" + } + ] + }, + "spec": { + "metadata": { + "name": "nameValue", + "generateName": "generateNameValue", + "namespace": "namespaceValue", + "selfLink": "selfLinkValue", + "uid": "uidValue", + "resourceVersion": "resourceVersionValue", + "generation": 7, + "creationTimestamp": "2008-01-01T01:01:01Z", + "deletionTimestamp": "2009-01-01T01:01:01Z", + "deletionGracePeriodSeconds": 10, + "labels": { + "labelsKey": "labelsValue" + }, + "annotations": { + "annotationsKey": "annotationsValue" + }, + "ownerReferences": [ + { + "apiVersion": "apiVersionValue", + "kind": "kindValue", + "name": "nameValue", + "uid": "uidValue", + "controller": true, + "blockOwnerDeletion": true + } + ], + "finalizers": [ + "finalizersValue" + ], + "managedFields": [ + { + "manager": "managerValue", + "operation": "operationValue", + "apiVersion": "apiVersionValue", + "time": "2004-01-01T01:01:01Z", + "fieldsType": "fieldsTypeValue", + "fieldsV1": {}, + "subresource": "subresourceValue" + } + ] + }, + "spec": { + "resourceClassName": "resourceClassNameValue", + "parametersRef": { + "apiGroup": "apiGroupValue", + "kind": "kindValue", + "name": "nameValue" + } + } + } +} \ No newline at end of file diff --git a/staging/src/k8s.io/api/testdata/v1.30.0/resource.k8s.io.v1alpha2.ResourceClaimTemplate.after_roundtrip.pb b/staging/src/k8s.io/api/testdata/v1.30.0/resource.k8s.io.v1alpha2.ResourceClaimTemplate.after_roundtrip.pb new file mode 100644 index 0000000000000000000000000000000000000000..d8e02713279d6541bd285b1099307ee6b95cc0cf GIT binary patch literal 840 zcmd0{C}!X?0_wwkX!i%-1h7Ow1|BNHh`>4T8!z=Okw4hNR{ed*oC2}}xS}MuICBz{Qge#E zQ!9nIAxyB2Bqc7s#Js%xlEf0AAz*0%BtBS8mMIr!c4i*LVkw0CmEf+?;!iBdM0SV) zqXlCTe_CcE z0veW@lTsW~SpW$cD;6%M>RKm(;?g8|NPq)%3G-+u(>|2#xx`?>4ou|5#qbm?q{_t$ UObqTt`K1MrNXD9Wq!^SK0Om?2Jpcdz literal 0 HcmV?d00001 diff --git a/staging/src/k8s.io/api/testdata/v1.30.0/resource.k8s.io.v1alpha2.ResourceClaimTemplate.after_roundtrip.yaml b/staging/src/k8s.io/api/testdata/v1.30.0/resource.k8s.io.v1alpha2.ResourceClaimTemplate.after_roundtrip.yaml new file mode 100644 index 0000000000000..855e06411e472 --- /dev/null +++ b/staging/src/k8s.io/api/testdata/v1.30.0/resource.k8s.io.v1alpha2.ResourceClaimTemplate.after_roundtrip.yaml @@ -0,0 +1,73 @@ +apiVersion: resource.k8s.io/v1alpha2 +kind: ResourceClaimTemplate +metadata: + annotations: + annotationsKey: annotationsValue + creationTimestamp: "2008-01-01T01:01:01Z" + deletionGracePeriodSeconds: 10 + deletionTimestamp: "2009-01-01T01:01:01Z" + finalizers: + - finalizersValue + generateName: generateNameValue + generation: 7 + labels: + labelsKey: labelsValue + managedFields: + - apiVersion: apiVersionValue + fieldsType: fieldsTypeValue + fieldsV1: {} + manager: managerValue + operation: operationValue + subresource: subresourceValue + time: "2004-01-01T01:01:01Z" + name: nameValue + namespace: namespaceValue + ownerReferences: + - apiVersion: apiVersionValue + blockOwnerDeletion: true + controller: true + kind: kindValue + name: nameValue + uid: uidValue + resourceVersion: resourceVersionValue + selfLink: selfLinkValue + uid: uidValue +spec: + metadata: + annotations: + annotationsKey: annotationsValue + creationTimestamp: "2008-01-01T01:01:01Z" + deletionGracePeriodSeconds: 10 + deletionTimestamp: "2009-01-01T01:01:01Z" + finalizers: + - finalizersValue + generateName: generateNameValue + generation: 7 + labels: + labelsKey: labelsValue + managedFields: + - apiVersion: apiVersionValue + fieldsType: fieldsTypeValue + fieldsV1: {} + manager: managerValue + operation: operationValue + subresource: subresourceValue + time: "2004-01-01T01:01:01Z" + name: nameValue + namespace: namespaceValue + ownerReferences: + - apiVersion: apiVersionValue + blockOwnerDeletion: true + controller: true + kind: kindValue + name: nameValue + uid: uidValue + resourceVersion: resourceVersionValue + selfLink: selfLinkValue + uid: uidValue + spec: + parametersRef: + apiGroup: apiGroupValue + kind: kindValue + name: nameValue + resourceClassName: resourceClassNameValue diff --git a/staging/src/k8s.io/client-go/applyconfigurations/internal/internal.go b/staging/src/k8s.io/client-go/applyconfigurations/internal/internal.go index 0b04331415e72..27a4153f088ee 100644 --- a/staging/src/k8s.io/client-go/applyconfigurations/internal/internal.go +++ b/staging/src/k8s.io/client-go/applyconfigurations/internal/internal.go @@ -12392,9 +12392,6 @@ var schemaYAML = typed.YAMLObject(`types: - name: io.k8s.api.resource.v1alpha2.ResourceClaimSpec map: fields: - - name: allocationMode - type: - scalar: string - name: parametersRef type: namedType: io.k8s.api.resource.v1alpha2.ResourceClaimParametersReference diff --git a/staging/src/k8s.io/client-go/applyconfigurations/resource/v1alpha2/resourceclaimspec.go b/staging/src/k8s.io/client-go/applyconfigurations/resource/v1alpha2/resourceclaimspec.go index 2ecd95ec82d0d..4c34e672ed7c7 100644 --- a/staging/src/k8s.io/client-go/applyconfigurations/resource/v1alpha2/resourceclaimspec.go +++ b/staging/src/k8s.io/client-go/applyconfigurations/resource/v1alpha2/resourceclaimspec.go @@ -18,16 +18,11 @@ limitations under the License. package v1alpha2 -import ( - resourcev1alpha2 "k8s.io/api/resource/v1alpha2" -) - // ResourceClaimSpecApplyConfiguration represents a declarative configuration of the ResourceClaimSpec type for use // with apply. type ResourceClaimSpecApplyConfiguration struct { ResourceClassName *string `json:"resourceClassName,omitempty"` ParametersRef *ResourceClaimParametersReferenceApplyConfiguration `json:"parametersRef,omitempty"` - AllocationMode *resourcev1alpha2.AllocationMode `json:"allocationMode,omitempty"` } // ResourceClaimSpecApplyConfiguration constructs a declarative configuration of the ResourceClaimSpec type for use with @@ -51,11 +46,3 @@ func (b *ResourceClaimSpecApplyConfiguration) WithParametersRef(value *ResourceC b.ParametersRef = value return b } - -// WithAllocationMode sets the AllocationMode 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 AllocationMode field is set to the value of the last call. -func (b *ResourceClaimSpecApplyConfiguration) WithAllocationMode(value resourcev1alpha2.AllocationMode) *ResourceClaimSpecApplyConfiguration { - b.AllocationMode = &value - return b -} diff --git a/staging/src/k8s.io/dynamic-resource-allocation/controller/controller.go b/staging/src/k8s.io/dynamic-resource-allocation/controller/controller.go index 473e613cfe679..05ea7875c1c3e 100644 --- a/staging/src/k8s.io/dynamic-resource-allocation/controller/controller.go +++ b/staging/src/k8s.io/dynamic-resource-allocation/controller/controller.go @@ -515,48 +515,7 @@ func (ctrl *controller) syncClaim(ctx context.Context, claim *resourcev1alpha2.R logger.V(5).Info("ResourceClaim is allocated") return nil } - if claim.Spec.AllocationMode != resourcev1alpha2.AllocationModeImmediate { - logger.V(5).Info("ResourceClaim waiting for first consumer") - return nil - } - - // We need the ResourceClass to determine whether we should allocate it. - class, err := ctrl.rcLister.Get(claim.Spec.ResourceClassName) - if err != nil { - return err - } - if class.DriverName != ctrl.name { - // Not ours *at the moment*. This can change, so requeue and - // check again. We could trigger a faster check when the - // ResourceClass changes, but that shouldn't occur much in - // practice and thus isn't worth the effort. - // - // We use exponential backoff because it is unlikely that - // the ResourceClass changes much. - logger.V(5).Info("ResourceClaim is handled by other driver", "driver", class.DriverName) - return errRequeue - } - - // Check parameters. Do not record event to Claim if its parameters are invalid, - // syncKey will record the error. - claimParameters, classParameters, err := ctrl.getParameters(ctx, claim, class, false) - if err != nil { - return err - } - - claimAllocations := claimAllocations{&ClaimAllocation{ - Claim: claim, - ClaimParameters: claimParameters, - Class: class, - ClassParameters: classParameters, - }} - - ctrl.allocateClaims(ctx, claimAllocations, "", nil) - - if claimAllocations[0].Error != nil { - return fmt.Errorf("allocate: %v", claimAllocations[0].Error) - } - + logger.V(5).Info("ResourceClaim waiting for first consumer") return nil } @@ -678,10 +637,6 @@ func (ctrl *controller) checkPodClaim(ctx context.Context, pod *v1.Pod, podClaim return nil, err } } - if claim.Spec.AllocationMode != resourcev1alpha2.AllocationModeWaitForFirstConsumer { - // Nothing to do for it as part of pod scheduling. - return nil, nil - } if claim.Status.Allocation != nil { // Already allocated, class and parameter are not needed and nothing // need to be done for the claim either. diff --git a/staging/src/k8s.io/dynamic-resource-allocation/controller/controller_test.go b/staging/src/k8s.io/dynamic-resource-allocation/controller/controller_test.go index 850a1e7e6ab46..a7bb6cc911d7b 100644 --- a/staging/src/k8s.io/dynamic-resource-allocation/controller/controller_test.go +++ b/staging/src/k8s.io/dynamic-resource-allocation/controller/controller_test.go @@ -53,8 +53,6 @@ func TestController(t *testing.T) { } claim := createClaim(claimName, claimNamespace, className) otherClaim := createClaim(claimName, claimNamespace, otherClassName) - delayedClaim := claim.DeepCopy() - delayedClaim.Spec.AllocationMode = resourcev1alpha2.AllocationModeWaitForFirstConsumer podName := "pod" podKey := "schedulingCtx:default/pod" pod := createPod(podName, claimNamespace, nil) @@ -148,94 +146,6 @@ func TestController(t *testing.T) { classes: classes, claim: otherClaim, expectedClaim: otherClaim, - expectedError: errRequeue.Error(), // class might change - }, - // Immediate allocation: - // deletion time stamp set, our finalizer set, not allocated -> remove finalizer - "immediate-deleted-finalizer-removal": { - key: claimKey, - classes: classes, - claim: withFinalizer(withDeletionTimestamp(claim), ourFinalizer), - driver: m.expectDeallocate(map[string]error{claimName: nil}), - expectedClaim: withDeletionTimestamp(claim), - }, - // deletion time stamp set, our finalizer set, not allocated, stopping fails -> requeue - "immediate-deleted-finalizer-stop-failure": { - key: claimKey, - classes: classes, - claim: withFinalizer(withDeletionTimestamp(claim), ourFinalizer), - driver: m.expectDeallocate(map[string]error{claimName: errors.New("fake error")}), - expectedClaim: withFinalizer(withDeletionTimestamp(claim), ourFinalizer), - expectedError: "stop allocation: fake error", - }, - // deletion time stamp set, other finalizer set, not allocated -> do nothing - "immediate-deleted-finalizer-no-removal": { - key: claimKey, - classes: classes, - claim: withFinalizer(withDeletionTimestamp(claim), otherFinalizer), - expectedClaim: withFinalizer(withDeletionTimestamp(claim), otherFinalizer), - }, - // deletion time stamp set, finalizer set, allocated -> deallocate - "immediate-deleted-allocated": { - key: claimKey, - classes: classes, - claim: withAllocate(withDeletionTimestamp(claim)), - driver: m.expectDeallocate(map[string]error{claimName: nil}), - expectedClaim: withDeletionTimestamp(claim), - }, - // deletion time stamp set, finalizer set, allocated, deallocation fails -> requeue - "immediate-deleted-deallocate-failure": { - key: claimKey, - classes: classes, - claim: withAllocate(withDeletionTimestamp(claim)), - driver: m.expectDeallocate(map[string]error{claimName: errors.New("fake error")}), - expectedClaim: withAllocate(withDeletionTimestamp(claim)), - expectedError: "deallocate: fake error", - }, - // deletion time stamp set, finalizer not set -> do nothing - "immediate-deleted-no-finalizer": { - key: claimKey, - classes: classes, - claim: withDeletionTimestamp(claim), - expectedClaim: withDeletionTimestamp(claim), - }, - // not deleted, not allocated, no finalizer -> add finalizer, allocate - "immediate-do-allocation": { - key: claimKey, - classes: classes, - claim: claim, - driver: m.expectClassParameters(map[string]interface{}{className: 1}). - expectClaimParameters(map[string]interface{}{claimName: 2}). - expectAllocate(map[string]allocate{claimName: {allocResult: &allocation, allocErr: nil}}), - expectedClaim: withAllocate(claim), - }, - // not deleted, not allocated, finalizer -> allocate - "immediate-continue-allocation": { - key: claimKey, - classes: classes, - claim: withFinalizer(claim, ourFinalizer), - driver: m.expectClassParameters(map[string]interface{}{className: 1}). - expectClaimParameters(map[string]interface{}{claimName: 2}). - expectAllocate(map[string]allocate{claimName: {allocResult: &allocation, allocErr: nil}}), - expectedClaim: withAllocate(claim), - }, - // not deleted, not allocated, finalizer, fail allocation -> requeue - "immediate-fail-allocation": { - key: claimKey, - classes: classes, - claim: withFinalizer(claim, ourFinalizer), - driver: m.expectClassParameters(map[string]interface{}{className: 1}). - expectClaimParameters(map[string]interface{}{claimName: 2}). - expectAllocate(map[string]allocate{claimName: {allocErr: errors.New("fake error")}}), - expectedClaim: withFinalizer(claim, ourFinalizer), - expectedError: "allocate: fake error", - }, - // not deleted, allocated -> do nothing - "immediate-allocated-nop": { - key: claimKey, - classes: classes, - claim: withAllocate(claim), - expectedClaim: withAllocate(claim), }, // not deleted, reallocate -> deallocate @@ -257,62 +167,60 @@ func TestController(t *testing.T) { expectedError: "deallocate: fake error", }, - // Delayed allocation is similar in some cases, but not quite - // the same. // deletion time stamp set, our finalizer set, not allocated -> remove finalizer - "delayed-deleted-finalizer-removal": { + "deleted-finalizer-removal": { key: claimKey, classes: classes, - claim: withFinalizer(withDeletionTimestamp(delayedClaim), ourFinalizer), + claim: withFinalizer(withDeletionTimestamp(claim), ourFinalizer), driver: m.expectDeallocate(map[string]error{claimName: nil}), - expectedClaim: withDeletionTimestamp(delayedClaim), + expectedClaim: withDeletionTimestamp(claim), }, // deletion time stamp set, our finalizer set, not allocated, stopping fails -> requeue - "delayed-deleted-finalizer-stop-failure": { + "deleted-finalizer-stop-failure": { key: claimKey, classes: classes, - claim: withFinalizer(withDeletionTimestamp(delayedClaim), ourFinalizer), + claim: withFinalizer(withDeletionTimestamp(claim), ourFinalizer), driver: m.expectDeallocate(map[string]error{claimName: errors.New("fake error")}), - expectedClaim: withFinalizer(withDeletionTimestamp(delayedClaim), ourFinalizer), + expectedClaim: withFinalizer(withDeletionTimestamp(claim), ourFinalizer), expectedError: "stop allocation: fake error", }, // deletion time stamp set, other finalizer set, not allocated -> do nothing - "delayed-deleted-finalizer-no-removal": { + "deleted-finalizer-no-removal": { key: claimKey, classes: classes, - claim: withFinalizer(withDeletionTimestamp(delayedClaim), otherFinalizer), - expectedClaim: withFinalizer(withDeletionTimestamp(delayedClaim), otherFinalizer), + claim: withFinalizer(withDeletionTimestamp(claim), otherFinalizer), + expectedClaim: withFinalizer(withDeletionTimestamp(claim), otherFinalizer), }, // deletion time stamp set, finalizer set, allocated -> deallocate - "delayed-deleted-allocated": { + "deleted-allocated": { key: claimKey, classes: classes, - claim: withAllocate(withDeletionTimestamp(delayedClaim)), + claim: withAllocate(withDeletionTimestamp(claim)), driver: m.expectDeallocate(map[string]error{claimName: nil}), - expectedClaim: withDeletionTimestamp(delayedClaim), + expectedClaim: withDeletionTimestamp(claim), }, // deletion time stamp set, finalizer set, allocated, deallocation fails -> requeue - "delayed-deleted-deallocate-failure": { + "deleted-deallocate-failure": { key: claimKey, classes: classes, - claim: withAllocate(withDeletionTimestamp(delayedClaim)), + claim: withAllocate(withDeletionTimestamp(claim)), driver: m.expectDeallocate(map[string]error{claimName: errors.New("fake error")}), - expectedClaim: withAllocate(withDeletionTimestamp(delayedClaim)), + expectedClaim: withAllocate(withDeletionTimestamp(claim)), expectedError: "deallocate: fake error", }, // deletion time stamp set, finalizer not set -> do nothing - "delayed-deleted-no-finalizer": { + "deleted-no-finalizer": { key: claimKey, classes: classes, - claim: withDeletionTimestamp(delayedClaim), - expectedClaim: withDeletionTimestamp(delayedClaim), + claim: withDeletionTimestamp(claim), + expectedClaim: withDeletionTimestamp(claim), }, // waiting for first consumer -> do nothing - "delayed-pending": { + "pending": { key: claimKey, classes: classes, - claim: delayedClaim, - expectedClaim: delayedClaim, + claim: claim, + expectedClaim: claim, }, // pod with no claims -> shouldn't occur, check again anyway @@ -324,34 +232,23 @@ func TestController(t *testing.T) { expectedError: errPeriodic.Error(), }, - // pod with immediate allocation and selected node -> shouldn't occur, check again in case that claim changes - "pod-immediate": { + // no potential nodes -> shouldn't occur + "no-nodes": { key: podKey, + classes: classes, claim: claim, expectedClaim: claim, pod: podWithClaim, - schedulingCtx: withSelectedNode(podSchedulingCtx), - expectedSchedulingCtx: withSelectedNode(podSchedulingCtx), - expectedError: errPeriodic.Error(), - }, - - // pod with delayed allocation, no potential nodes -> shouldn't occur - "pod-delayed-no-nodes": { - key: podKey, - classes: classes, - claim: delayedClaim, - expectedClaim: delayedClaim, - pod: podWithClaim, schedulingCtx: podSchedulingCtx, expectedSchedulingCtx: podSchedulingCtx, }, - // pod with delayed allocation, potential nodes -> provide unsuitable nodes - "pod-delayed-info": { + // potential nodes -> provide unsuitable nodes + "info": { key: podKey, classes: classes, - claim: delayedClaim, - expectedClaim: delayedClaim, + claim: claim, + expectedClaim: claim, pod: podWithClaim, schedulingCtx: withPotentialNodes(podSchedulingCtx), driver: m.expectClassParameters(map[string]interface{}{className: 1}). @@ -361,23 +258,23 @@ func TestController(t *testing.T) { expectedError: errPeriodic.Error(), }, - // pod with delayed allocation, potential nodes, selected node, missing class -> failure - "pod-delayed-missing-class": { + // potential nodes, selected node, missing class -> failure + "missing-class": { key: podKey, - claim: delayedClaim, - expectedClaim: delayedClaim, + claim: claim, + expectedClaim: claim, pod: podWithClaim, schedulingCtx: withSelectedNode(withPotentialNodes(podSchedulingCtx)), expectedSchedulingCtx: withSelectedNode(withPotentialNodes(podSchedulingCtx)), expectedError: `pod claim my-pod-claim: resourceclass.resource.k8s.io "mock-class" not found`, }, - // pod with delayed allocation, potential nodes, selected node -> allocate - "pod-delayed-allocate": { + // potential nodes, selected node -> allocate + "allocate": { key: podKey, classes: classes, - claim: delayedClaim, - expectedClaim: withReservedFor(withAllocate(delayedClaim), pod), + claim: claim, + expectedClaim: withReservedFor(withAllocate(claim), pod), pod: podWithClaim, schedulingCtx: withSelectedNode(withPotentialNodes(podSchedulingCtx)), driver: m.expectClassParameters(map[string]interface{}{className: 1}). @@ -387,12 +284,12 @@ func TestController(t *testing.T) { expectedSchedulingCtx: withUnsuitableNodes(withSelectedNode(withPotentialNodes(podSchedulingCtx))), expectedError: errPeriodic.Error(), }, - // pod with delayed allocation, potential nodes, selected node, all unsuitable -> update unsuitable nodes - "pod-selected-is-potential-node": { + // potential nodes, selected node, all unsuitable -> update unsuitable nodes + "is-potential-node": { key: podKey, classes: classes, - claim: delayedClaim, - expectedClaim: delayedClaim, + claim: claim, + expectedClaim: claim, pod: podWithClaim, schedulingCtx: withPotentialNodes(withSelectedNode(withPotentialNodes(podSchedulingCtx))), driver: m.expectClassParameters(map[string]interface{}{className: 1}). @@ -401,12 +298,12 @@ func TestController(t *testing.T) { expectedSchedulingCtx: withSpecificUnsuitableNodes(withSelectedNode(withPotentialNodes(podSchedulingCtx)), potentialNodes), expectedError: errPeriodic.Error(), }, - // pod with delayed allocation, max potential nodes, other selected node, all unsuitable -> update unsuitable nodes with truncation at start - "pod-selected-is-potential-node-truncate-first": { + // max potential nodes, other selected node, all unsuitable -> update unsuitable nodes with truncation at start + "is-potential-node-truncate-first": { key: podKey, classes: classes, - claim: delayedClaim, - expectedClaim: delayedClaim, + claim: claim, + expectedClaim: claim, pod: podWithClaim, schedulingCtx: withSpecificPotentialNodes(withSelectedNode(withSpecificPotentialNodes(podSchedulingCtx, maxNodes)), maxNodes), driver: m.expectClassParameters(map[string]interface{}{className: 1}). @@ -415,12 +312,12 @@ func TestController(t *testing.T) { expectedSchedulingCtx: withSpecificUnsuitableNodes(withSelectedNode(withSpecificPotentialNodes(podSchedulingCtx, maxNodes)), append(maxNodes[1:], nodeName)), expectedError: errPeriodic.Error(), }, - // pod with delayed allocation, max potential nodes, other selected node, all unsuitable (but in reverse order) -> update unsuitable nodes with truncation at end + // max potential nodes, other selected node, all unsuitable (but in reverse order) -> update unsuitable nodes with truncation at end "pod-selected-is-potential-node-truncate-last": { key: podKey, classes: classes, - claim: delayedClaim, - expectedClaim: delayedClaim, + claim: claim, + expectedClaim: claim, pod: podWithClaim, schedulingCtx: withSpecificPotentialNodes(withSelectedNode(withSpecificPotentialNodes(podSchedulingCtx, maxNodes)), maxNodes), driver: m.expectClassParameters(map[string]interface{}{className: 1}). @@ -652,7 +549,6 @@ func createClaim(claimName, claimNamespace, className string) *resourcev1alpha2. }, Spec: resourcev1alpha2.ResourceClaimSpec{ ResourceClassName: className, - AllocationMode: resourcev1alpha2.AllocationModeImmediate, }, } } diff --git a/test/e2e/dra/dra.go b/test/e2e/dra/dra.go index 1c507699636b1..d9c0dd088de3d 100644 --- a/test/e2e/dra/dra.go +++ b/test/e2e/dra/dra.go @@ -27,7 +27,6 @@ import ( "github.com/onsi/ginkgo/v2" "github.com/onsi/gomega" - "github.com/onsi/gomega/gcustom" "github.com/onsi/gomega/gstruct" v1 "k8s.io/api/core/v1" @@ -99,7 +98,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, ginkgo.By("waiting for container startup to fail") parameters := b.parameters() - pod, template := b.podInline(resourcev1alpha2.AllocationModeWaitForFirstConsumer) + pod, template := b.podInline() b.create(ctx, parameters, pod, template) @@ -125,7 +124,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, // Pretend that the resource is allocated and reserved for some other entity. // Until the resourceclaim controller learns to remove reservations for // arbitrary types we can simply fake somthing here. - claim := b.externalClaim(resourcev1alpha2.AllocationModeWaitForFirstConsumer) + claim := b.externalClaim() b.create(ctx, claim) claim, err := f.ClientSet.ResourceV1alpha2().ResourceClaims(f.Namespace.Name).Get(ctx, claim.Name, metav1.GetOptions{}) @@ -179,7 +178,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, ginkgo.It("must unprepare resources for force-deleted pod", func(ctx context.Context) { parameters := b.parameters() - claim := b.externalClaim(resourcev1alpha2.AllocationModeImmediate) + claim := b.externalClaim() pod := b.podExternal() zero := int64(0) pod.Spec.TerminationGracePeriodSeconds = &zero @@ -202,7 +201,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, ginkgo.It("must skip NodePrepareResource if not used by any container", func(ctx context.Context) { parameters := b.parameters() - pod, template := b.podInline(resourcev1alpha2.AllocationModeWaitForFirstConsumer) + pod, template := b.podInline() for i := range pod.Spec.Containers { pod.Spec.Containers[i].Resources.Claims = nil } @@ -218,10 +217,10 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, // claimTests tries out several different combinations of pods with // claims, both inline and external. - claimTests := func(b *builder, driver *Driver, allocationMode resourcev1alpha2.AllocationMode) { + claimTests := func(b *builder, driver *Driver) { ginkgo.It("supports simple pod referencing inline resource claim", func(ctx context.Context) { objects, expectedEnv := b.flexibleParameters() - pod, template := b.podInline(allocationMode) + pod, template := b.podInline() objects = append(objects, pod, template) b.create(ctx, objects...) @@ -230,7 +229,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, ginkgo.It("supports inline claim referenced by multiple containers", func(ctx context.Context) { objects, expectedEnv := b.flexibleParameters() - pod, template := b.podInlineMultiple(allocationMode) + pod, template := b.podInlineMultiple() objects = append(objects, pod, template) b.create(ctx, objects...) @@ -240,7 +239,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, ginkgo.It("supports simple pod referencing external resource claim", func(ctx context.Context) { objects, expectedEnv := b.flexibleParameters() pod := b.podExternal() - claim := b.externalClaim(allocationMode) + claim := b.externalClaim() objects = append(objects, claim, pod) b.create(ctx, objects...) @@ -252,7 +251,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, pod1 := b.podExternal() pod2 := b.podExternal() pod3 := b.podExternal() - claim := b.externalClaim(allocationMode) + claim := b.externalClaim() objects = append(objects, claim, pod1, pod2, pod3) b.create(ctx, objects...) @@ -266,7 +265,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, pod1 := b.podExternalMultiple() pod2 := b.podExternalMultiple() pod3 := b.podExternalMultiple() - claim := b.externalClaim(allocationMode) + claim := b.externalClaim() objects = append(objects, claim, pod1, pod2, pod3) b.create(ctx, objects...) @@ -277,7 +276,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, ginkgo.It("supports init containers", func(ctx context.Context) { objects, expectedEnv := b.flexibleParameters() - pod, template := b.podInline(allocationMode) + pod, template := b.podInline() pod.Spec.InitContainers = []v1.Container{pod.Spec.Containers[0]} pod.Spec.InitContainers[0].Name += "-init" // This must succeed for the pod to start. @@ -291,7 +290,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, ginkgo.It("removes reservation from claim when pod is done", func(ctx context.Context) { objects, _ := b.flexibleParameters() pod := b.podExternal() - claim := b.externalClaim(allocationMode) + claim := b.externalClaim() pod.Spec.Containers[0].Command = []string{"true"} objects = append(objects, claim, pod) b.create(ctx, objects...) @@ -306,7 +305,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, ginkgo.It("deletes generated claims when pod is done", func(ctx context.Context) { objects, _ := b.flexibleParameters() - pod, template := b.podInline(allocationMode) + pod, template := b.podInline() pod.Spec.Containers[0].Command = []string{"true"} objects = append(objects, template, pod) b.create(ctx, objects...) @@ -325,7 +324,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, ginkgo.It("does not delete generated claims when pod is restarting", func(ctx context.Context) { objects, _ := b.flexibleParameters() - pod, template := b.podInline(allocationMode) + pod, template := b.podInline() pod.Spec.Containers[0].Command = []string{"sh", "-c", "sleep 1; exit 1"} pod.Spec.RestartPolicy = v1.RestartPolicyAlways objects = append(objects, template, pod) @@ -340,10 +339,10 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, } }) - ginkgo.It("must deallocate after use when using delayed allocation", func(ctx context.Context) { + ginkgo.It("must deallocate after use", func(ctx context.Context) { objects, expectedEnv := b.flexibleParameters() pod := b.podExternal() - claim := b.externalClaim(resourcev1alpha2.AllocationModeWaitForFirstConsumer) + claim := b.externalClaim() objects = append(objects, claim, pod) b.create(ctx, objects...) @@ -382,7 +381,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, ginkgo.It("supports claim and class parameters", func(ctx context.Context) { objects, expectedEnv := b.flexibleParameters() - pod, template := b.podInline(resourcev1alpha2.AllocationModeWaitForFirstConsumer) + pod, template := b.podInline() objects = append(objects, pod, template) b.create(ctx, objects...) @@ -394,7 +393,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, objects, expectedEnv := b.flexibleParameters() pods := make([]*v1.Pod, numPods) for i := 0; i < numPods; i++ { - pod, template := b.podInline(resourcev1alpha2.AllocationModeWaitForFirstConsumer) + pod, template := b.podInline() pods[i] = pod objects = append(objects, pod, template) } @@ -420,7 +419,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, ginkgo.It("supports sharing a claim concurrently", func(ctx context.Context) { objects, expectedEnv := b.flexibleParameters() - objects = append(objects, b.externalClaim(resourcev1alpha2.AllocationModeWaitForFirstConsumer)) + objects = append(objects, b.externalClaim()) pods := make([]*v1.Pod, numPods) for i := 0; i < numPods; i++ { @@ -458,7 +457,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, objects[len(objects)-1].(*resourcev1alpha2.ResourceClaimParameters).Shareable = false } - objects = append(objects, b.externalClaim(resourcev1alpha2.AllocationModeWaitForFirstConsumer)) + objects = append(objects, b.externalClaim()) pods := make([]*v1.Pod, numPods) for i := 0; i < numPods; i++ { @@ -490,7 +489,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, ginkgo.It("retries pod scheduling after creating resource class", func(ctx context.Context) { objects, expectedEnv := b.flexibleParameters() - pod, template := b.podInline(resourcev1alpha2.AllocationModeWaitForFirstConsumer) + pod, template := b.podInline() class, err := f.ClientSet.ResourceV1alpha2().ResourceClasses().Get(ctx, template.Spec.Spec.ResourceClassName, metav1.GetOptions{}) framework.ExpectNoError(err) template.Spec.Spec.ResourceClassName += "-b" @@ -509,7 +508,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, ginkgo.It("retries pod scheduling after updating resource class", func(ctx context.Context) { objects, expectedEnv := b.flexibleParameters() - pod, template := b.podInline(resourcev1alpha2.AllocationModeWaitForFirstConsumer) + pod, template := b.podInline() // First modify the class so that it matches no nodes. class, err := f.ClientSet.ResourceV1alpha2().ResourceClasses().Get(ctx, template.Spec.Spec.ResourceClassName, metav1.GetOptions{}) @@ -545,7 +544,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, }) ginkgo.It("runs a pod without a generated resource claim", func(ctx context.Context) { - pod, _ /* template */ := b.podInline(resourcev1alpha2.AllocationModeWaitForFirstConsumer) + pod, _ /* template */ := b.podInline() created := b.create(ctx, pod) pod = created[0].(*v1.Pod) @@ -562,13 +561,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, framework.ExpectNoError(e2epod.WaitForPodRunningInNamespace(ctx, f.ClientSet, pod)) }) - ginkgo.Context("with delayed allocation", func() { - claimTests(b, driver, resourcev1alpha2.AllocationModeWaitForFirstConsumer) - }) - - ginkgo.Context("with immediate allocation", func() { - claimTests(b, driver, resourcev1alpha2.AllocationModeImmediate) - }) + claimTests(b, driver) } // These tests depend on having more than one node and a DRA driver controller. @@ -602,7 +595,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, } pod1 := createPod() pod2 := createPod() - claim := b.externalClaim(resourcev1alpha2.AllocationModeWaitForFirstConsumer) + claim := b.externalClaim() b.create(ctx, parameters, claim, pod1, pod2) for _, pod := range []*v1.Pod{pod1, pod2} { @@ -623,7 +616,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, instance := f.UniqueName + "-test-app" pod := b.podExternal() pod.Labels[label] = instance - claim := b.externalClaim(resourcev1alpha2.AllocationModeWaitForFirstConsumer) + claim := b.externalClaim() b.create(ctx, parameters, claim, pod) ginkgo.By("wait for test pod " + pod.Name + " to run") @@ -713,13 +706,13 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, parameters1 := b.parameters() parameters2 := b2.parameters() // Order is relevant here: each pod must be matched with its own claim. - pod1claim1 := b.externalClaim(resourcev1alpha2.AllocationModeWaitForFirstConsumer) + pod1claim1 := b.externalClaim() pod1 := b.podExternal() - pod2claim1 := b2.externalClaim(resourcev1alpha2.AllocationModeWaitForFirstConsumer) + pod2claim1 := b2.externalClaim() pod2 := b2.podExternal() // Add another claim to pod1. - pod1claim2 := b2.externalClaim(resourcev1alpha2.AllocationModeWaitForFirstConsumer) + pod1claim2 := b2.externalClaim() pod1.Spec.ResourceClaims = append(pod1.Spec.ResourceClaims, v1.PodResourceClaim{ Name: "claim-other", @@ -800,51 +793,41 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, driver.parameterMode = parameterMode b := newBuilder(f, driver) - tests := func(allocationMode resourcev1alpha2.AllocationMode) { - ginkgo.It("uses all resources", func(ctx context.Context) { - objs, _ := b.flexibleParameters() - var pods []*v1.Pod - for i := 0; i < len(nodes.NodeNames); i++ { - pod, template := b.podInline(allocationMode) - pods = append(pods, pod) - objs = append(objs, pod, template) - } - b.create(ctx, objs...) + ginkgo.It("uses all resources", func(ctx context.Context) { + objs, _ := b.flexibleParameters() + var pods []*v1.Pod + for i := 0; i < len(nodes.NodeNames); i++ { + pod, template := b.podInline() + pods = append(pods, pod) + objs = append(objs, pod, template) + } + b.create(ctx, objs...) - for _, pod := range pods { - err := e2epod.WaitForPodRunningInNamespace(ctx, f.ClientSet, pod) - framework.ExpectNoError(err, "start pod") - } + for _, pod := range pods { + err := e2epod.WaitForPodRunningInNamespace(ctx, f.ClientSet, pod) + framework.ExpectNoError(err, "start pod") + } - // The pods all should run on different - // nodes because the maximum number of - // claims per node was limited to 1 for - // this test. - // - // We cannot know for sure why the pods - // ran on two different nodes (could - // also be a coincidence) but if they - // don't cover all nodes, then we have - // a problem. - used := make(map[string]*v1.Pod) - for _, pod := range pods { - pod, err := f.ClientSet.CoreV1().Pods(pod.Namespace).Get(ctx, pod.Name, metav1.GetOptions{}) - framework.ExpectNoError(err, "get pod") - nodeName := pod.Spec.NodeName - if other, ok := used[nodeName]; ok { - framework.Failf("Pod %s got started on the same node %s as pod %s although claim allocation should have been limited to one claim per node.", pod.Name, nodeName, other.Name) - } - used[nodeName] = pod + // The pods all should run on different + // nodes because the maximum number of + // claims per node was limited to 1 for + // this test. + // + // We cannot know for sure why the pods + // ran on two different nodes (could + // also be a coincidence) but if they + // don't cover all nodes, then we have + // a problem. + used := make(map[string]*v1.Pod) + for _, pod := range pods { + pod, err := f.ClientSet.CoreV1().Pods(pod.Namespace).Get(ctx, pod.Name, metav1.GetOptions{}) + framework.ExpectNoError(err, "get pod") + nodeName := pod.Spec.NodeName + if other, ok := used[nodeName]; ok { + framework.Failf("Pod %s got started on the same node %s as pod %s although claim allocation should have been limited to one claim per node.", pod.Name, nodeName, other.Name) } - }) - } - - ginkgo.Context("with delayed allocation", func() { - tests(resourcev1alpha2.AllocationModeWaitForFirstConsumer) - }) - - ginkgo.Context("with immediate allocation", func() { - tests(resourcev1alpha2.AllocationModeImmediate) + used[nodeName] = pod + } }) }) } @@ -872,7 +855,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, ginkgo.It("truncates the name of a generated resource claim", func(ctx context.Context) { parameters := b.parameters() - pod, template := b.podInline(resourcev1alpha2.AllocationModeWaitForFirstConsumer) + pod, template := b.podInline() pod.Name = strings.Repeat("p", 63) pod.Spec.ResourceClaims[0].Name = strings.Repeat("c", 63) pod.Spec.Containers[0].Resources.Claims[0].Name = pod.Spec.ResourceClaims[0].Name @@ -948,118 +931,16 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, // which is the goal for 1.31 to support version skew for kubelet. }) - ginkgo.Context("with local unshared resources", func() { - driver := NewDriver(f, nodes, func() app.Resources { - return app.Resources{ - NodeLocal: true, - MaxAllocations: 10, - Nodes: nodes.NodeNames, - } - }) - b := newBuilder(f, driver) - - // This test covers some special code paths in the scheduler: - // - Patching the ReservedFor during PreBind because in contrast - // to claims specifically allocated for a pod, here the claim - // gets allocated without reserving it. - // - Error handling when PreBind fails: multiple attempts to bind pods - // are started concurrently, only one attempt succeeds. - // - Removing a ReservedFor entry because the first inline claim gets - // reserved during allocation. - ginkgo.It("reuses an allocated immediate claim", func(ctx context.Context) { - objects := []klog.KMetadata{ - b.parameters(), - b.externalClaim(resourcev1alpha2.AllocationModeImmediate), - } - podExternal := b.podExternal() - - // Create many pods to increase the chance that the scheduler will - // try to bind two pods at the same time. - numPods := 5 - for i := 0; i < numPods; i++ { - podInline, claimTemplate := b.podInline(resourcev1alpha2.AllocationModeWaitForFirstConsumer) - podInline.Spec.Containers[0].Resources.Claims = append(podInline.Spec.Containers[0].Resources.Claims, podExternal.Spec.Containers[0].Resources.Claims[0]) - podInline.Spec.ResourceClaims = append(podInline.Spec.ResourceClaims, podExternal.Spec.ResourceClaims[0]) - objects = append(objects, claimTemplate, podInline) - } - b.create(ctx, objects...) - - var runningPod *v1.Pod - haveRunningPod := gcustom.MakeMatcher(func(pods []v1.Pod) (bool, error) { - numRunning := 0 - runningPod = nil - for _, pod := range pods { - if pod.Status.Phase == v1.PodRunning { - pod := pod // Don't keep pointer to loop variable... - runningPod = &pod - numRunning++ - } - } - return numRunning == 1, nil - }).WithTemplate("Expected one running Pod.\nGot instead:\n{{.FormattedActual}}") - - for i := 0; i < numPods; i++ { - ginkgo.By("waiting for exactly one pod to start") - runningPod = nil - gomega.Eventually(ctx, b.listTestPods).WithTimeout(f.Timeouts.PodStartSlow).Should(haveRunningPod) - - ginkgo.By("checking that no other pod gets scheduled") - havePendingPods := gcustom.MakeMatcher(func(pods []v1.Pod) (bool, error) { - numPending := 0 - for _, pod := range pods { - if pod.Status.Phase == v1.PodPending { - numPending++ - } - } - return numPending == numPods-1-i, nil - }).WithTemplate("Expected only one running Pod.\nGot instead:\n{{.FormattedActual}}") - gomega.Consistently(ctx, b.listTestPods).WithTimeout(time.Second).Should(havePendingPods) - - ginkgo.By(fmt.Sprintf("deleting pod %s", klog.KObj(runningPod))) - framework.ExpectNoError(b.f.ClientSet.CoreV1().Pods(b.f.Namespace.Name).Delete(ctx, runningPod.Name, metav1.DeleteOptions{})) - - ginkgo.By(fmt.Sprintf("waiting for pod %s to disappear", klog.KObj(runningPod))) - framework.ExpectNoError(e2epod.WaitForPodNotFoundInNamespace(ctx, b.f.ClientSet, runningPod.Name, runningPod.Namespace, f.Timeouts.PodDelete)) - } - }) - }) - - ginkgo.Context("with shared network resources", func() { - driver := NewDriver(f, nodes, networkResources) - b := newBuilder(f, driver) - - // This test complements "reuses an allocated immediate claim" above: - // because the claim can be shared, each PreBind attempt succeeds. - ginkgo.It("shares an allocated immediate claim", func(ctx context.Context) { - objects := []klog.KMetadata{ - b.parameters(), - b.externalClaim(resourcev1alpha2.AllocationModeImmediate), - } - // Create many pods to increase the chance that the scheduler will - // try to bind two pods at the same time. - numPods := 5 - pods := make([]*v1.Pod, numPods) - for i := 0; i < numPods; i++ { - pods[i] = b.podExternal() - objects = append(objects, pods[i]) - } - b.create(ctx, objects...) - - ginkgo.By("waiting all pods to start") - framework.ExpectNoError(e2epod.WaitForPodsRunning(ctx, b.f.ClientSet, f.Namespace.Name, numPods+len(nodes.NodeNames) /* driver(s) */, f.Timeouts.PodStartSlow)) - }) - }) - // kube-controller-manager can trigger delayed allocation for pods where the // node name was already selected when creating the pod. For immediate // allocation, the creator has to ensure that the node matches the claims. // This does not work for resource claim templates and only isn't // a problem here because the resource is network-attached and available // on all nodes. - preScheduledTests := func(b *builder, driver *Driver, allocationMode resourcev1alpha2.AllocationMode) { + preScheduledTests := func(b *builder, driver *Driver) { ginkgo.It("supports scheduled pod referencing inline resource claim", func(ctx context.Context) { parameters := b.parameters() - pod, template := b.podInline(allocationMode) + pod, template := b.podInline() pod.Spec.NodeName = nodes.NodeNames[0] b.create(ctx, parameters, pod, template) @@ -1068,7 +949,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, ginkgo.It("supports scheduled pod referencing external resource claim", func(ctx context.Context) { parameters := b.parameters() - claim := b.externalClaim(allocationMode) + claim := b.externalClaim() pod := b.podExternal() pod.Spec.NodeName = nodes.NodeNames[0] b.create(ctx, parameters, claim, pod) @@ -1077,29 +958,22 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, }) } - ginkgo.Context("with delayed allocation and setting ReservedFor", func() { + ginkgo.Context("with setting ReservedFor", func() { driver := NewDriver(f, nodes, networkResources) b := newBuilder(f, driver) - preScheduledTests(b, driver, resourcev1alpha2.AllocationModeWaitForFirstConsumer) - claimTests(b, driver, resourcev1alpha2.AllocationModeWaitForFirstConsumer) + preScheduledTests(b, driver) + claimTests(b, driver) }) - ginkgo.Context("with delayed allocation and not setting ReservedFor", func() { + ginkgo.Context("without setting ReservedFor", func() { driver := NewDriver(f, nodes, func() app.Resources { resources := networkResources() resources.DontSetReservedFor = true return resources }) b := newBuilder(f, driver) - preScheduledTests(b, driver, resourcev1alpha2.AllocationModeWaitForFirstConsumer) - claimTests(b, driver, resourcev1alpha2.AllocationModeWaitForFirstConsumer) - }) - - ginkgo.Context("with immediate allocation", func() { - driver := NewDriver(f, nodes, networkResources) - b := newBuilder(f, driver) - preScheduledTests(b, driver, resourcev1alpha2.AllocationModeImmediate) - claimTests(b, driver, resourcev1alpha2.AllocationModeImmediate) + preScheduledTests(b, driver) + claimTests(b, driver) }) }) @@ -1117,10 +991,10 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, ginkgo.It("work", func(ctx context.Context) { parameters1 := b1.parameters() parameters2 := b2.parameters() - claim1 := b1.externalClaim(resourcev1alpha2.AllocationModeWaitForFirstConsumer) - claim1b := b1.externalClaim(resourcev1alpha2.AllocationModeWaitForFirstConsumer) - claim2 := b2.externalClaim(resourcev1alpha2.AllocationModeWaitForFirstConsumer) - claim2b := b2.externalClaim(resourcev1alpha2.AllocationModeWaitForFirstConsumer) + claim1 := b1.externalClaim() + claim1b := b1.externalClaim() + claim2 := b2.externalClaim() + claim2b := b2.externalClaim() pod := b1.podExternal() for i, claim := range []*resourcev1alpha2.ResourceClaim{claim1b, claim2, claim2b} { claim := claim @@ -1206,7 +1080,7 @@ func (b *builder) nodeSelector() *v1.NodeSelector { // externalClaim returns external resource claim // that test pods can reference -func (b *builder) externalClaim(allocationMode resourcev1alpha2.AllocationMode) *resourcev1alpha2.ResourceClaim { +func (b *builder) externalClaim() *resourcev1alpha2.ResourceClaim { b.claimCounter++ name := "external-claim" + b.driver.NameSuffix // This is what podExternal expects. if b.claimCounter > 1 { @@ -1223,7 +1097,6 @@ func (b *builder) externalClaim(allocationMode resourcev1alpha2.AllocationMode) Kind: b.driver.claimParameterAPIKind, Name: b.parametersName(), }, - AllocationMode: allocationMode, }, } } @@ -1401,7 +1274,7 @@ func (b *builder) pod() *v1.Pod { } // makePodInline adds an inline resource claim with default class name and parameters. -func (b *builder) podInline(allocationMode resourcev1alpha2.AllocationMode) (*v1.Pod, *resourcev1alpha2.ResourceClaimTemplate) { +func (b *builder) podInline() (*v1.Pod, *resourcev1alpha2.ResourceClaimTemplate) { pod := b.pod() pod.Spec.Containers[0].Name = "with-resource" podClaimName := "my-inline-claim" @@ -1425,7 +1298,6 @@ func (b *builder) podInline(allocationMode resourcev1alpha2.AllocationMode) (*v1 Kind: b.driver.claimParameterAPIKind, Name: b.parametersName(), }, - AllocationMode: allocationMode, }, }, } @@ -1433,8 +1305,8 @@ func (b *builder) podInline(allocationMode resourcev1alpha2.AllocationMode) (*v1 } // podInlineMultiple returns a pod with inline resource claim referenced by 3 containers -func (b *builder) podInlineMultiple(allocationMode resourcev1alpha2.AllocationMode) (*v1.Pod, *resourcev1alpha2.ResourceClaimTemplate) { - pod, template := b.podInline(allocationMode) +func (b *builder) podInlineMultiple() (*v1.Pod, *resourcev1alpha2.ResourceClaimTemplate) { + pod, template := b.podInline() pod.Spec.Containers = append(pod.Spec.Containers, *pod.Spec.Containers[0].DeepCopy(), *pod.Spec.Containers[0].DeepCopy()) pod.Spec.Containers[1].Name = pod.Spec.Containers[1].Name + "-1" pod.Spec.Containers[2].Name = pod.Spec.Containers[1].Name + "-2"