mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-10 20:42:26 +00:00
Renamed to RegisterMandatoryFitPredicate.
This commit is contained in:
parent
e9738c0ce6
commit
78e078390f
@ -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(
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user