Skip PreScore when the TopologySpreadConstraints is specified

`DefaultPodTopologySpread` need't score when the `TopologySpreadConstraints`
is specified.

`PreScore` needn't do this as well, this cut off the cost of `PreScore` if
possible.

Signed-off-by: Dave Chen <dave.chen@arm.com>
This commit is contained in:
Dave Chen 2020-06-18 16:20:48 +08:00
parent cf36d9b8e9
commit 068c69d743

View File

@ -171,6 +171,9 @@ func (pl *DefaultPodTopologySpread) ScoreExtensions() framework.ScoreExtensions
// PreScore builds and writes cycle state used by Score and NormalizeScore.
func (pl *DefaultPodTopologySpread) PreScore(ctx context.Context, cycleState *framework.CycleState, pod *v1.Pod, nodes []*v1.Node) *framework.Status {
if skipDefaultPodTopologySpread(pod) {
return nil
}
var selector labels.Selector
informerFactory := pl.handle.SharedInformerFactory()
selector = helper.DefaultSelector(