mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-17 20:00:07 +00:00
Return Error from DRA filter on timeout to enable automatic retry
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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 -
|
||||
|
||||
Reference in New Issue
Block a user