Move service affinity predicate logic to its plugin.

This commit is contained in:
Abdullah Gharaibeh
2019-12-13 12:46:29 -05:00
parent ded2ff39c3
commit 7331ec7b02
10 changed files with 410 additions and 592 deletions

View File

@@ -264,16 +264,7 @@ func RegisterCustomFitPredicate(policy schedulerapi.PredicatePolicy, pluginArgs
pluginArgs.ServiceAffinityArgs.AffinityLabels = append(pluginArgs.ServiceAffinityArgs.AffinityLabels, policy.Argument.ServiceAffinity.Labels...)
predicateFactory = func(args AlgorithmFactoryArgs) predicates.FitPredicate {
predicate, precomputationFunction := predicates.NewServiceAffinityPredicate(
args.SharedLister.NodeInfos(),
args.SharedLister.Pods(),
args.InformerFactory.Core().V1().Services().Lister(),
pluginArgs.ServiceAffinityArgs.AffinityLabels,
)
// Once we generate the predicate we should also Register the Precomputation
predicates.RegisterPredicateMetadataProducer(policyName, precomputationFunction)
return predicate
return nil
}
} else if policy.Argument.LabelsPresence != nil {
// We use the CheckNodeLabelPresencePred predicate name for all kNodeLabel custom predicates.