factory

package
v1.5.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2016 License: Apache-2.0 Imports: 26 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"
)
View Source
const (
	SchedulerAnnotationKey = "scheduler.alpha.kubernetes.io/name"
)

Variables

This section is empty.

Functions

func IsFitPredicateRegistered added in v0.8.0

func IsFitPredicateRegistered(name string) bool

This check is useful for testing providers.

func IsPriorityFunctionRegistered added in v0.8.0

func IsPriorityFunctionRegistered(name string) bool

This check is useful for testing providers.

func ListAlgorithmProviders added in v0.16.1

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

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

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.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(equivalenceFunc algorithm.GetEquivalencePodFunc)

func RegisterPredicateMetadataProducerFactory added in v1.5.0

func RegisterPredicateMetadataProducerFactory(factory MetadataProducerFactory)

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

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)

This function should not be used to modify providers. It is publicly visible for testing.

type ConfigFactory

type ConfigFactory struct {
	Client clientset.Interface
	// queue for pods that need scheduling
	PodQueue *cache.FIFO
	// a means to list all known scheduled pods.
	ScheduledPodLister *cache.StoreToPodLister
	// a means to list all known scheduled pods and pods assumed to have been scheduled.
	PodLister algorithm.PodLister
	// a means to list all nodes
	NodeLister *cache.StoreToNodeLister
	// a means to list all PersistentVolumes
	PVLister *cache.StoreToPVFetcher
	// a means to list all PersistentVolumeClaims
	PVCLister *cache.StoreToPersistentVolumeClaimLister
	// a means to list all services
	ServiceLister *cache.StoreToServiceLister
	// a means to list all controllers
	ControllerLister *cache.StoreToReplicationControllerLister
	// a means to list all replicasets
	ReplicaSetLister *cache.StoreToReplicaSetLister

	// Close this to stop all reflectors
	StopEverything chan struct{}

	// SchedulerName of a scheduler is used to select which pods will be
	// processed by this scheduler, based on pods's annotation key:
	// 'scheduler.alpha.kubernetes.io/name'
	SchedulerName string

	// RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling affinity rule
	// corresponding to every RequiredDuringScheduling affinity rule.
	// HardPodAffinitySymmetricWeight represents the weight of implicit PreferredDuringScheduling affinity rule, in the range 0-100.
	HardPodAffinitySymmetricWeight int

	// Indicate the "all topologies" set for empty topologyKey when it's used for PreferredDuringScheduling pod anti-affinity.
	FailureDomains string

	// Equivalence class cache
	EquivalencePodCache *scheduler.EquivalenceCache
	// contains filtered or unexported fields
}

ConfigFactory knows how to fill out a scheduler config with its support functions.

func NewConfigFactory added in v0.7.0

func NewConfigFactory(client clientset.Interface, schedulerName string, hardPodAffinitySymmetricWeight int, failureDomains string) *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.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) GetPredicateMetadataProducer added in v1.5.0

func (f *ConfigFactory) GetPredicateMetadataProducer() (algorithm.MetadataProducer, 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) Run added in v1.3.0

func (f *ConfigFactory) Run()

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.

type PluginFactoryArgs added in v0.13.1

type PluginFactoryArgs struct {
	PodLister                      algorithm.PodLister
	ServiceLister                  algorithm.ServiceLister
	ControllerLister               algorithm.ControllerLister
	ReplicaSetLister               algorithm.ReplicaSetLister
	NodeLister                     algorithm.NodeLister
	NodeInfo                       predicates.NodeInfo
	PVInfo                         predicates.PersistentVolumeInfo
	PVCInfo                        predicates.PersistentVolumeClaimInfo
	HardPodAffinitySymmetricWeight int
	FailureDomains                 []string
}

PluginFactoryArgs are passed to all plugin factory functions.

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