Skip to content

Commit 7f36fca

Browse files
committed
DRA: remove "sharable" from claim allocation result
Now all claims are shareable up to the limit imposed by the size of the "reserverFor" array. This is one of the agreed simplifications for 1.31.
1 parent f83e8e1 commit 7f36fca

File tree

38 files changed

+294
-413
lines changed

38 files changed

+294
-413
lines changed

api/openapi-spec/swagger.json

Lines changed: 0 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/openapi-spec/v3/apis__resource.k8s.io__v1alpha2_openapi.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,6 @@
109109
},
110110
"type": "array",
111111
"x-kubernetes-list-type": "atomic"
112-
},
113-
"shareable": {
114-
"description": "Shareable determines whether the resource supports more than one consumer at a time.",
115-
"type": "boolean"
116112
}
117113
},
118114
"type": "object"
@@ -656,10 +652,6 @@
656652
],
657653
"default": {},
658654
"description": "Standard object metadata"
659-
},
660-
"shareable": {
661-
"description": "Shareable indicates whether the allocated claim is meant to be shareable by multiple consumers at the same time.",
662-
"type": "boolean"
663655
}
664656
},
665657
"type": "object",

pkg/apis/resource/types.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,6 @@ type AllocationResult struct {
130130
// everywhere.
131131
// +optional
132132
AvailableOnNodes *core.NodeSelector
133-
134-
// Shareable determines whether the resource supports more
135-
// than one consumer at a time.
136-
// +optional
137-
Shareable bool
138133
}
139134

140135
// AllocationResultResourceHandlesMaxSize represents the maximum number of
@@ -509,10 +504,6 @@ type ResourceClaimParameters struct {
509504
// to some unknown type.
510505
GeneratedFrom *ResourceClaimParametersReference
511506

512-
// Shareable indicates whether the allocated claim is meant to be shareable
513-
// by multiple consumers at the same time.
514-
Shareable bool
515-
516507
// DriverRequests describes all resources that are needed for the
517508
// allocated claim. A single claim may use resources coming from
518509
// different drivers. For each driver, this array has at most one

pkg/apis/resource/v1alpha2/zz_generated.conversion.go

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/resource/validation/validation.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,6 @@ func ValidateClaimStatusUpdate(resourceClaim, oldClaim *resource.ResourceClaim)
170170
if resourceClaim.Status.Allocation == nil {
171171
allErrs = append(allErrs, field.Forbidden(fldPath.Child("reservedFor"), "may not be specified when `allocated` is not set"))
172172
} else {
173-
if !resourceClaim.Status.Allocation.Shareable && len(resourceClaim.Status.ReservedFor) > 1 {
174-
allErrs = append(allErrs, field.Forbidden(fldPath.Child("reservedFor"), "may not be reserved more than once"))
175-
}
176173
// Items may be removed from ReservedFor while the claim is meant to be deallocated,
177174
// but not added.
178175
if resourceClaim.DeletionTimestamp != nil || resourceClaim.Status.DeallocationRequested {

pkg/apis/resource/validation/validation_resourceclaim_test.go

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,6 @@ func TestValidateClaimStatusUpdate(t *testing.T) {
336336
}
337337
return handles
338338
}(),
339-
Shareable: true,
340339
},
341340
}
342341

@@ -584,25 +583,6 @@ func TestValidateClaimStatusUpdate(t *testing.T) {
584583
return claim
585584
},
586585
},
587-
"invalid-reserved-for-not-shared": {
588-
wantFailures: field.ErrorList{field.Forbidden(field.NewPath("status", "reservedFor"), "may not be reserved more than once")},
589-
oldClaim: func() *resource.ResourceClaim {
590-
claim := validAllocatedClaim.DeepCopy()
591-
claim.Status.Allocation.Shareable = false
592-
return claim
593-
}(),
594-
update: func(claim *resource.ResourceClaim) *resource.ResourceClaim {
595-
for i := 0; i < 2; i++ {
596-
claim.Status.ReservedFor = append(claim.Status.ReservedFor,
597-
resource.ResourceClaimConsumerReference{
598-
Resource: "pods",
599-
Name: fmt.Sprintf("foo-%d", i),
600-
UID: types.UID(fmt.Sprintf("%d", i)),
601-
})
602-
}
603-
return claim
604-
},
605-
},
606586
"invalid-reserved-for-no-allocation": {
607587
wantFailures: field.ErrorList{field.Forbidden(field.NewPath("status", "reservedFor"), "may not be specified when `allocated` is not set")},
608588
oldClaim: validClaim,

pkg/controller/resourceclaim/controller_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -559,9 +559,7 @@ func makeGeneratedClaim(podClaimName, generateName, namespace, classname string,
559559

560560
func allocateClaim(claim *resourcev1alpha2.ResourceClaim) *resourcev1alpha2.ResourceClaim {
561561
claim = claim.DeepCopy()
562-
claim.Status.Allocation = &resourcev1alpha2.AllocationResult{
563-
Shareable: true,
564-
}
562+
claim.Status.Allocation = &resourcev1alpha2.AllocationResult{}
565563
return claim
566564
}
567565

pkg/generated/openapi/zz_generated.openapi.go

Lines changed: 0 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/scheduler/framework/plugins/dynamicresources/dynamicresources.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,6 @@ func (pl *dynamicResources) lookupClassParameters(logger klog.Logger, class *res
10511051

10521052
func (pl *dynamicResources) lookupClaimParameters(logger klog.Logger, class *resourcev1alpha2.ResourceClass, claim *resourcev1alpha2.ResourceClaim) (*resourcev1alpha2.ResourceClaimParameters, *framework.Status) {
10531053
defaultClaimParameters := resourcev1alpha2.ResourceClaimParameters{
1054-
Shareable: true,
10551054
DriverRequests: []resourcev1alpha2.DriverRequests{
10561055
{
10571056
DriverName: class.DriverName,

pkg/scheduler/framework/plugins/dynamicresources/dynamicresources_test.go

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,6 @@ var (
105105
UID(podUID).
106106
PodResourceClaims(v1.PodResourceClaim{Name: resourceName, ResourceClaimName: &claimName}).
107107
Obj()
108-
otherPodWithClaimName = st.MakePod().Name(podName).Namespace(namespace).
109-
UID(podUID + "-II").
110-
PodResourceClaims(v1.PodResourceClaim{Name: resourceName, ResourceClaimName: &claimName}).
111-
Obj()
112108
podWithClaimTemplate = st.MakePod().Name(podName).Namespace(namespace).
113109
UID(podUID).
114110
PodResourceClaims(v1.PodResourceClaim{Name: resourceName, ResourceClaimTemplateName: &claimName}).
@@ -134,7 +130,6 @@ var (
134130

135131
claimParameters = st.MakeClaimParameters().Name(claimName).Namespace(namespace).
136132
NamedResourcesRequests("some-driver", "true").
137-
Shareable(true).
138133
GeneratedFrom(&resourcev1alpha2.ResourceClaimParametersReference{
139134
Name: claimName,
140135
Kind: "ResourceClaimParameters",
@@ -143,7 +138,6 @@ var (
143138
Obj()
144139
claimParametersOtherNamespace = st.MakeClaimParameters().Name(claimName).Namespace(namespace+"-2").
145140
NamedResourcesRequests("some-driver", "true").
146-
Shareable(true).
147141
GeneratedFrom(&resourcev1alpha2.ResourceClaimParametersReference{
148142
Name: claimName,
149143
Kind: "ResourceClaimParameters",
@@ -946,22 +940,6 @@ func TestPlugin(t *testing.T) {
946940
},
947941
},
948942
},
949-
"in-use-by-other": {
950-
nodes: []*v1.Node{},
951-
pod: otherPodWithClaimName,
952-
claims: []*resourcev1alpha2.ResourceClaim{inUseClaim},
953-
classes: []*resourcev1alpha2.ResourceClass{},
954-
schedulings: []*resourcev1alpha2.PodSchedulingContext{},
955-
prepare: prepare{},
956-
want: want{
957-
prefilter: result{
958-
status: framework.NewStatus(framework.UnschedulableAndUnresolvable, `resourceclaim in use`),
959-
},
960-
postfilter: result{
961-
status: framework.NewStatus(framework.Unschedulable, `no new claims to deallocate`),
962-
},
963-
},
964-
},
965943
"wrong-topology": {
966944
// PostFilter tries to get the pod scheduleable by
967945
// deallocating the claim.

0 commit comments

Comments
 (0)