Skip to content

Commit

Permalink
Merge pull request kubernetes#114524 from Huang-Wei/automated-cherry-…
Browse files Browse the repository at this point in the history
…pick-of-#114518-upstream-release-1.26

Automated cherry pick of kubernetes#114518: Fix a regression that scheduler always go through all Filter
  • Loading branch information
k8s-ci-robot committed Dec 21, 2022
2 parents ef3de87 + cbeb580 commit 8648ce3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
5 changes: 2 additions & 3 deletions pkg/scheduler/framework/runtime/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -730,11 +730,10 @@ func (f *frameworkImpl) RunFilterPlugins(
if !pluginStatus.IsUnschedulable() {
// Filter plugins are not supposed to return any status other than
// Success or Unschedulable.
errStatus := framework.AsStatus(fmt.Errorf("running %q filter plugin: %w", pl.Name(), pluginStatus.AsError())).WithFailedPlugin(pl.Name())
return map[string]*framework.Status{pl.Name(): errStatus}
pluginStatus = framework.AsStatus(fmt.Errorf("running %q filter plugin: %w", pl.Name(), pluginStatus.AsError()))
}
pluginStatus.SetFailedPlugin(pl.Name())
statuses[pl.Name()] = pluginStatus
return map[string]*framework.Status{pl.Name(): pluginStatus}
}
}

Expand Down
18 changes: 17 additions & 1 deletion pkg/scheduler/framework/runtime/framework_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1506,7 +1506,6 @@ func TestFilterPlugins(t *testing.T) {
name: "TestPlugin1",
inj: injectedResult{FilterStatus: int(framework.Error)},
},

{
name: "TestPlugin2",
inj: injectedResult{FilterStatus: int(framework.Error)},
Expand All @@ -1517,6 +1516,23 @@ func TestFilterPlugins(t *testing.T) {
"TestPlugin1": framework.AsStatus(fmt.Errorf(`running "TestPlugin1" filter plugin: %w`, errInjectedFilterStatus)).WithFailedPlugin("TestPlugin1"),
},
},
{
name: "UnschedulableAndUnschedulableFilters",
plugins: []*TestPlugin{
{
name: "TestPlugin1",
inj: injectedResult{FilterStatus: int(framework.Unschedulable)},
},
{
name: "TestPlugin2",
inj: injectedResult{FilterStatus: int(framework.Unschedulable)},
},
},
wantStatus: framework.NewStatus(framework.Unschedulable, injectFilterReason).WithFailedPlugin("TestPlugin1"),
wantStatusMap: framework.PluginToStatus{
"TestPlugin1": framework.NewStatus(framework.Unschedulable, injectFilterReason).WithFailedPlugin("TestPlugin1"),
},
},
{
name: "SuccessAndSuccessFilters",
plugins: []*TestPlugin{
Expand Down

0 comments on commit 8648ce3

Please sign in to comment.