Skip to content

Commit

Permalink
hotfix when a plugin (in-tree or out-of-tree) return non-existent/ill…
Browse files Browse the repository at this point in the history
…egal nodes, the pod scheduling flow will abort immediately.

this is a minimum fix from #119779

Signed-off-by: joey <zchengjoey@gmail.com>
  • Loading branch information
chengjoey committed Apr 26, 2024
1 parent d138c02 commit 27c4ec4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pkg/scheduler/schedule_one.go
Expand Up @@ -482,13 +482,14 @@ func (sched *Scheduler) findNodesThatFitPod(ctx context.Context, fwk framework.F

nodes := allNodes
if !preRes.AllNodes() {
nodes = make([]*framework.NodeInfo, 0, len(preRes.NodeNames))
for n := range preRes.NodeNames {
nInfo, err := sched.nodeInfoSnapshot.NodeInfos().Get(n)
if err != nil {
return nil, diagnosis, err
for _, n := range allNodes {
if !preRes.NodeNames.Has(n.Node().Name) {
// We consider Nodes that are filtered out by PreFilterResult as rejected via UnschedulableAndUnresolvable.
// We have to record them in NodeToStatusMap so that they won't be considered as candidates in the preemption.
diagnosis.NodeToStatusMap[n.Node().Name] = framework.NewStatus(framework.UnschedulableAndUnresolvable, "node is filtered out by the prefilter result")
continue
}
nodes = append(nodes, nInfo)
nodes = append(nodes, n)
}
}
feasibleNodes, err := sched.findNodesThatPassFilters(ctx, fwk, state, pod, &diagnosis, nodes)
Expand Down

0 comments on commit 27c4ec4

Please sign in to comment.