scheduler

package
v0.0.0-...-20093e1 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 44 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoNodesAvailable = fmt.Errorf("no nodes available to schedule pods")

ErrNoNodesAvailable is used to describe the error that no nodes available to schedule pods.

Functions

func NewInformerFactory

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

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

func Send

func Send(ctx context.Context, endpoint, pod, node, event string) error

Send returns data to the sniffer

Types

type FailureHandlerFn

type FailureHandlerFn func(ctx context.Context, fwk framework.Framework, podInfo *framework.QueuedPodInfo, status *framework.Status, nominatingInfo *framework.NominatingInfo, start time.Time)

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/v1")

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 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 of 0 will use an adaptive percentage: 50 - (num of nodes)/125.

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 WithPodMaxInUnschedulablePodsDuration

func WithPodMaxInUnschedulablePodsDuration(duration time.Duration) Option

WithPodMaxInUnschedulablePodsDuration sets podMaxInUnschedulablePodsDuration for PriorityQueue.

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 ScheduleResult

type ScheduleResult struct {
	// Name of the selected node.
	SuggestedHost string
	// The number of nodes the scheduler evaluated the pod against in the filtering
	// phase and beyond.
	// Note that it contains the number of nodes that filtered out by PreFilterResult.
	EvaluatedNodes int
	// The number of nodes out of the evaluated ones that fit the pod.
	FeasibleNodes int
	// contains filtered or unexported fields
}

ScheduleResult represents the result of scheduling a pod.

type Scheduler

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

	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(logger klog.Logger) (*framework.QueuedPodInfo, error)

	// FailureHandler is called upon a scheduling failure.
	FailureHandler FailureHandlerFn

	// SchedulePod tries to schedule the given pod to one of the nodes in the node list.
	// Return a struct of ScheduleResult with the name of suggested host on success,
	// otherwise will return a FitError with reasons.
	SchedulePod func(ctx context.Context, fwk framework.Framework, state *framework.CycleState, pod *v1.Pod) (ScheduleResult, 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(ctx context.Context,
	client clientset.Interface,
	informerFactory informers.SharedInformerFactory,
	dynInformerFactory dynamicinformer.DynamicSharedInformerFactory,
	recorderFactory profile.RecorderFactory,
	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.

func (*Scheduler) ScheduleOne

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

ScheduleOne does the entire scheduling workflow for a single pod. It is serialized on the scheduling algorithm's host fitting.

Jump to

Keyboard shortcuts

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