From 78e078390f7d64377d88a4d3c061a8f5904b384a Mon Sep 17 00:00:00 2001 From: Klaus Ma Date: Sat, 12 Aug 2017 07:26:48 +0800 Subject: [PATCH] Renamed to RegisterMandatoryFitPredicate. --- .../scheduler/algorithmprovider/defaults/defaults.go | 2 +- plugin/pkg/scheduler/factory/plugins.go | 10 +++++----- test/integration/scheduler/scheduler_test.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/plugin/pkg/scheduler/algorithmprovider/defaults/defaults.go b/plugin/pkg/scheduler/algorithmprovider/defaults/defaults.go index 6bc413b427b..7e25b0405c2 100644 --- a/plugin/pkg/scheduler/algorithmprovider/defaults/defaults.go +++ b/plugin/pkg/scheduler/algorithmprovider/defaults/defaults.go @@ -177,7 +177,7 @@ func defaultPredicates() sets.String { // Fit is determied by node condtions: not ready, network unavailable and out of disk. factory.RegisterFitPredicate("CheckNodeCondition", predicates.CheckNodeConditionPredicate), - factory.RegisterEssentialFitPredicate("CheckNodeCondition", predicates.CheckNodeConditionPredicate), + factory.RegisterMandatoryFitPredicate("CheckNodeCondition", predicates.CheckNodeConditionPredicate), // Fit is determined by volume zone requirements. factory.RegisterFitPredicateFactory( diff --git a/plugin/pkg/scheduler/factory/plugins.go b/plugin/pkg/scheduler/factory/plugins.go index 8b7bba4547d..ad245c7d9c6 100644 --- a/plugin/pkg/scheduler/factory/plugins.go +++ b/plugin/pkg/scheduler/factory/plugins.go @@ -73,7 +73,7 @@ var ( // maps that hold registered algorithm types fitPredicateMap = make(map[string]FitPredicateFactory) - essentialFitPredicateMap = make(map[string]FitPredicateFactory) + mandatoryFitPredicateMap = make(map[string]FitPredicateFactory) priorityFunctionMap = make(map[string]PriorityConfigFactory) algorithmProviderMap = make(map[string]AlgorithmProviderConfig) @@ -100,14 +100,14 @@ func RegisterFitPredicate(name string, predicate algorithm.FitPredicate) string return RegisterFitPredicateFactory(name, func(PluginFactoryArgs) algorithm.FitPredicate { return predicate }) } -// RegisterEssentialFitPredicate registers a fit predicate with the algorithm registry, the predicate is used by +// RegisterMandatoryFitPredicate registers a fit predicate with the algorithm registry, the predicate is used by // kubelet, DaemonSet; it is always included in configuration. Returns the name with which the predicate was // registered. -func RegisterEssentialFitPredicate(name string, predicate algorithm.FitPredicate) string { +func RegisterMandatoryFitPredicate(name string, predicate algorithm.FitPredicate) string { schedulerFactoryMutex.Lock() defer schedulerFactoryMutex.Unlock() validateAlgorithmNameOrDie(name) - essentialFitPredicateMap[name] = func(PluginFactoryArgs) algorithm.FitPredicate { return predicate } + mandatoryFitPredicateMap[name] = func(PluginFactoryArgs) algorithm.FitPredicate { return predicate } return name } @@ -322,7 +322,7 @@ func getFitPredicateFunctions(names sets.String, args PluginFactoryArgs) (map[st } // Always include required fit predicates. - for name, factory := range essentialFitPredicateMap { + for name, factory := range mandatoryFitPredicateMap { if _, found := predicates[name]; !found { predicates[name] = factory(args) } diff --git a/test/integration/scheduler/scheduler_test.go b/test/integration/scheduler/scheduler_test.go index d46c96ecb74..6322e551631 100644 --- a/test/integration/scheduler/scheduler_test.go +++ b/test/integration/scheduler/scheduler_test.go @@ -139,7 +139,7 @@ func TestSchedulerCreationFromConfigMap(t *testing.T) { // Verify that the config is applied correctly. schedPredicates := sched.Config().Algorithm.Predicates() schedPrioritizers := sched.Config().Algorithm.Prioritizers() - // Includes one essential predicates. + // Includes one mandatory predicates. if len(schedPredicates) != 3 || len(schedPrioritizers) != 2 { t.Errorf("Unexpected number of predicates or priority functions. Number of predicates: %v, number of prioritizers: %v", len(schedPredicates), len(schedPrioritizers)) }