diff --git a/pkg/scheduler/framework/plugins/dynamicresources/dynamicresources.go b/pkg/scheduler/framework/plugins/dynamicresources/dynamicresources.go index 46db7e45c09..80f9a1a37bf 100644 --- a/pkg/scheduler/framework/plugins/dynamicresources/dynamicresources.go +++ b/pkg/scheduler/framework/plugins/dynamicresources/dynamicresources.go @@ -721,7 +721,10 @@ func (pl *DynamicResources) Filter(ctx context.Context, cs fwk.CycleState, pod * a, err := state.allocator.Allocate(allocCtx, node, claimsToAllocate) switch { case errors.Is(err, context.DeadlineExceeded): - return statusUnschedulable(logger, "timed out trying to allocate devices", "pod", klog.KObj(pod), "node", klog.KObj(node), "resourceclaims", klog.KObjSlice(claimsToAllocate)) + // Timeouts are transient, not a property of the node. Return Error + // so the pod retries via backoff instead of sitting in the + // unschedulable queue waiting for a cluster event. + return statusError(logger, fmt.Errorf("timed out trying to allocate devices"), "pod", klog.KObj(pod), "node", klog.KObj(node), "resourceclaims", klog.KObjSlice(claimsToAllocate)) case errors.Is(err, structured.ErrFailedAllocationOnNode): // Not a fatal error, allocation on other nodes may proceed. // The error is only surfaced if allocation fails on all nodes. diff --git a/pkg/scheduler/framework/plugins/dynamicresources/dynamicresources_test.go b/pkg/scheduler/framework/plugins/dynamicresources/dynamicresources_test.go index 222fbbced21..d3d140e0009 100644 --- a/pkg/scheduler/framework/plugins/dynamicresources/dynamicresources_test.go +++ b/pkg/scheduler/framework/plugins/dynamicresources/dynamicresources_test.go @@ -2114,12 +2114,11 @@ func testPlugin(tCtx ktesting.TContext) { want: want{ filter: perNodeResult{ workerNode.Name: { - status: fwk.NewStatus(fwk.UnschedulableAndUnresolvable, `timed out trying to allocate devices`), + // Timeouts return Error so the pod retries via backoff. + status: fwk.AsStatus(fmt.Errorf("timed out trying to allocate devices")), }, }, - postfilter: result{ - status: fwk.NewStatus(fwk.Unschedulable, `still not schedulable`), - }, + // No postfilter: Error aborts scheduling immediately. }, // Skipping this test case on Windows as a 1ns timeout is not guaranteed to // expire immediately on Windows due to its coarser timer granularity -