mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-14 14:23:37 +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.
|
// Fit is determied by node condtions: not ready, network unavailable and out of disk.
|
||||||
factory.RegisterFitPredicate("CheckNodeCondition", predicates.CheckNodeConditionPredicate),
|
factory.RegisterFitPredicate("CheckNodeCondition", predicates.CheckNodeConditionPredicate),
|
||||||
factory.RegisterEssentialFitPredicate("CheckNodeCondition", predicates.CheckNodeConditionPredicate),
|
factory.RegisterMandatoryFitPredicate("CheckNodeCondition", predicates.CheckNodeConditionPredicate),
|
||||||
|
|
||||||
// Fit is determined by volume zone requirements.
|
// Fit is determined by volume zone requirements.
|
||||||
factory.RegisterFitPredicateFactory(
|
factory.RegisterFitPredicateFactory(
|
||||||
|
@ -73,7 +73,7 @@ var (
|
|||||||
|
|
||||||
// maps that hold registered algorithm types
|
// maps that hold registered algorithm types
|
||||||
fitPredicateMap = make(map[string]FitPredicateFactory)
|
fitPredicateMap = make(map[string]FitPredicateFactory)
|
||||||
essentialFitPredicateMap = make(map[string]FitPredicateFactory)
|
mandatoryFitPredicateMap = make(map[string]FitPredicateFactory)
|
||||||
priorityFunctionMap = make(map[string]PriorityConfigFactory)
|
priorityFunctionMap = make(map[string]PriorityConfigFactory)
|
||||||
algorithmProviderMap = make(map[string]AlgorithmProviderConfig)
|
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 })
|
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
|
// kubelet, DaemonSet; it is always included in configuration. Returns the name with which the predicate was
|
||||||
// registered.
|
// registered.
|
||||||
func RegisterEssentialFitPredicate(name string, predicate algorithm.FitPredicate) string {
|
func RegisterMandatoryFitPredicate(name string, predicate algorithm.FitPredicate) string {
|
||||||
schedulerFactoryMutex.Lock()
|
schedulerFactoryMutex.Lock()
|
||||||
defer schedulerFactoryMutex.Unlock()
|
defer schedulerFactoryMutex.Unlock()
|
||||||
validateAlgorithmNameOrDie(name)
|
validateAlgorithmNameOrDie(name)
|
||||||
essentialFitPredicateMap[name] = func(PluginFactoryArgs) algorithm.FitPredicate { return predicate }
|
mandatoryFitPredicateMap[name] = func(PluginFactoryArgs) algorithm.FitPredicate { return predicate }
|
||||||
return name
|
return name
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,7 +322,7 @@ func getFitPredicateFunctions(names sets.String, args PluginFactoryArgs) (map[st
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Always include required fit predicates.
|
// Always include required fit predicates.
|
||||||
for name, factory := range essentialFitPredicateMap {
|
for name, factory := range mandatoryFitPredicateMap {
|
||||||
if _, found := predicates[name]; !found {
|
if _, found := predicates[name]; !found {
|
||||||
predicates[name] = factory(args)
|
predicates[name] = factory(args)
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ func TestSchedulerCreationFromConfigMap(t *testing.T) {
|
|||||||
// Verify that the config is applied correctly.
|
// Verify that the config is applied correctly.
|
||||||
schedPredicates := sched.Config().Algorithm.Predicates()
|
schedPredicates := sched.Config().Algorithm.Predicates()
|
||||||
schedPrioritizers := sched.Config().Algorithm.Prioritizers()
|
schedPrioritizers := sched.Config().Algorithm.Prioritizers()
|
||||||
// Includes one essential predicates.
|
// Includes one mandatory predicates.
|
||||||
if len(schedPredicates) != 3 || len(schedPrioritizers) != 2 {
|
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))
|
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