feature(NodeAffinity): return Skip in PreScore when nothing to do in Score

This commit is contained in:
Kensei Nakada
2023-03-31 00:04:01 +00:00
parent b46e436e18
commit 1d0453127d
2 changed files with 67 additions and 8 deletions

View File

@@ -222,6 +222,10 @@ func (pl *NodeAffinity) PreScore(ctx context.Context, cycleState *framework.Cycl
if err != nil {
return framework.AsStatus(err)
}
if preferredNodeAffinity == nil && pl.addedPrefSchedTerms == nil {
// NodeAffinity Score has nothing to do with the Pod.
return framework.NewStatus(framework.Skip)
}
state := &preScoreState{
preferredNodeAffinity: preferredNodeAffinity,
}