Skip to content

Commit

Permalink
use the PreFilterResult in SchedulerBasedPredicateChecker
Browse files Browse the repository at this point in the history
  • Loading branch information
ahaysx committed May 7, 2022
1 parent 9bca83a commit 7be9ef6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cluster-autoscaler/simulator/predicate_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
type PredicateErrorType int

const (
// NotSchedulablePredicateError means that one of the filters retuned that pod does not fit a node
// NotSchedulablePredicateError means that one of the filters returned that pod does not fit a node
NotSchedulablePredicateError PredicateErrorType = iota
// InternalPredicateError denotes internal unexpected error while calling PredicateChecker
InternalPredicateError
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func (p *SchedulerBasedPredicateChecker) FitsAnyNodeMatching(clusterSnapshot Clu
defer p.delegatingSharedLister.ResetDelegate()

state := schedulerframework.NewCycleState()
_, preFilterStatus := p.framework.RunPreFilterPlugins(context.TODO(), state, pod)
preFilterResult, preFilterStatus := p.framework.RunPreFilterPlugins(context.TODO(), state, pod)
if !preFilterStatus.IsSuccess() {
return "", fmt.Errorf("error running pre filter plugins for pod %s; %s", pod.Name, preFilterStatus.Message())
}
Expand All @@ -114,6 +114,10 @@ func (p *SchedulerBasedPredicateChecker) FitsAnyNodeMatching(clusterSnapshot Clu
continue
}

if !preFilterResult.AllNodes() && !preFilterResult.NodeNames.Has(nodeInfo.Node().Name) {
continue
}

// Be sure that the node is schedulable.
if nodeInfo.Node().Spec.Unschedulable {
continue
Expand Down

0 comments on commit 7be9ef6

Please sign in to comment.