factory

package
v1.8.9-beta.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2018 License: Apache-2.0 Imports: 39 Imported by: 0

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

View Source
const (
	DefaultProvider = "DefaultProvider"
)

Variables

This section is empty.

Functions

func IsFitPredicateRegistered added in v0.8.0

func IsFitPredicateRegistered(name string) bool

IsFitPredicateRegistered is useful for testing providers.

func IsPriorityFunctionRegistered added in v0.8.0

func IsPriorityFunctionRegistered(name string) bool

IsPriorityFunctionRegistered is useful for testing providers.

func ListAlgorithmProviders added in v0.16.0

func ListAlgorithmProviders() string

ListAlgorithmProviders is called when listing all available algorithm providers in `kube-scheduler --help`

func ListRegisteredFitPredicates added in v1.5.0

func ListRegisteredFitPredicates() []string

func ListRegisteredPriorityFunctions added in v1.5.0

func ListRegisteredPriorityFunctions() []string

func NewConfigFactory added in v0.7.0

func NewConfigFactory(
	schedulerName string,
	client clientset.Interface,
	nodeInformer coreinformers.NodeInformer,
	podInformer coreinformers.PodInformer,
	pvInformer coreinformers.PersistentVolumeInformer,
	pvcInformer coreinformers.PersistentVolumeClaimInformer,
	replicationControllerInformer coreinformers.ReplicationControllerInformer,
	replicaSetInformer extensionsinformers.ReplicaSetInformer,
	statefulSetInformer appsinformers.StatefulSetInformer,
	serviceInformer coreinformers.ServiceInformer,
	hardPodAffinitySymmetricWeight int,
	enableEquivalenceClassCache bool,
) scheduler.Configurator

NewConfigFactory initializes the default implementation of a Configurator To encourage eventual privatization of the struct type, we only return the interface.

func NewPodInformer added in v1.7.0

func NewPodInformer(client clientset.Interface, resyncPeriod time.Duration) coreinformers.PodInformer

NewPodInformer creates a shared index informer that returns only non-terminal pods.

func RegisterAlgorithmProvider added in v0.8.0

func RegisterAlgorithmProvider(name string, predicateKeys, priorityKeys sets.String) string

RegisterAlgorithmProvider 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

RegisterCustomFitPredicate 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

RegisterCustomPriorityFunction 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.0

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 added in v0.13.1

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 added in v1.5.0

func RegisterGetEquivalencePodFunction(equivalenceFuncFactory EquivalencePodFuncFactory)

RegisterGetEquivalencePodFunction registers equivalenceFuncFactory to produce equivalence class for given pod.

func RegisterMandatoryFitPredicate added in v1.8.0

func RegisterMandatoryFitPredicate(name string, predicate algorithm.FitPredicate) string

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 RegisterPredicateMetadataProducerFactory added in v1.5.0

func RegisterPredicateMetadataProducerFactory(factory PredicateMetadataProducerFactory)

func RegisterPriorityConfigFactory added in v0.13.1

func RegisterPriorityConfigFactory(name string, pcf PriorityConfigFactory) string

func RegisterPriorityFunction added in v0.8.0

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 added in v1.5.0

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 added in v1.5.0

func RegisterPriorityMetadataProducerFactory(factory MetadataProducerFactory)

Types

type AlgorithmProviderConfig added in v0.8.0

type AlgorithmProviderConfig struct {
	FitPredicateKeys     sets.String
	PriorityFunctionKeys sets.String
}

func GetAlgorithmProvider added in v0.8.0

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 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.0

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 added in v0.8.0

func (f *ConfigFactory) CreateFromProvider(providerName string) (*scheduler.Config, error)

Creates a scheduler from the name of a registered algorithm provider.

func (*ConfigFactory) GetClient added in v1.6.0

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 added in v1.6.0

func (c *ConfigFactory) GetHardPodAffinitySymmetricWeight() int

func (*ConfigFactory) GetNodeLister added in v1.6.0

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 added in v1.5.0

func (f *ConfigFactory) GetPredicateMetadataProducer() (algorithm.PredicateMetadataProducer, error)

func (*ConfigFactory) GetPredicates added in v1.3.0

func (f *ConfigFactory) GetPredicates(predicateKeys sets.String) (map[string]algorithm.FitPredicate, error)

func (*ConfigFactory) GetPriorityFunctionConfigs added in v1.3.0

func (f *ConfigFactory) GetPriorityFunctionConfigs(priorityKeys sets.String) ([]algorithm.PriorityConfig, error)

func (*ConfigFactory) GetPriorityMetadataProducer added in v1.5.0

func (f *ConfigFactory) GetPriorityMetadataProducer() (algorithm.MetadataProducer, error)

func (*ConfigFactory) GetScheduledPodLister added in v1.6.0

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 added in v1.6.0

func (f *ConfigFactory) GetSchedulerName() string

func (*ConfigFactory) MakeDefaultErrorFunc added in v1.6.0

func (factory *ConfigFactory) MakeDefaultErrorFunc(backoff *util.PodBackoff, podQueue *cache.FIFO) func(pod *v1.Pod, err error)

func (*ConfigFactory) ResponsibleForPod added in v1.6.0

func (f *ConfigFactory) ResponsibleForPod(pod *v1.Pod) bool

type EquivalencePodFuncFactory added in v1.8.6

type EquivalencePodFuncFactory func(PluginFactoryArgs) algorithm.GetEquivalencePodFunc

EquivalencePodFuncFactory produces a function to get equivalence class for given pod.

type FitPredicateFactory added in v0.13.1

type FitPredicateFactory func(PluginFactoryArgs) algorithm.FitPredicate

A FitPredicateFactory produces a FitPredicate from the given args.

type MetadataProducerFactory added in v1.5.0

type MetadataProducerFactory func(PluginFactoryArgs) algorithm.MetadataProducer

MetadataProducerFactory produces MetadataProducer from the given args. TODO: Rename this to PriorityMetadataProducerFactory.

type PluginFactoryArgs added in v0.13.1

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 PredicateMetadataProducerFactory added in v1.8.0

type PredicateMetadataProducerFactory func(PluginFactoryArgs) algorithm.PredicateMetadataProducer

PredicateMetadataProducerFactory produces PredicateMetadataProducer from the given args.

type PriorityConfigFactory added in v0.13.1

type PriorityConfigFactory struct {
	Function          PriorityFunctionFactory
	MapReduceFunction PriorityFunctionFactory2
	Weight            int
}

A PriorityConfigFactory produces a PriorityConfig from the given function and weight

type PriorityFunctionFactory added in v0.15.0

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 added in v1.5.0

A PriorityFunctionFactory produces map & reduce priority functions from a given args. FIXME: Rename to PriorityFunctionFactory.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL