mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Merge pull request #89370 from ahg-g/ahg-prescore
Execute PreScore right before Score instead of after Filter.
This commit is contained in:
commit
62108be6d9
@ -166,12 +166,6 @@ func (g *genericScheduler) Schedule(ctx context.Context, prof *profile.Profile,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run "prefilter" plugins.
|
// Run "prefilter" plugins.
|
||||||
preFilterStatus := prof.RunPreFilterPlugins(ctx, state, pod)
|
|
||||||
if !preFilterStatus.IsSuccess() {
|
|
||||||
return result, preFilterStatus.AsError()
|
|
||||||
}
|
|
||||||
trace.Step("Running prefilter plugins done")
|
|
||||||
|
|
||||||
startPredicateEvalTime := time.Now()
|
startPredicateEvalTime := time.Now()
|
||||||
filteredNodes, filteredNodesStatuses, err := g.findNodesThatFitPod(ctx, prof, state, pod)
|
filteredNodes, filteredNodesStatuses, err := g.findNodesThatFitPod(ctx, prof, state, pod)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -187,13 +181,6 @@ func (g *genericScheduler) Schedule(ctx context.Context, prof *profile.Profile,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run "prescore" plugins.
|
|
||||||
prescoreStatus := prof.RunPreScorePlugins(ctx, state, pod, filteredNodes)
|
|
||||||
if !prescoreStatus.IsSuccess() {
|
|
||||||
return result, prescoreStatus.AsError()
|
|
||||||
}
|
|
||||||
trace.Step("Running prescore plugins done")
|
|
||||||
|
|
||||||
metrics.DeprecatedSchedulingAlgorithmPredicateEvaluationSecondsDuration.Observe(metrics.SinceInSeconds(startPredicateEvalTime))
|
metrics.DeprecatedSchedulingAlgorithmPredicateEvaluationSecondsDuration.Observe(metrics.SinceInSeconds(startPredicateEvalTime))
|
||||||
metrics.DeprecatedSchedulingDuration.WithLabelValues(metrics.PredicateEvaluation).Observe(metrics.SinceInSeconds(startPredicateEvalTime))
|
metrics.DeprecatedSchedulingDuration.WithLabelValues(metrics.PredicateEvaluation).Observe(metrics.SinceInSeconds(startPredicateEvalTime))
|
||||||
|
|
||||||
@ -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
|
// Filters the nodes to find the ones that fit the pod based on the framework
|
||||||
// filter plugins and filter extenders.
|
// 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) {
|
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)
|
filteredNodesStatuses := make(framework.NodeToStatusMap)
|
||||||
filtered, err := g.findNodesThatPassFilters(ctx, prof, state, pod, filteredNodesStatuses)
|
filtered, err := g.findNodesThatPassFilters(ctx, prof, state, pod, filteredNodesStatuses)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -643,10 +635,16 @@ func (g *genericScheduler) prioritizeNodes(
|
|||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run PreScore plugins.
|
||||||
|
preScoreStatus := prof.RunPreScorePlugins(ctx, state, pod, nodes)
|
||||||
|
if !preScoreStatus.IsSuccess() {
|
||||||
|
return nil, preScoreStatus.AsError()
|
||||||
|
}
|
||||||
|
|
||||||
// Run the Score plugins.
|
// Run the Score plugins.
|
||||||
scoresMap, scoreStatus := prof.RunScorePlugins(ctx, state, pod, nodes)
|
scoresMap, scoreStatus := prof.RunScorePlugins(ctx, state, pod, nodes)
|
||||||
if !scoreStatus.IsSuccess() {
|
if !scoreStatus.IsSuccess() {
|
||||||
return framework.NodeScoreList{}, scoreStatus.AsError()
|
return nil, scoreStatus.AsError()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Summarize all scores.
|
// Summarize all scores.
|
||||||
|
Loading…
Reference in New Issue
Block a user