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

package scheduler

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

Index

Types

type Binder

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

Binder knows how to write a binding.

type Config

type Config struct {
	// It is expected that changes made via SchedulerCache will be observed
	// by NodeLister and Algorithm.
	SchedulerCache schedulercache.Cache
	NodeLister     algorithm.NodeLister
	Algorithm      algorithm.ScheduleAlgorithm
	Binder         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

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

	// 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 record.EventRecorder

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

TODO over time we should make this struct a hidden implementation detail of the scheduler.

type Configurator

type Configurator interface {
	GetPriorityFunctionConfigs(priorityKeys sets.String) ([]algorithm.PriorityConfig, error)
	GetPriorityMetadataProducer() (algorithm.MetadataProducer, error)
	GetPredicateMetadataProducer() (algorithm.MetadataProducer, error)
	GetPredicates(predicateKeys sets.String) (map[string]algorithm.FitPredicate, error)
	GetHardPodAffinitySymmetricWeight() int
	GetSchedulerName() string
	MakeDefaultErrorFunc(backoff *util.PodBackoff, podQueue *cache.FIFO) func(pod *v1.Pod, err error)

	// Probably doesn't need to be public.  But exposed for now in case.
	ResponsibleForPod(pod *v1.Pod) bool

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

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

These are the functions which need to be provided in order to build a Scheduler configuration. An implementation of this can be seen in factory.go.

type PodConditionUpdater

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

type Scheduler

type Scheduler struct {
	// 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(c *Config) *Scheduler

New returns a new scheduler. TODO replace this with NewFromConfigurator.

func NewFromConfigurator

func NewFromConfigurator(c Configurator, modifiers ...func(c *Config)) (*Scheduler, error)

NewFromConfigurator returns a new scheduler that is created entirely by the Configurator. Assumes Create() is implemented. Supports intermediate Config mutation for now if you provide modifier functions which will run after Config is created.

func (*Scheduler) Run

func (s *Scheduler) Run()

Run begins watching and scheduling. It starts a goroutine and returns immediately.

func (*Scheduler) StopEverything

func (sched *Scheduler) StopEverything()

Source Files

scheduler.go

Directories

PathSynopsis
plugin/pkg/scheduler/algorithmPackage scheduler contains a generic Scheduler interface and several implementations.
plugin/pkg/scheduler/algorithm/predicates
plugin/pkg/scheduler/algorithm/priorities
plugin/pkg/scheduler/algorithm/priorities/util
plugin/pkg/scheduler/algorithmproviderThis package is used to register algorithm provider plugins.
plugin/pkg/scheduler/algorithmprovider/defaultsThis is the default algorithm provider for the scheduler.
plugin/pkg/scheduler/api
plugin/pkg/scheduler/api/latest
plugin/pkg/scheduler/api/v1
plugin/pkg/scheduler/api/validation
plugin/pkg/scheduler/core
plugin/pkg/scheduler/factoryPackage factory can set up a scheduler.
plugin/pkg/scheduler/metrics
plugin/pkg/scheduler/schedulercache
plugin/pkg/scheduler/testing
plugin/pkg/scheduler/util
Version
v1.6.0
Published
Mar 28, 2017
Platform
js/wasm
Imports
15 packages
Last checked
6 minutes ago

Tools for package owners.