diff --git a/pkg/scheduler/framework/plugins/dynamicresources/dynamicresources.go b/pkg/scheduler/framework/plugins/dynamicresources/dynamicresources.go index 171e17e7c68..3b792d0bd17 100644 --- a/pkg/scheduler/framework/plugins/dynamicresources/dynamicresources.go +++ b/pkg/scheduler/framework/plugins/dynamicresources/dynamicresources.go @@ -415,6 +415,9 @@ func (pl *DynamicResources) PreFilter(ctx context.Context, state *framework.Cycl return nil, status } } else { + if !pl.enablePrioritizedList { + return nil, statusUnschedulable(logger, fmt.Sprintf("resource claim %s, request %s: has subrequests, but the DRAPrioritizedList feature is disabled", klog.KObj(claim), request.Name)) + } for _, subRequest := range request.FirstAvailable { qualRequestName := strings.Join([]string{request.Name, subRequest.Name}, "/") if status := pl.validateDeviceClass(logger, subRequest.DeviceClassName, qualRequestName); status != nil { diff --git a/pkg/scheduler/framework/plugins/dynamicresources/dynamicresources_test.go b/pkg/scheduler/framework/plugins/dynamicresources/dynamicresources_test.go index dd79e6dcaca..0b85ac77aac 100644 --- a/pkg/scheduler/framework/plugins/dynamicresources/dynamicresources_test.go +++ b/pkg/scheduler/framework/plugins/dynamicresources/dynamicresources_test.go @@ -861,10 +861,11 @@ func TestPlugin(t *testing.T) { claims: []*resourceapi.ResourceClaim{claimWithPrioritzedList}, classes: []*resourceapi.DeviceClass{deviceClass}, want: want{ - filter: perNodeResult{ - workerNode.Name: { - status: framework.NewStatus(framework.UnschedulableAndUnresolvable, `claim default/my-pod-my-resource, request req-1: has subrequests, but the feature is disabled`), - }, + prefilter: result{ + status: framework.NewStatus(framework.UnschedulableAndUnresolvable, `claim default/my-pod-my-resource, request req-1: has subrequests, but the DRAPrioritizedList feature is disabled`), + }, + postfilter: result{ + status: framework.NewStatus(framework.Unschedulable, `no new claims to deallocate`), }, }, }, diff --git a/staging/src/k8s.io/dynamic-resource-allocation/structured/allocator.go b/staging/src/k8s.io/dynamic-resource-allocation/structured/allocator.go index 0068a0e5e79..4a4b5add94b 100644 --- a/staging/src/k8s.io/dynamic-resource-allocation/structured/allocator.go +++ b/staging/src/k8s.io/dynamic-resource-allocation/structured/allocator.go @@ -171,7 +171,7 @@ func (a *Allocator) Allocate(ctx context.Context, node *v1.Node) (finalResult [] // Error out if the prioritizedList feature is not enabled and the request // has subrequests. This is to avoid surprising behavior for users. if !a.prioritizedListEnabled && hasSubRequests { - return nil, fmt.Errorf("claim %s, request %s: has subrequests, but the feature is disabled", klog.KObj(claim), request.Name) + return nil, fmt.Errorf("claim %s, request %s: has subrequests, but the DRAPrioritizedList feature is disabled", klog.KObj(claim), request.Name) } if hasSubRequests {