Update scheduler cache interface to pass node-allocatable resource allocations to NodeInfo.

This commit is contained in:
Praveen Krishna
2026-02-02 20:40:32 +00:00
parent af186d3534
commit 0c25bdf74d

View File

@@ -41,6 +41,7 @@ import (
"k8s.io/kubernetes/pkg/features"
"k8s.io/kubernetes/pkg/scheduler/framework"
"k8s.io/kubernetes/pkg/scheduler/framework/parallelize"
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/dynamicresources"
"k8s.io/kubernetes/pkg/scheduler/metrics"
"k8s.io/kubernetes/pkg/scheduler/util"
utiltrace "k8s.io/utils/trace"
@@ -1109,6 +1110,16 @@ func (sched *Scheduler) assume(logger klog.Logger, state fwk.CycleState, assumed
// If the binding fails, scheduler will release resources allocated to assumed pod
// immediately.
assumedPodInfo.Pod.Spec.NodeName = host
if utilfeature.DefaultFeatureGate.Enabled(features.DRANodeAllocatableResources) {
// If DRANodeAllocatableResources is enabled, copy the calculated node allocatable resource claim status
// from the cycle state to the assumed pod's status. This ensures that the scheduler's
// cached version of the pod reflects the node allocatable resources allocated by the DRA plugin
// for this scheduling cycle, making this information available for NodeInfo cache update.
// Any potential NodeAllocatableResourceClaimStatuses from a previously failed scheduling attempt is overwritten.
// This field is not explicitly cleared as the Pod object is reconstructed in handleSchedulingFailure()
// before re-queueing.
assumedPodInfo.Pod.Status.NodeAllocatableResourceClaimStatuses = dynamicresources.ExtractPodNodeAllocatableResourceClaimStatus(logger, state, host)
}
if state.IsPodGroupSchedulingCycle() {
err := sched.nodeInfoSnapshot.AssumePod(assumedPodInfo.PodInfo)