Merge pull request #124753 from sanposhiho/automated-cherry-pick-of-#124714-upstream-release-1.30

Automated cherry pick of #124714: scheduler: preallocation for NodeToStatusMap
This commit is contained in:
Kubernetes Prow Robot 2024-05-10 01:15:15 -07:00 committed by GitHub
commit 4183998aa0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -441,13 +441,16 @@ func (sched *Scheduler) schedulePod(ctx context.Context, fwk framework.Framework
// filter plugins and filter extenders.
func (sched *Scheduler) findNodesThatFitPod(ctx context.Context, fwk framework.Framework, state *framework.CycleState, pod *v1.Pod) ([]*framework.NodeInfo, framework.Diagnosis, error) {
logger := klog.FromContext(ctx)
diagnosis := framework.Diagnosis{
NodeToStatusMap: make(framework.NodeToStatusMap),
}
allNodes, err := sched.nodeInfoSnapshot.NodeInfos().List()
if err != nil {
return nil, diagnosis, err
return nil, framework.Diagnosis{
NodeToStatusMap: make(framework.NodeToStatusMap),
}, err
}
diagnosis := framework.Diagnosis{
NodeToStatusMap: make(framework.NodeToStatusMap, len(allNodes)),
}
// Run "prefilter" plugins.
preRes, s := fwk.RunPreFilterPlugins(ctx, state, pod)