Documentation ¶
Overview ¶
Package factory can set up a scheduler. This code is here instead of plugin/cmd/scheduler for both testability and reuse.
Index ¶
- Constants
- Variables
- func IsFitPredicateRegistered(name string) bool
- func IsPriorityFunctionRegistered(name string) bool
- func RegisterAlgorithmProvider(name string, predicateKeys, priorityKeys util.StringSet) string
- func RegisterCustomFitPredicate(policy schedulerapi.PredicatePolicy) string
- func RegisterCustomPriorityFunction(policy schedulerapi.PriorityPolicy) string
- func RegisterFitPredicate(name string, predicate algorithm.FitPredicate) string
- func RegisterPriorityFunction(name string, function algorithm.PriorityFunction, weight int) string
- func SetPriorityFunctionWeight(name string, weight int)
- type AlgorithmProviderConfig
- type ConfigFactory
- func (f *ConfigFactory) Create() (*scheduler.Config, error)
- func (f *ConfigFactory) CreateFromConfig(policy schedulerapi.Policy) (*scheduler.Config, error)
- func (f *ConfigFactory) CreateFromKeys(predicateKeys, priorityKeys util.StringSet) (*scheduler.Config, error)
- func (f *ConfigFactory) CreateFromProvider(providerName string) (*scheduler.Config, error)
Constants ¶
const (
DefaultProvider = "DefaultProvider"
)
Variables ¶
var ( PodLister = &cache.StoreToPodLister{cache.NewStore(cache.MetaNamespaceKeyFunc)} MinionLister = &cache.StoreToNodeLister{cache.NewStore(cache.MetaNamespaceKeyFunc)} ServiceLister = &cache.StoreToServiceLister{cache.NewStore(cache.MetaNamespaceKeyFunc)} )
Functions ¶
func IsFitPredicateRegistered ¶ added in v0.8.2
This check is useful for testing providers.
func IsPriorityFunctionRegistered ¶ added in v0.8.2
This check is useful for testing providers.
func RegisterAlgorithmProvider ¶ added in v0.8.2
Registers a new algorithm provider with the algorithm registry. This should be called from the init function in a provider plugin.
func RegisterCustomFitPredicate ¶ added in v0.12.0
func RegisterCustomFitPredicate(policy schedulerapi.PredicatePolicy) string
Registers a custom fit predicate with the algorithm registry. Returns the name, with which the predicate was registered.
func RegisterCustomPriorityFunction ¶ added in v0.12.0
func RegisterCustomPriorityFunction(policy schedulerapi.PriorityPolicy) string
Registers a custom priority function with the algorithm registry. Returns the name, with which the priority function was registered.
func RegisterFitPredicate ¶ added in v0.8.2
func RegisterFitPredicate(name string, predicate algorithm.FitPredicate) string
Registers a fit predicate with the algorithm registry. Returns the name, with which the predicate was registered.
func RegisterPriorityFunction ¶ added in v0.8.2
func RegisterPriorityFunction(name string, function algorithm.PriorityFunction, weight int) string
Registers a priority function with the algorithm registry. Returns the name, with which the function was registered.
func SetPriorityFunctionWeight ¶ added in v0.8.2
Sets the weight of an already registered priority function.
Types ¶
type AlgorithmProviderConfig ¶ added in v0.8.2
type AlgorithmProviderConfig struct { FitPredicateKeys util.StringSet PriorityFunctionKeys util.StringSet }
func GetAlgorithmProvider ¶ added in v0.8.2
func GetAlgorithmProvider(name string) (*AlgorithmProviderConfig, error)
This function should not be used to modify providers. It is publicly visible for testing.
type ConfigFactory ¶
type ConfigFactory struct { Client *client.Client // queue for pods that need scheduling PodQueue *cache.FIFO // a means to list all scheduled pods PodLister *cache.StoreToPodLister // a means to list all minions MinionLister *cache.StoreToNodeLister // a means to list all services ServiceLister *cache.StoreToServiceLister }
ConfigFactory knows how to fill out a scheduler config with its support functions.
func NewConfigFactory ¶ added in v0.7.0
func NewConfigFactory(client *client.Client) *ConfigFactory
Initializes the factory.
func (*ConfigFactory) Create ¶
func (f *ConfigFactory) Create() (*scheduler.Config, error)
Create creates a scheduler with the default algorithm provider.
func (*ConfigFactory) CreateFromConfig ¶ added in v0.12.0
func (f *ConfigFactory) CreateFromConfig(policy schedulerapi.Policy) (*scheduler.Config, error)
Creates a scheduler from the configuration file
func (*ConfigFactory) CreateFromKeys ¶ added in v0.8.2
func (f *ConfigFactory) CreateFromKeys(predicateKeys, priorityKeys util.StringSet) (*scheduler.Config, error)
Creates a scheduler from a set of registered fit predicate keys and priority keys.
func (*ConfigFactory) CreateFromProvider ¶ added in v0.8.2
func (f *ConfigFactory) CreateFromProvider(providerName string) (*scheduler.Config, error)
Creates a scheduler from the name of a registered algorithm provider.