mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
DRA scheduler: fail in PreFilter when DRAPrioritizedList is disabled and used
This was previously caught during Filter by the allocator check. Doing it sooner avoids wasting resources on a pod which ultimately cannot get scheduled. While at it, be a bit more clear about which feature is disabled. The user might not know that.
This commit is contained in:
parent
672f57e2a4
commit
dfb8ab6521
@ -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 {
|
||||
|
@ -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`),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user