factory

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2015 License: Apache-2.0 Imports: 13 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

Functions

func IsFitPredicateRegistered added in v0.2.1

func IsFitPredicateRegistered(name string) bool

IsFitPredicateRegistered check is useful for testing providers.

func IsPriorityFunctionRegistered added in v0.2.1

func IsPriorityFunctionRegistered(name string) bool

IsPriorityFunctionRegistered check is useful for testing providers.

func RegisterAlgorithmProvider added in v0.2.1

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

RegisterAlgorithmProvider registers a new algorithm provider with the algorithm registry. This should be called from the init function in a provider plugin.

func RegisterFitPredicate added in v0.2.1

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

func RegisterPriorityFunction(name string, function algorithm.PriorityFunction, weight int) string

RegisterFitPredicate registers a priority function with the algorithm registry. Returns the name, with which the function was registered.

func SetPriorityFunctionWeight added in v0.2.1

func SetPriorityFunctionWeight(name string, weight int)

SetPriorityFunctionWeight sets the weight of an already registered priority function.

Types

type AlgorithmProviderConfig added in v0.2.1

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

func GetAlgorithmProvider added in v0.2.1

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 {
	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.2.1

func NewConfigFactory(client *client.Client) *ConfigFactory

NewConfigFactory initializes the factory.

func (*ConfigFactory) Create

func (f *ConfigFactory) Create() (*scheduler.Config, error)

Create creates a scheduler with the default algorithm provider.

func (*ConfigFactory) CreateFromKeys added in v0.2.1

func (f *ConfigFactory) CreateFromKeys(predicateKeys, priorityKeys util.StringSet) (*scheduler.Config, error)

CreateFromKeys creates a scheduler from a set of registered fit predicate keys and priority keys.

func (*ConfigFactory) CreateFromProvider added in v0.2.1

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

CreateFromProvider creates a scheduler from the name of a registered algorithm provider.

Jump to

Keyboard shortcuts

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