kubernetesk8s.io/kubernetes/pkg/scheduler Index | Files | Directories

package scheduler

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

Index

Constants

const (
	// SchedulerError is the reason recorded for events when an error occurs during scheduling a pod.
	SchedulerError = "SchedulerError"
)

Functions

func MakeDefaultErrorFunc

func MakeDefaultErrorFunc(client clientset.Interface, podLister corelisters.PodLister, podQueue internalqueue.SchedulingQueue, schedulerCache internalcache.Cache) func(*framework.QueuedPodInfo, error)

MakeDefaultErrorFunc construct a function to handle pod scheduler error

func NewInformerFactory

func NewInformerFactory(cs clientset.Interface, resyncPeriod time.Duration) informers.SharedInformerFactory

NewInformerFactory creates a SharedInformerFactory and initializes a scheduler specific in-place podInformer.

Types

type Binder

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

Binder knows how to write a binding.

type Configurator

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

type FrameworkCapturer func(schedulerapi.KubeSchedulerProfile)

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

type Option

type Option func(*schedulerOptions)

Option configures a Scheduler

func WithBuildFrameworkCapturer

func WithBuildFrameworkCapturer(fc FrameworkCapturer) Option

WithBuildFrameworkCapturer sets a notify function for getting buildFramework details.

func WithComponentConfigVersion

func WithComponentConfigVersion(apiVersion string) Option

WithComponentConfigVersion sets the component config version to the KubeSchedulerConfiguration version used. The string should be the full scheme group/version of the external type we converted from (for example "kubescheduler.config.k8s.io/v1beta2")

func WithExtenders

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

WithExtenders sets extenders for the Scheduler

func WithFrameworkOutOfTreeRegistry

func WithFrameworkOutOfTreeRegistry(registry frameworkruntime.Registry) Option

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

func WithKubeConfig

func WithKubeConfig(cfg *restclient.Config) Option

WithKubeConfig sets the kube config for Scheduler.

func WithLegacyPolicySource

func WithLegacyPolicySource(source *schedulerapi.SchedulerPolicySource) Option

WithLegacyPolicySource sets legacy policy config file source.

func WithParallelism

func WithParallelism(threads int32) Option

WithParallelism sets the parallelism for all scheduler algorithms. Default is 16.

func WithPercentageOfNodesToScore

func WithPercentageOfNodesToScore(percentageOfNodesToScore int32) Option

WithPercentageOfNodesToScore sets percentageOfNodesToScore for Scheduler, the default value is 50

func WithPodInitialBackoffSeconds

func WithPodInitialBackoffSeconds(podInitialBackoffSeconds int64) Option

WithPodInitialBackoffSeconds sets podInitialBackoffSeconds for Scheduler, the default value is 1

func WithPodMaxBackoffSeconds

func WithPodMaxBackoffSeconds(podMaxBackoffSeconds int64) Option

WithPodMaxBackoffSeconds sets podMaxBackoffSeconds for Scheduler, the default value is 10

func WithProfiles

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

	Extenders []framework.Extender

	// 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.QueuedPodInfo

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

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

	// 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

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

New returns a Scheduler

func (*Scheduler) Run

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

Run begins watching and scheduling. It starts scheduling and blocked until the context is done.

Source Files

eventhandlers.go factory.go scheduler.go

Directories

PathSynopsis
pkg/scheduler/apis
pkg/scheduler/apis/config
pkg/scheduler/apis/config/scheme
pkg/scheduler/apis/config/testing
pkg/scheduler/apis/config/testing/defaults
pkg/scheduler/apis/config/v1
pkg/scheduler/apis/config/v1beta1
pkg/scheduler/apis/config/v1beta2
pkg/scheduler/apis/config/validation
pkg/scheduler/core
pkg/scheduler/framework
pkg/scheduler/framework/fake
pkg/scheduler/framework/plugins
pkg/scheduler/framework/plugins/defaultbinder
pkg/scheduler/framework/plugins/defaultpreemption
pkg/scheduler/framework/plugins/examples
pkg/scheduler/framework/plugins/examples/multipoint
pkg/scheduler/framework/plugins/examples/prebind
pkg/scheduler/framework/plugins/examples/stateful
pkg/scheduler/framework/plugins/feature
pkg/scheduler/framework/plugins/helper
pkg/scheduler/framework/plugins/imagelocality
pkg/scheduler/framework/plugins/interpodaffinity
pkg/scheduler/framework/plugins/names
pkg/scheduler/framework/plugins/nodeaffinity
pkg/scheduler/framework/plugins/nodelabelThis plugin has been deprecated and is only configurable through the scheduler policy API and the v1beta1 component config API.
pkg/scheduler/framework/plugins/nodename
pkg/scheduler/framework/plugins/nodeports
pkg/scheduler/framework/plugins/nodepreferavoidpodsThis plugin has been deprecated and is only configurable through the scheduler policy API and the v1beta1 component config API.
pkg/scheduler/framework/plugins/noderesources
pkg/scheduler/framework/plugins/nodeunschedulable
pkg/scheduler/framework/plugins/nodevolumelimits
pkg/scheduler/framework/plugins/podtopologyspread
pkg/scheduler/framework/plugins/queuesort
pkg/scheduler/framework/plugins/selectorspread
pkg/scheduler/framework/plugins/serviceaffinityThis plugin has been deprecated and is only configurable through the scheduler policy API and the v1beta1 component config API.
pkg/scheduler/framework/plugins/tainttoleration
pkg/scheduler/framework/plugins/testing
pkg/scheduler/framework/plugins/volumebinding
pkg/scheduler/framework/plugins/volumerestrictions
pkg/scheduler/framework/plugins/volumezone
pkg/scheduler/framework/runtime
pkg/scheduler/internal
pkg/scheduler/metrics
pkg/scheduler/metrics/resourcesPackage resources provides a metrics collector that reports the resource consumption (requests and limits) of the pods in the cluster as the scheduler and kubelet would interpret it.
pkg/scheduler/profilePackage profile holds the definition of a scheduling Profile.
pkg/scheduler/testing
pkg/scheduler/util
Version
v1.22.0-beta.0
Published
Jun 22, 2021
Platform
js/wasm
Imports
57 packages
Last checked
12 seconds ago

Tools for package owners.