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
- func IsFitPredicateRegistered(name string) bool
- func IsPriorityFunctionRegistered(name string) bool
- func ListAlgorithmProviders() string
- func ListRegisteredFitPredicates() []string
- func ListRegisteredPriorityFunctions() []string
- func NewConfigFactory(schedulerName string, client clientset.Interface, ...) scheduler.Configurator
- func RegisterAlgorithmProvider(name string, predicateKeys, priorityKeys sets.String) string
- func RegisterCustomFitPredicate(policy schedulerapi.PredicatePolicy) string
- func RegisterCustomPriorityFunction(policy schedulerapi.PriorityPolicy) string
- func RegisterFitPredicate(name string, predicate algorithm.FitPredicate) string
- func RegisterFitPredicateFactory(name string, predicateFactory FitPredicateFactory) string
- func RegisterGetEquivalencePodFunction(equivalenceFunc algorithm.GetEquivalencePodFunc)
- func RegisterPredicateMetadataProducerFactory(factory MetadataProducerFactory)
- func RegisterPriorityConfigFactory(name string, pcf PriorityConfigFactory) string
- func RegisterPriorityFunction(name string, function algorithm.PriorityFunction, weight int) string
- func RegisterPriorityFunction2(name string, mapFunction algorithm.PriorityMapFunction, ...) string
- func RegisterPriorityMetadataProducerFactory(factory MetadataProducerFactory)
- 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 sets.String, ...) (*scheduler.Config, error)
- func (f *ConfigFactory) CreateFromProvider(providerName string) (*scheduler.Config, error)
- func (f *ConfigFactory) GetClient() clientset.Interface
- func (c *ConfigFactory) GetHardPodAffinitySymmetricWeight() int
- func (c *ConfigFactory) GetNodeLister() corelisters.NodeLister
- func (f *ConfigFactory) GetPredicateMetadataProducer() (algorithm.MetadataProducer, error)
- func (f *ConfigFactory) GetPredicates(predicateKeys sets.String) (map[string]algorithm.FitPredicate, error)
- func (f *ConfigFactory) GetPriorityFunctionConfigs(priorityKeys sets.String) ([]algorithm.PriorityConfig, error)
- func (f *ConfigFactory) GetPriorityMetadataProducer() (algorithm.MetadataProducer, error)
- func (c *ConfigFactory) GetScheduledPodLister() corelisters.PodLister
- func (f *ConfigFactory) GetSchedulerName() string
- func (factory *ConfigFactory) MakeDefaultErrorFunc(backoff *util.PodBackoff, podQueue *cache.FIFO) func(pod *v1.Pod, err error)
- func (f *ConfigFactory) ResponsibleForPod(pod *v1.Pod) bool
- func (f *ConfigFactory) Run()
- type FitPredicateFactory
- type MetadataProducerFactory
- type PluginFactoryArgs
- type PriorityConfigFactory
- type PriorityFunctionFactory
- type PriorityFunctionFactory2
Constants ¶
const (
DefaultProvider = "DefaultProvider"
)
Variables ¶
This section is empty.
Functions ¶
func IsFitPredicateRegistered ¶
IsFitPredicateRegistered is useful for testing providers.
func IsPriorityFunctionRegistered ¶
IsPriorityFunctionRegistered is useful for testing providers.
func ListAlgorithmProviders ¶
func ListAlgorithmProviders() string
ListAlgorithmProviders is called when listing all available algorithm providers in `kube-scheduler --help`
func ListRegisteredFitPredicates ¶
func ListRegisteredFitPredicates() []string
func ListRegisteredPriorityFunctions ¶
func ListRegisteredPriorityFunctions() []string
func NewConfigFactory ¶
func NewConfigFactory( schedulerName string, client clientset.Interface, nodeInformer coreinformers.NodeInformer, pvInformer coreinformers.PersistentVolumeInformer, pvcInformer coreinformers.PersistentVolumeClaimInformer, replicationControllerInformer coreinformers.ReplicationControllerInformer, replicaSetInformer extensionsinformers.ReplicaSetInformer, statefulSetInformer appsinformers.StatefulSetInformer, serviceInformer coreinformers.ServiceInformer, hardPodAffinitySymmetricWeight int, ) scheduler.Configurator
NewConfigFactory initializes the default implementation of a Configurator To encourage eventual privatization of the struct type, we only return the interface.
func RegisterAlgorithmProvider ¶
RegisterAlgorithmProvider registers a new algorithm provider with the algorithm registry. This should be called from the init function in a provider plugin.
func RegisterCustomFitPredicate ¶
func RegisterCustomFitPredicate(policy schedulerapi.PredicatePolicy) string
RegisterCustomFitPredicate registers a custom fit predicate with the algorithm registry. Returns the name, with which the predicate was registered.
func RegisterCustomPriorityFunction ¶
func RegisterCustomPriorityFunction(policy schedulerapi.PriorityPolicy) string
RegisterCustomPriorityFunction registers a custom priority function with the algorithm registry. Returns the name, with which the priority function was registered.
func RegisterFitPredicate ¶
func RegisterFitPredicate(name string, predicate algorithm.FitPredicate) string
RegisterFitPredicate registers a fit predicate with the algorithm registry. Returns the name with which the predicate was registered.
func RegisterFitPredicateFactory ¶
func RegisterFitPredicateFactory(name string, predicateFactory FitPredicateFactory) string
RegisterFitPredicateFactory registers a fit predicate factory with the algorithm registry. Returns the name with which the predicate was registered.
func RegisterGetEquivalencePodFunction ¶
func RegisterGetEquivalencePodFunction(equivalenceFunc algorithm.GetEquivalencePodFunc)
func RegisterPredicateMetadataProducerFactory ¶
func RegisterPredicateMetadataProducerFactory(factory MetadataProducerFactory)
func RegisterPriorityConfigFactory ¶
func RegisterPriorityConfigFactory(name string, pcf PriorityConfigFactory) string
func RegisterPriorityFunction ¶
func RegisterPriorityFunction(name string, function algorithm.PriorityFunction, weight int) string
DEPRECATED Use Map-Reduce pattern for priority functions. Registers a priority function with the algorithm registry. Returns the name, with which the function was registered.
func RegisterPriorityFunction2 ¶
func RegisterPriorityFunction2( name string, mapFunction algorithm.PriorityMapFunction, reduceFunction algorithm.PriorityReduceFunction, weight int) string
RegisterPriorityFunction2 registers a priority function with the algorithm registry. Returns the name, with which the function was registered. FIXME: Rename to PriorityFunctionFactory.
func RegisterPriorityMetadataProducerFactory ¶
func RegisterPriorityMetadataProducerFactory(factory MetadataProducerFactory)
Types ¶
type AlgorithmProviderConfig ¶
type AlgorithmProviderConfig struct { FitPredicateKeys sets.String PriorityFunctionKeys sets.String }
func GetAlgorithmProvider ¶
func GetAlgorithmProvider(name string) (*AlgorithmProviderConfig, error)
GetAlgorithmProvider should not be used to modify providers. It is publicly visible for testing.
type ConfigFactory ¶
type ConfigFactory struct { // Close this to stop all reflectors StopEverything chan struct{} // contains filtered or unexported fields }
ConfigFactory is the default implementation of the scheduler.Configurator interface. TODO make this private if possible, so that only its interface is externally used.
func (*ConfigFactory) Create ¶
func (f *ConfigFactory) Create() (*scheduler.Config, error)
Create creates a scheduler with the default algorithm provider.
func (*ConfigFactory) CreateFromConfig ¶
func (f *ConfigFactory) CreateFromConfig(policy schedulerapi.Policy) (*scheduler.Config, error)
Creates a scheduler from the configuration file
func (*ConfigFactory) CreateFromKeys ¶
func (f *ConfigFactory) CreateFromKeys(predicateKeys, priorityKeys sets.String, extenders []algorithm.SchedulerExtender) (*scheduler.Config, error)
Creates a scheduler from a set of registered fit predicate keys and priority keys.
func (*ConfigFactory) CreateFromProvider ¶
func (f *ConfigFactory) CreateFromProvider(providerName string) (*scheduler.Config, error)
Creates a scheduler from the name of a registered algorithm provider.
func (*ConfigFactory) GetClient ¶
func (f *ConfigFactory) GetClient() clientset.Interface
GetClient provides a kubernetes client, mostly internal use, but may also be called by mock-tests.
func (*ConfigFactory) GetHardPodAffinitySymmetricWeight ¶
func (c *ConfigFactory) GetHardPodAffinitySymmetricWeight() int
func (*ConfigFactory) GetNodeLister ¶
func (c *ConfigFactory) GetNodeLister() corelisters.NodeLister
GetNodeStore provides the cache to the nodes, mostly internal use, but may also be called by mock-tests.
func (*ConfigFactory) GetPredicateMetadataProducer ¶
func (f *ConfigFactory) GetPredicateMetadataProducer() (algorithm.MetadataProducer, error)
func (*ConfigFactory) GetPredicates ¶
func (f *ConfigFactory) GetPredicates(predicateKeys sets.String) (map[string]algorithm.FitPredicate, error)
func (*ConfigFactory) GetPriorityFunctionConfigs ¶
func (f *ConfigFactory) GetPriorityFunctionConfigs(priorityKeys sets.String) ([]algorithm.PriorityConfig, error)
func (*ConfigFactory) GetPriorityMetadataProducer ¶
func (f *ConfigFactory) GetPriorityMetadataProducer() (algorithm.MetadataProducer, error)
func (*ConfigFactory) GetScheduledPodLister ¶
func (c *ConfigFactory) GetScheduledPodLister() corelisters.PodLister
GetScheduledPodListerIndexer provides a pod lister, mostly internal use, but may also be called by mock-tests.
func (*ConfigFactory) GetSchedulerName ¶
func (f *ConfigFactory) GetSchedulerName() string
func (*ConfigFactory) MakeDefaultErrorFunc ¶
func (factory *ConfigFactory) MakeDefaultErrorFunc(backoff *util.PodBackoff, podQueue *cache.FIFO) func(pod *v1.Pod, err error)
func (*ConfigFactory) ResponsibleForPod ¶
func (f *ConfigFactory) ResponsibleForPod(pod *v1.Pod) bool
func (*ConfigFactory) Run ¶
func (f *ConfigFactory) Run()
type FitPredicateFactory ¶
type FitPredicateFactory func(PluginFactoryArgs) algorithm.FitPredicate
A FitPredicateFactory produces a FitPredicate from the given args.
type MetadataProducerFactory ¶
type MetadataProducerFactory func(PluginFactoryArgs) algorithm.MetadataProducer
MetadataProducerFactory produces MetadataProducer from the given args.
type PluginFactoryArgs ¶
type PluginFactoryArgs struct { PodLister algorithm.PodLister ServiceLister algorithm.ServiceLister ControllerLister algorithm.ControllerLister ReplicaSetLister algorithm.ReplicaSetLister StatefulSetLister algorithm.StatefulSetLister NodeLister algorithm.NodeLister NodeInfo predicates.NodeInfo PVInfo predicates.PersistentVolumeInfo PVCInfo predicates.PersistentVolumeClaimInfo HardPodAffinitySymmetricWeight int }
PluginFactoryArgs are passed to all plugin factory functions.
type PriorityConfigFactory ¶
type PriorityConfigFactory struct { Function PriorityFunctionFactory MapReduceFunction PriorityFunctionFactory2 Weight int }
A PriorityConfigFactory produces a PriorityConfig from the given function and weight
type PriorityFunctionFactory ¶
type PriorityFunctionFactory func(PluginFactoryArgs) algorithm.PriorityFunction
DEPRECATED Use Map-Reduce pattern for priority functions. A PriorityFunctionFactory produces a PriorityConfig from the given args.
type PriorityFunctionFactory2 ¶
type PriorityFunctionFactory2 func(PluginFactoryArgs) (algorithm.PriorityMapFunction, algorithm.PriorityReduceFunction)
A PriorityFunctionFactory produces map & reduce priority functions from a given args. FIXME: Rename to PriorityFunctionFactory.