mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
Replaced bool map to string set.
This commit is contained in:
parent
4a32bde4a5
commit
2da96fc458
@ -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)
|
||||||
mandatoryFitPredicates = make(map[string]bool)
|
mandatoryFitPredicates = sets.NewString()
|
||||||
priorityFunctionMap = make(map[string]PriorityConfigFactory)
|
priorityFunctionMap = make(map[string]PriorityConfigFactory)
|
||||||
algorithmProviderMap = make(map[string]AlgorithmProviderConfig)
|
algorithmProviderMap = make(map[string]AlgorithmProviderConfig)
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ func RegisterMandatoryFitPredicate(name string, predicate algorithm.FitPredicate
|
|||||||
defer schedulerFactoryMutex.Unlock()
|
defer schedulerFactoryMutex.Unlock()
|
||||||
validateAlgorithmNameOrDie(name)
|
validateAlgorithmNameOrDie(name)
|
||||||
fitPredicateMap[name] = func(PluginFactoryArgs) algorithm.FitPredicate { return predicate }
|
fitPredicateMap[name] = func(PluginFactoryArgs) algorithm.FitPredicate { return predicate }
|
||||||
mandatoryFitPredicates[name] = true
|
mandatoryFitPredicates.Insert(name)
|
||||||
return name
|
return name
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -323,13 +323,11 @@ func getFitPredicateFunctions(names sets.String, args PluginFactoryArgs) (map[st
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Always include mandatory fit predicates.
|
// Always include mandatory fit predicates.
|
||||||
for name, mandatory := range mandatoryFitPredicates {
|
for _, name := range mandatoryFitPredicates.List() {
|
||||||
if mandatory {
|
|
||||||
if factory, found := fitPredicateMap[name]; found {
|
if factory, found := fitPredicateMap[name]; found {
|
||||||
predicates[name] = factory(args)
|
predicates[name] = factory(args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return predicates, nil
|
return predicates, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user