kubernetes: k8s.io/kubernetes/pkg/scheduler/factory Index | Files

package factory

import "k8s.io/kubernetes/pkg/scheduler/factory"

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

Index

Package Files

factory.go plugins.go

Constants

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

func InsertPredicateKeyToAlgoProvider Uses

func InsertPredicateKeyToAlgoProvider(providerName, key string) error

InsertPredicateKeyToAlgoProvider insert a fit predicate key to algorithmProvider.

func InsertPredicateKeyToAlgorithmProviderMap Uses

func InsertPredicateKeyToAlgorithmProviderMap(key string)

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

func InsertPriorityKeyToAlgorithmProviderMap Uses

func InsertPriorityKeyToAlgorithmProviderMap(key string)

InsertPriorityKeyToAlgorithmProviderMap inserts a priority function to all algorithmProviders which are in algorithmProviderMap.

func IsFitPredicateRegistered Uses

func IsFitPredicateRegistered(name string) bool

IsFitPredicateRegistered is useful for testing providers.

func IsPriorityFunctionRegistered Uses

func IsPriorityFunctionRegistered(name string) bool

IsPriorityFunctionRegistered is useful for testing providers.

func ListAlgorithmProviders Uses

func ListAlgorithmProviders() string

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

func ListRegisteredFitPredicates Uses

func ListRegisteredFitPredicates() []string

ListRegisteredFitPredicates returns the registered fit predicates.

func ListRegisteredPriorityFunctions Uses

func ListRegisteredPriorityFunctions() []string

ListRegisteredPriorityFunctions returns the registered priority functions.

func MakeDefaultErrorFunc Uses

func MakeDefaultErrorFunc(client clientset.Interface, podQueue internalqueue.SchedulingQueue, schedulerCache internalcache.Cache, stopEverything <-chan struct{}) func(pod *v1.Pod, err error)

MakeDefaultErrorFunc construct a function to handle pod scheduler error

func NewPodInformer Uses

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

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

func RegisterAlgorithmProvider Uses

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 Uses

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 Uses

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 Uses

func RegisterFitPredicate(name string, predicate predicates.FitPredicate) string

RegisterFitPredicate registers a fit predicate with the algorithm registry. Returns the name with which the predicate was registered.

func RegisterFitPredicateFactory Uses

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 RegisterMandatoryFitPredicate Uses

func RegisterMandatoryFitPredicate(name string, predicate predicates.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 Uses

func RegisterPredicateMetadataProducerFactory(factory PredicateMetadataProducerFactory)

RegisterPredicateMetadataProducerFactory registers a PredicateMetadataProducerFactory.

func RegisterPriorityConfigFactory Uses

func RegisterPriorityConfigFactory(name string, pcf PriorityConfigFactory) string

RegisterPriorityConfigFactory registers a priority config factory with its name.

func RegisterPriorityFunction Uses

func RegisterPriorityFunction(name string, function priorities.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 RegisterPriorityMapReduceFunction Uses

func RegisterPriorityMapReduceFunction(
    name string,
    mapFunction priorities.PriorityMapFunction,
    reduceFunction priorities.PriorityReduceFunction,
    weight int) string

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

func RegisterPriorityMetadataProducerFactory Uses

func RegisterPriorityMetadataProducerFactory(factory PriorityMetadataProducerFactory)

RegisterPriorityMetadataProducerFactory registers a PriorityMetadataProducerFactory.

func RemoveFitPredicate Uses

func RemoveFitPredicate(name string)

RemoveFitPredicate removes a fit predicate from factory.

func RemovePredicateKeyFromAlgoProvider Uses

func RemovePredicateKeyFromAlgoProvider(providerName, key string) error

RemovePredicateKeyFromAlgoProvider removes a fit predicate key from algorithmProvider.

func RemovePredicateKeyFromAlgorithmProviderMap Uses

func RemovePredicateKeyFromAlgorithmProviderMap(key string)

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

type AlgorithmProviderConfig Uses

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

AlgorithmProviderConfig is used to store the configuration of algorithm providers.

func GetAlgorithmProvider Uses

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

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

type Binder Uses

type Binder interface {
    Bind(binding *v1.Binding) error
}

Binder knows how to write a binding.

type Config Uses

type Config struct {
    // It is expected that changes made via SchedulerCache will be observed
    // by NodeLister and Algorithm.
    SchedulerCache internalcache.Cache

    NodeLister algorithm.NodeLister
    Algorithm  core.ScheduleAlgorithm
    GetBinder  func(pod *v1.Pod) Binder
    // PodConditionUpdater is used only in case of scheduling errors. If we succeed
    // with scheduling, PodScheduled condition will be updated in apiserver in /bind
    // handler so that binding and setting PodCondition it is atomic.
    PodConditionUpdater PodConditionUpdater
    // PodPreemptor is used to evict pods and update 'NominatedNode' field of
    // the preemptor pod.
    PodPreemptor PodPreemptor
    // Framework runs scheduler plugins at configured extension points.
    Framework framework.Framework

    // NextPod should be a function that blocks until the next pod
    // is available. We don't use a channel for this, because scheduling
    // a pod may take some amount of time and we don't want pods to get
    // stale while they sit in a channel.
    NextPod func() *v1.Pod

    // WaitForCacheSync waits for scheduler cache to populate.
    // It returns true if it was successful, false if the controller should shutdown.
    WaitForCacheSync func() bool

    // Error is called if there is an error. It is passed the pod in
    // question, and the error
    Error func(*v1.Pod, error)

    // Recorder is the EventRecorder to use
    Recorder events.EventRecorder

    // Close this to shut down the scheduler.
    StopEverything <-chan struct{}

    // VolumeBinder handles PVC/PV binding for the pod.
    VolumeBinder *volumebinder.VolumeBinder

    // Disable pod preemption or not.
    DisablePreemption bool

    // SchedulingQueue holds pods to be scheduled
    SchedulingQueue internalqueue.SchedulingQueue
}

Config is an implementation of the Scheduler's configured input data. TODO over time we should make this struct a hidden implementation detail of the scheduler.

type ConfigFactoryArgs Uses

type ConfigFactoryArgs struct {
    SchedulerName                  string
    Client                         clientset.Interface
    NodeInformer                   coreinformers.NodeInformer
    PodInformer                    coreinformers.PodInformer
    PvInformer                     coreinformers.PersistentVolumeInformer
    PvcInformer                    coreinformers.PersistentVolumeClaimInformer
    ReplicationControllerInformer  coreinformers.ReplicationControllerInformer
    ReplicaSetInformer             appsinformers.ReplicaSetInformer
    StatefulSetInformer            appsinformers.StatefulSetInformer
    ServiceInformer                coreinformers.ServiceInformer
    PdbInformer                    policyinformers.PodDisruptionBudgetInformer
    StorageClassInformer           storageinformersv1.StorageClassInformer
    CSINodeInformer                storageinformersv1beta1.CSINodeInformer
    HardPodAffinitySymmetricWeight int32
    DisablePreemption              bool
    PercentageOfNodesToScore       int32
    BindTimeoutSeconds             int64
    StopCh                         <-chan struct{}
    Registry                       framework.Registry
    Plugins                        *config.Plugins
    PluginConfig                   []config.PluginConfig
}

ConfigFactoryArgs is a set arguments passed to NewConfigFactory.

type Configurator Uses

type Configurator interface {
    // Exposed for testing
    GetHardPodAffinitySymmetricWeight() int32

    // Predicate related accessors to be exposed for use by k8s.io/autoscaler/cluster-autoscaler
    GetPredicateMetadataProducer() (predicates.PredicateMetadataProducer, error)
    GetPredicates(predicateKeys sets.String) (map[string]predicates.FitPredicate, error)

    // Needs to be exposed for things like integration tests where we want to make fake nodes.
    GetNodeLister() corelisters.NodeLister
    // Exposed for testing
    GetClient() clientset.Interface
    // Exposed for testing
    GetScheduledPodLister() corelisters.PodLister

    Create() (*Config, error)
    CreateFromProvider(providerName string) (*Config, error)
    CreateFromConfig(policy schedulerapi.Policy) (*Config, error)
    CreateFromKeys(predicateKeys, priorityKeys sets.String, extenders []algorithm.SchedulerExtender) (*Config, error)
}

Configurator defines I/O, caching, and other functionality needed to construct a new scheduler. An implementation of this can be seen in factory.go.

func NewConfigFactory Uses

func NewConfigFactory(args *ConfigFactoryArgs) Configurator

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

type FitPredicateFactory Uses

type FitPredicateFactory func(PluginFactoryArgs) predicates.FitPredicate

FitPredicateFactory produces a FitPredicate from the given args.

type PluginFactoryArgs Uses

type PluginFactoryArgs struct {
    PodLister                      algorithm.PodLister
    ServiceLister                  algorithm.ServiceLister
    ControllerLister               algorithm.ControllerLister
    ReplicaSetLister               algorithm.ReplicaSetLister
    StatefulSetLister              algorithm.StatefulSetLister
    NodeLister                     algorithm.NodeLister
    PDBLister                      algorithm.PDBLister
    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 PodConditionUpdater Uses

type PodConditionUpdater interface {
    Update(pod *v1.Pod, podCondition *v1.PodCondition) error
}

PodConditionUpdater updates the condition of a pod based on the passed PodCondition

type PodPreemptor Uses

type PodPreemptor interface {
    GetUpdatedPod(pod *v1.Pod) (*v1.Pod, error)
    DeletePod(pod *v1.Pod) error
    SetNominatedNodeName(pod *v1.Pod, nominatedNode string) error
    RemoveNominatedNodeName(pod *v1.Pod) error
}

PodPreemptor has methods needed to delete a pod and to update 'NominatedPod' field of the preemptor pod.

type PredicateMetadataProducerFactory Uses

type PredicateMetadataProducerFactory func(PluginFactoryArgs) predicates.PredicateMetadataProducer

PredicateMetadataProducerFactory produces PredicateMetadataProducer from the given args.

type PriorityConfigFactory Uses

type PriorityConfigFactory struct {
    Function          PriorityFunctionFactory
    MapReduceFunction PriorityFunctionFactory2
    Weight            int
}

PriorityConfigFactory produces a PriorityConfig from the given function and weight

type PriorityFunctionFactory Uses

type PriorityFunctionFactory func(PluginFactoryArgs) priorities.PriorityFunction

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

type PriorityFunctionFactory2 Uses

type PriorityFunctionFactory2 func(PluginFactoryArgs) (priorities.PriorityMapFunction, priorities.PriorityReduceFunction)

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

type PriorityMetadataProducerFactory Uses

type PriorityMetadataProducerFactory func(PluginFactoryArgs) priorities.PriorityMetadataProducer

PriorityMetadataProducerFactory produces PriorityMetadataProducer from the given args.

Package factory imports 45 packages (graph) and is imported by 67 packages. Updated 2019-07-18. Refresh now. Tools for package owners.