queue

package
v0.0.0-...-dcfb068 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DefaultPodInitialBackoffDuration is the default value for the initial backoff duration
	// for unschedulable pods. To change the default podInitialBackoffDurationSeconds used by the
	// scheduler, update the ComponentConfig value in defaults.go
	DefaultPodInitialBackoffDuration = 1 * time.Second
	// DefaultPodMaxBackoffDuration is the default value for the max backoff duration
	// for unschedulable pods. To change the default podMaxBackoffDurationSeconds used by the
	// scheduler, update the ComponentConfig value in defaults.go
	DefaultPodMaxBackoffDuration = 10 * time.Second
)
View Source
const (
	// PodAdd is the event when a new pod is added to API server.
	PodAdd = "PodAdd"
	// NodeAdd is the event when a new node is added to the cluster.
	NodeAdd = "NodeAdd"
	// ScheduleAttemptFailure is the event when a schedule attempt fails.
	ScheduleAttemptFailure = "ScheduleAttemptFailure"
	// BackoffComplete is the event when a pod finishes backoff.
	BackoffComplete = "BackoffComplete"
	// UnschedulableTimeout is the event when a pod stays in unschedulable for longer than timeout.
	UnschedulableTimeout = "UnschedulableTimeout"
	// AssignedPodAdd is the event when a pod is added that causes pods with matching affinity terms
	// to be more schedulable.
	AssignedPodAdd = "AssignedPodAdd"
	// AssignedPodUpdate is the event when a pod is updated that causes pods with matching affinity
	// terms to be more schedulable.
	AssignedPodUpdate = "AssignedPodUpdate"
	// AssignedPodDelete is the event when a pod is deleted that causes pods with matching affinity
	// terms to be more schedulable.
	AssignedPodDelete = "AssignedPodDelete"
	// PvAdd is the event when a persistent volume is added in the cluster.
	PvAdd = "PvAdd"
	// PvUpdate is the event when a persistent volume is updated in the cluster.
	PvUpdate = "PvUpdate"
	// PvcAdd is the event when a persistent volume claim is added in the cluster.
	PvcAdd = "PvcAdd"
	// PvcUpdate is the event when a persistent volume claim is updated in the cluster.
	PvcUpdate = "PvcUpdate"
	// StorageClassAdd is the event when a StorageClass is added in the cluster.
	StorageClassAdd = "StorageClassAdd"
	// ServiceAdd is the event when a service is added in the cluster.
	ServiceAdd = "ServiceAdd"
	// ServiceUpdate is the event when a service is updated in the cluster.
	ServiceUpdate = "ServiceUpdate"
	// ServiceDelete is the event when a service is deleted in the cluster.
	ServiceDelete = "ServiceDelete"
	// CSINodeAdd is the event when a CSI node is added in the cluster.
	CSINodeAdd = "CSINodeAdd"
	// CSINodeUpdate is the event when a CSI node is updated in the cluster.
	CSINodeUpdate = "CSINodeUpdate"
	// NodeSpecUnschedulableChange is the event when unschedulable node spec is changed.
	NodeSpecUnschedulableChange = "NodeSpecUnschedulableChange"
	// NodeAllocatableChange is the event when node allocatable is changed.
	NodeAllocatableChange = "NodeAllocatableChange"
	// NodeLabelChange is the event when node label is changed.
	NodeLabelChange = "NodeLabelChange"
	// NodeTaintChange is the event when node taint is changed.
	NodeTaintChange = "NodeTaintChange"
	// NodeConditionChange is the event when node condition is changed.
	NodeConditionChange = "NodeConditionChange"
)

Events that trigger scheduler queue to change.

Variables

This section is empty.

Functions

func MakeNextUnitFunc

func MakeNextUnitFunc(queue BinderQueue) func() *framework.QueuedUnitInfo

MakeNextPodFunc returns a function to retrieve the next pod from a given active queue

Types

type BinderQueue

type BinderQueue interface {
	// Add adds a pod which has a node assumed from scheduler
	// and need to resolve the conflict
	Add(pod *v1.Pod) error
	Update(oldPod, newPod *v1.Pod) error
	Delete(pod *v1.Pod) error

	// Pop removes the pod for resolving same node constraints
	Pop() (*framework.QueuedUnitInfo, error)
	AddUnitPreemptor(*framework.QueuedUnitInfo)
	PendingPods() []*v1.Pod

	// Run starts the goroutines managing the queue.
	Run()
	Close()
	GetUnitStatus(key string) binderutils.UnitStatus
	SetUnitStatus(string, binderutils.UnitStatus)
	DeleteUnitStatus(key string)

	// ActiveWaitingUnit move unit from waitingQ to readyQ
	ActiveWaitingUnit(unitKey string)
}

BinderQueue watches on pod which need to resolve conflict for same node, cross node, preemption and gang scheduling

func NewBinderQueue

func NewBinderQueue(lessFn framework.UnitLessFunc,
	pgLister v1alpha1.PodGroupLister,
	pcLister schev1.PriorityClassLister,
	opts ...Option,
) BinderQueue

NewBinderQueue initializes a priority queue as a new binder queue.

type Option

type Option func(*priorityQueueOptions)

Option configures a PriorityQueue

func WithClock

func WithClock(clock util.Clock) Option

WithClock sets clock for PriorityQueue, the default clock is util.RealClock.

func WithPodInitialBackoffDuration

func WithPodInitialBackoffDuration(duration time.Duration) Option

WithPodInitialBackoffDuration sets pod initial backoff duration for PriorityQueue.

func WithPodMaxBackoffDuration

func WithPodMaxBackoffDuration(duration time.Duration) Option

WithPodMaxBackoffDuration sets pod max backoff duration for PriorityQueue.

type PriorityQueue

type PriorityQueue struct {
	// contains filtered or unexported fields
}

PriorityQueue provides the priority queues for resolving scheduling conflicts

func NewPriorityQueue

func NewPriorityQueue(
	lessFn framework.UnitLessFunc,
	pgLister v1alpha1.PodGroupLister,
	pcLister schev1.PriorityClassLister,
	opts ...Option,
) *PriorityQueue

func (*PriorityQueue) ActiveWaitingUnit

func (p *PriorityQueue) ActiveWaitingUnit(unitKey string)

ActiveWaitingUnit move unit from waitingQ to readyQ

func (*PriorityQueue) Add

func (p *PriorityQueue) Add(pod *v1.Pod) error

Add adds pod with assumed node from the scheduler into respective queue based on its annotations

func (*PriorityQueue) AddUnitPreemptor

func (p *PriorityQueue) AddUnitPreemptor(unit *framework.QueuedUnitInfo)

func (*PriorityQueue) Close

func (p *PriorityQueue) Close()

Close closes the priority queue

func (*PriorityQueue) Delete

func (p *PriorityQueue) Delete(pod *v1.Pod) error

Delete deletes the pod from its respective queue. It assumes that pod is only present in one queue

func (*PriorityQueue) DeleteUnitStatus

func (p *PriorityQueue) DeleteUnitStatus(key string)

func (*PriorityQueue) GetUnitStatus

func (p *PriorityQueue) GetUnitStatus(key string) binderutils.UnitStatus

func (*PriorityQueue) PendingPods

func (p *PriorityQueue) PendingPods() []*v1.Pod

PendingPods returns all the pending pods in the queue. This function is used for debugging purposes in the scheduler cache dumper and comparer.

func (*PriorityQueue) Pop

Pop removes the head of the active queue and returns it. It blocks if the waitingUnitQ is empty and waits until a new item is added to the queue. It increments scheduling cycle when a pod is popped.

func (*PriorityQueue) Run

func (p *PriorityQueue) Run()

Run starts the goroutine to pump from podBackoffQ to waitingUnitQ

func (*PriorityQueue) SetUnitStatus

func (p *PriorityQueue) SetUnitStatus(key string, status binderutils.UnitStatus)

func (*PriorityQueue) Update

func (p *PriorityQueue) Update(oldPod, newPod *v1.Pod) error

Update the pod into respective queue, if not present then it is added to respective queue

Jump to

Keyboard shortcuts

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