Skip to content

Commit

Permalink
return argument of framework.RunFilterPlugins has changed from a map[…
Browse files Browse the repository at this point in the history
…string]*Status to *Status.

The func returns after the first failed plugin.

Augmented schedulerbased.go to reflect this change.
  • Loading branch information
jayantjain93 committed Jan 25, 2023
1 parent c35eb64 commit 32c6bbc
Showing 1 changed file with 18 additions and 23 deletions.
41 changes: 18 additions & 23 deletions cluster-autoscaler/simulator/predicatechecker/schedulerbased.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,8 @@ func (p *SchedulerBasedPredicateChecker) FitsAnyNodeMatching(clusterSnapshot clu
continue
}

filterStatuses := p.framework.RunFilterPlugins(context.TODO(), state, pod, nodeInfo)
ok := true
for _, filterStatus := range filterStatuses {
if !filterStatus.IsSuccess() {
ok = false
break
}
}
if ok {
filterStatus := p.framework.RunFilterPlugins(context.TODO(), state, pod, nodeInfo)
if filterStatus.IsSuccess() {
p.lastIndex = (p.lastIndex + i + 1) % len(nodeInfosList)
return nodeInfo.Node().Name, nil
}
Expand Down Expand Up @@ -167,24 +160,26 @@ func (p *SchedulerBasedPredicateChecker) CheckPredicates(clusterSnapshot cluster
emptyString)
}

filterStatuses := p.framework.RunFilterPlugins(context.TODO(), state, pod, nodeInfo)
for filterName, filterStatus := range filterStatuses {
if !filterStatus.IsSuccess() {
if filterStatus.IsUnschedulable() {
return NewPredicateError(
NotSchedulablePredicateError,
filterName,
filterStatus.Message(),
filterStatus.Reasons(),
p.buildDebugInfo(filterName, nodeInfo))
}
filterStatus := p.framework.RunFilterPlugins(context.TODO(), state, pod, nodeInfo)

if !filterStatus.IsSuccess() {
filterName := filterStatus.FailedPlugin()
filterMessage := filterStatus.Message()
filterReasons := filterStatus.Reasons()
if filterStatus.IsUnschedulable() {
return NewPredicateError(
InternalPredicateError,
NotSchedulablePredicateError,
filterName,
filterStatus.Message(),
filterStatus.Reasons(),
filterMessage,
filterReasons,
p.buildDebugInfo(filterName, nodeInfo))
}
return NewPredicateError(
InternalPredicateError,
filterName,
filterMessage,
filterReasons,
p.buildDebugInfo(filterName, nodeInfo))
}
return nil
}
Expand Down

0 comments on commit 32c6bbc

Please sign in to comment.