Merge pull request #114798 from kerthcet/cleanup/code-refactor

Code refactor for readability in `RunFilterPlugins`
This commit is contained in:
Kubernetes Prow Robot 2023-01-09 17:31:12 -08:00 committed by GitHub
commit 1d6ae20301
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -730,14 +730,11 @@ func (f *frameworkImpl) RunFilterPlugins(
pod *v1.Pod,
nodeInfo *framework.NodeInfo,
) *framework.Status {
var status *framework.Status
for _, pl := range f.filterPlugins {
if state.SkipFilterPlugins.Has(pl.Name()) {
continue
}
status = f.runFilterPlugin(ctx, pl, state, pod, nodeInfo)
if !status.IsSuccess() {
if status := f.runFilterPlugin(ctx, pl, state, pod, nodeInfo); !status.IsSuccess() {
if !status.IsUnschedulable() {
// Filter plugins are not supposed to return any status other than
// Success or Unschedulable.
@ -748,7 +745,7 @@ func (f *frameworkImpl) RunFilterPlugins(
}
}
return status
return nil
}
func (f *frameworkImpl) runFilterPlugin(ctx context.Context, pl framework.FilterPlugin, state *framework.CycleState, pod *v1.Pod, nodeInfo *framework.NodeInfo) *framework.Status {