scheduler

package
v1.19.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2020 License: Apache-2.0 Imports: 47 Imported by: 114

Documentation

Index

Constants

View Source
const (
	// BindTimeoutSeconds defines the default bind timeout
	BindTimeoutSeconds = 100
	// SchedulerError is the reason recorded for events when an error occurs during scheduling a pod.
	SchedulerError = "SchedulerError"
)

Variables

This section is empty.

Functions

func GetPodDisruptionBudgetLister added in v1.17.0

func GetPodDisruptionBudgetLister(informerFactory informers.SharedInformerFactory) policylisters.PodDisruptionBudgetLister

GetPodDisruptionBudgetLister returns pdb lister from the given informer factory. Returns nil if PodDisruptionBudget feature is disabled.

func MakeDefaultErrorFunc added in v1.17.0

func MakeDefaultErrorFunc(client clientset.Interface, podQueue internalqueue.SchedulingQueue, schedulerCache internalcache.Cache) func(*framework.PodInfo, error)

MakeDefaultErrorFunc construct a function to handle pod scheduler error

func NewPodInformer added in v1.17.0

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

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

Types

type Binder added in v1.10.0

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

Binder knows how to write a binding.

type Configurator added in v1.10.0

type Configurator struct {

	// Close this to stop all reflectors
	StopEverything <-chan struct{}
	// contains filtered or unexported fields
}

Configurator defines I/O, caching, and other functionality needed to construct a new scheduler.

type FrameworkCapturer added in v1.19.0

type FrameworkCapturer func(schedulerapi.KubeSchedulerProfile)

FrameworkCapturer is used for registering a notify function in building framework.

type Option added in v1.13.0

type Option func(*schedulerOptions)

Option configures a Scheduler

func WithAlgorithmSource added in v1.17.0

func WithAlgorithmSource(source schedulerapi.SchedulerAlgorithmSource) Option

WithAlgorithmSource sets schedulerAlgorithmSource for Scheduler, the default is a source with DefaultProvider.

func WithBindTimeoutSeconds added in v1.13.0

func WithBindTimeoutSeconds(bindTimeoutSeconds int64) Option

WithBindTimeoutSeconds sets bindTimeoutSeconds for Scheduler, the default value is 100

func WithBuildFrameworkCapturer added in v1.19.0

func WithBuildFrameworkCapturer(fc FrameworkCapturer) Option

WithBuildFrameworkCapturer sets a notify function for getting buildFramework details.

func WithExtenders added in v1.18.0

func WithExtenders(e ...schedulerapi.Extender) Option

WithExtenders sets extenders for the Scheduler

func WithFrameworkOutOfTreeRegistry added in v1.17.0

func WithFrameworkOutOfTreeRegistry(registry framework.Registry) Option

WithFrameworkOutOfTreeRegistry sets the registry for out-of-tree plugins. Those plugins will be appended to the default registry.

func WithPercentageOfNodesToScore added in v1.13.0

func WithPercentageOfNodesToScore(percentageOfNodesToScore int32) Option

WithPercentageOfNodesToScore sets percentageOfNodesToScore for Scheduler, the default value is 50

func WithPodInitialBackoffSeconds added in v1.17.0

func WithPodInitialBackoffSeconds(podInitialBackoffSeconds int64) Option

WithPodInitialBackoffSeconds sets podInitialBackoffSeconds for Scheduler, the default value is 1

func WithPodMaxBackoffSeconds added in v1.17.0

func WithPodMaxBackoffSeconds(podMaxBackoffSeconds int64) Option

WithPodMaxBackoffSeconds sets podMaxBackoffSeconds for Scheduler, the default value is 10

func WithPreemptionDisabled added in v1.13.0

func WithPreemptionDisabled(disablePreemption bool) Option

WithPreemptionDisabled sets disablePreemption for Scheduler, the default value is false

func WithProfiles added in v1.18.0

func WithProfiles(p ...schedulerapi.KubeSchedulerProfile) Option

WithProfiles sets profiles for Scheduler. By default, there is one profile with the name "default-scheduler".

type Scheduler

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

	Algorithm core.ScheduleAlgorithm

	// 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() *framework.PodInfo

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

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

	// VolumeBinder handles PVC/PV binding for the pod.
	VolumeBinder scheduling.SchedulerVolumeBinder

	// Disable pod preemption or not.
	DisablePreemption bool

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

	// Profiles are the scheduling profiles.
	Profiles profile.Map
	// contains filtered or unexported fields
}

Scheduler watches for new unscheduled pods. It attempts to find nodes that they fit on and writes bindings back to the api server.

func New added in v1.13.0

func New(client clientset.Interface,
	informerFactory informers.SharedInformerFactory,
	podInformer coreinformers.PodInformer,
	recorderFactory profile.RecorderFactory,
	stopCh <-chan struct{},
	opts ...Option) (*Scheduler, error)

New returns a Scheduler

func (*Scheduler) Cache added in v1.12.0

func (sched *Scheduler) Cache() internalcache.Cache

Cache returns the cache in scheduler for test to check the data in scheduler.

func (*Scheduler) Run added in v1.10.0

func (sched *Scheduler) Run(ctx context.Context)

Run begins watching and scheduling. It waits for cache to be synced, then starts scheduling and blocked until the context is done.

Jump to

Keyboard shortcuts

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