factory

package
v0.0.0-...-4f90778 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: Apache-2.0 Imports: 46 Imported by: 0

Documentation

Overview

Package factory can set up a scheduler. This code is here instead of cmd/scheduler for both testability and reuse.

Index

Constants

View Source
const (
	// DefaultProvider defines the default algorithm provider name.
	DefaultProvider = "DefaultProvider"
)

Variables

This section is empty.

Functions

func InsertPredicateKeyToAlgoProvider

func InsertPredicateKeyToAlgoProvider(providerName, key string) error

InsertPredicateKeyToAlgoProvider insert a fit predicate key to algorithmProvider.

func InsertPredicateKeyToAlgorithmProviderMap

func InsertPredicateKeyToAlgorithmProviderMap(key string)

InsertPredicateKeyToAlgorithmProviderMap insert a fit predicate key to all algorithmProviders which in algorithmProviderMap.

func IsFitPredicateRegistered

func IsFitPredicateRegistered(name string) bool

IsFitPredicateRegistered is useful for testing providers.

func IsPriorityFunctionRegistered

func IsPriorityFunctionRegistered(name string) bool

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

ListRegisteredFitPredicates returns the registered fit predicates.

func ListRegisteredPriorityFunctions

func ListRegisteredPriorityFunctions() []string

ListRegisteredPriorityFunctions returns the registered priority functions.

func NewConfigFactory

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,
	pdbInformer policyinformers.PodDisruptionBudgetInformer,
	storageClassInformer storageinformers.StorageClassInformer,
	hardPodAffinitySymmetricWeight int32,
	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

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

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

func RegisterAlgorithmProvider

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

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(equivalenceFuncFactory EquivalencePodFuncFactory)

RegisterGetEquivalencePodFunction registers equivalenceFuncFactory to produce equivalence class for given pod.

func RegisterMandatoryFitPredicate

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

func RegisterPredicateMetadataProducerFactory(factory PredicateMetadataProducerFactory)

RegisterPredicateMetadataProducerFactory registers a PredicateMetadataProducerFactory.

func RegisterPriorityConfigFactory

func RegisterPriorityConfigFactory(name string, pcf PriorityConfigFactory) string

RegisterPriorityConfigFactory registers a priority config factory with its name.

func RegisterPriorityFunction

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

RegisterPriorityFunction registers a priority function with the algorithm registry. Returns the name, with which the function was registered. DEPRECATED Use Map-Reduce pattern for priority functions.

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 PriorityMetadataProducerFactory)

RegisterPriorityMetadataProducerFactory registers a PriorityMetadataProducerFactory.

func RemoveFitPredicate

func RemoveFitPredicate(name string)

RemoveFitPredicate removes a fit predicate from factory.

func RemovePredicateKeyFromAlgoProvider

func RemovePredicateKeyFromAlgoProvider(providerName, key string) error

RemovePredicateKeyFromAlgoProvider removes a fit predicate key from algorithmProvider.

func RemovePredicateKeyFromAlgorithmProviderMap

func RemovePredicateKeyFromAlgorithmProviderMap(key string)

RemovePredicateKeyFromAlgorithmProviderMap removes a fit predicate key from all algorithmProviders which in algorithmProviderMap.

Types

type AlgorithmProviderConfig

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

AlgorithmProviderConfig is used to store the configuration of algorithm providers.

func GetAlgorithmProvider

func GetAlgorithmProvider(name string) (*AlgorithmProviderConfig, error)

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

type EquivalencePodFuncFactory

type EquivalencePodFuncFactory func(PluginFactoryArgs) algorithm.GetEquivalencePodFunc

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

type FitPredicateFactory

type FitPredicateFactory func(PluginFactoryArgs) algorithm.FitPredicate

FitPredicateFactory produces a FitPredicate 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
	StorageClassInfo               predicates.StorageClassInfo
	VolumeBinder                   *volumebinder.VolumeBinder
	HardPodAffinitySymmetricWeight int32
}

PluginFactoryArgs are passed to all plugin factory functions.

type PredicateMetadataProducerFactory

type PredicateMetadataProducerFactory func(PluginFactoryArgs) algorithm.PredicateMetadataProducer

PredicateMetadataProducerFactory produces PredicateMetadataProducer from the given args.

type PriorityConfigFactory

type PriorityConfigFactory struct {
	Function          PriorityFunctionFactory
	MapReduceFunction PriorityFunctionFactory2
	Weight            int
}

PriorityConfigFactory produces a PriorityConfig from the given function and weight

type PriorityFunctionFactory

type PriorityFunctionFactory func(PluginFactoryArgs) algorithm.PriorityFunction

PriorityFunctionFactory produces a PriorityConfig from the given args. DEPRECATED Use Map-Reduce pattern for priority functions.

type PriorityFunctionFactory2

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

type PriorityMetadataProducerFactory

type PriorityMetadataProducerFactory func(PluginFactoryArgs) algorithm.PriorityMetadataProducer

PriorityMetadataProducerFactory produces PriorityMetadataProducer from the given args.

Jump to

Keyboard shortcuts

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