factory

package
v1.1.0-alpha.0....-00e3442 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2015 License: Apache-2.0 Imports: 20 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

func IsFitPredicateRegistered(name string) bool

This check is useful for testing providers.

func IsPriorityFunctionRegistered

func IsPriorityFunctionRegistered(name string) bool

This check is useful for testing providers.

func ListAlgorithmProviders

func ListAlgorithmProviders() string

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

func RegisterAlgorithmProvider

func RegisterAlgorithmProvider(name string, predicateKeys, priorityKeys util.StringSet) string

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

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

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 RegisterPriorityConfigFactory

func RegisterPriorityConfigFactory(name string, pcf PriorityConfigFactory) string

func RegisterPriorityFunction

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.

Types

type AlgorithmProviderConfig

type AlgorithmProviderConfig struct {
	FitPredicateKeys     util.StringSet
	PriorityFunctionKeys util.StringSet
}

func GetAlgorithmProvider

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 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 minions
	NodeLister *cache.StoreToNodeLister
	// a means to list all services
	ServiceLister *cache.StoreToServiceLister
	// a means to list all controllers
	ControllerLister *cache.StoreToReplicationControllerLister

	// Close this to stop all reflectors
	StopEverything chan struct{}
	// Rate limiter for binding pods
	BindPodsRateLimiter util.RateLimiter
	// contains filtered or unexported fields
}

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

func NewConfigFactory

func NewConfigFactory(client *client.Client, rateLimiter util.RateLimiter) *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

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 util.StringSet) (*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.

type FitPredicateFactory

type FitPredicateFactory func(PluginFactoryArgs) algorithm.FitPredicate

A FitPredicateFactory produces a FitPredicate from the given args.

type PluginFactoryArgs

PluginFactoryArgs are passed to all plugin factory functions.

type PriorityConfigFactory

type PriorityConfigFactory struct {
	Function PriorityFunctionFactory
	Weight   int
}

A PriorityConfigFactory produces a PriorityConfig from the given function and weight

type PriorityFunctionFactory

type PriorityFunctionFactory func(PluginFactoryArgs) algorithm.PriorityFunction

A PriorityFunctionFactory produces a PriorityConfig from the given args.

Jump to

Keyboard shortcuts

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