mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Moved RunPreScorePlugins to inside prioritizeNodes and RunPreFilterPlugins to inside findNodesThatFitPod.
This commit is contained in:
parent
f9b650bc98
commit
24fe5a2f72
@ -167,12 +167,6 @@ func (g *genericScheduler) Schedule(ctx context.Context, prof *profile.Profile,
|
||||
|
||||
// Run "prefilter" plugins.
|
||||
startPredicateEvalTime := time.Now()
|
||||
preFilterStatus := prof.RunPreFilterPlugins(ctx, state, pod)
|
||||
if !preFilterStatus.IsSuccess() {
|
||||
return result, preFilterStatus.AsError()
|
||||
}
|
||||
trace.Step("Running prefilter plugins done")
|
||||
|
||||
filteredNodes, filteredNodesStatuses, err := g.findNodesThatFitPod(ctx, prof, state, pod)
|
||||
if err != nil {
|
||||
return result, err
|
||||
@ -201,13 +195,6 @@ func (g *genericScheduler) Schedule(ctx context.Context, prof *profile.Profile,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Run "prescore" plugins.
|
||||
prescoreStatus := prof.RunPreScorePlugins(ctx, state, pod, filteredNodes)
|
||||
if !prescoreStatus.IsSuccess() {
|
||||
return result, prescoreStatus.AsError()
|
||||
}
|
||||
trace.Step("Running prescore plugins done")
|
||||
|
||||
priorityList, err := g.prioritizeNodes(ctx, prof, state, pod, filteredNodes)
|
||||
if err != nil {
|
||||
return result, err
|
||||
@ -412,6 +399,11 @@ func (g *genericScheduler) numFeasibleNodesToFind(numAllNodes int32) (numNodes i
|
||||
// Filters the nodes to find the ones that fit the pod based on the framework
|
||||
// filter plugins and filter extenders.
|
||||
func (g *genericScheduler) findNodesThatFitPod(ctx context.Context, prof *profile.Profile, state *framework.CycleState, pod *v1.Pod) ([]*v1.Node, framework.NodeToStatusMap, error) {
|
||||
s := prof.RunPreFilterPlugins(ctx, state, pod)
|
||||
if !s.IsSuccess() {
|
||||
return nil, nil, s.AsError()
|
||||
}
|
||||
|
||||
filteredNodesStatuses := make(framework.NodeToStatusMap)
|
||||
filtered, err := g.findNodesThatPassFilters(ctx, prof, state, pod, filteredNodesStatuses)
|
||||
if err != nil {
|
||||
@ -643,10 +635,16 @@ func (g *genericScheduler) prioritizeNodes(
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Run PreScore plugins.
|
||||
preScoreStatus := prof.RunPreScorePlugins(ctx, state, pod, nodes)
|
||||
if !preScoreStatus.IsSuccess() {
|
||||
return nil, preScoreStatus.AsError()
|
||||
}
|
||||
|
||||
// Run the Score plugins.
|
||||
scoresMap, scoreStatus := prof.RunScorePlugins(ctx, state, pod, nodes)
|
||||
if !scoreStatus.IsSuccess() {
|
||||
return framework.NodeScoreList{}, scoreStatus.AsError()
|
||||
return nil, scoreStatus.AsError()
|
||||
}
|
||||
|
||||
// Summarize all scores.
|
||||
|
Loading…
Reference in New Issue
Block a user