Documentation ¶
Index ¶
- Variables
- func DefaultComparator(pod0, pod1 *v1.Pod) bool
- type Compare
- type ErrNoMatchingPod
- type FIFOQueue
- func (fifo *FIFOQueue) Delete(podNamespace, podName string) bool
- func (fifo *FIFOQueue) Front() (*v1.Pod, error)
- func (fifo *FIFOQueue) Metrics() Metrics
- func (fifo *FIFOQueue) NominatedPods(nodeName string) []*v1.Pod
- func (fifo *FIFOQueue) Pop() (*v1.Pod, error)
- func (fifo *FIFOQueue) Push(pod *v1.Pod) error
- func (fifo *FIFOQueue) RemoveNominatedNode(pod *v1.Pod) error
- func (fifo *FIFOQueue) Update(podNamespace, podName string, newPod *v1.Pod) error
- func (fifo *FIFOQueue) UpdateNominatedNode(pod *v1.Pod, nodeName string) error
- type Metrics
- type PodQueue
- type PriorityQueue
- func (pq *PriorityQueue) Delete(podNamespace, podName string) bool
- func (pq *PriorityQueue) Front() (*v1.Pod, error)
- func (pq *PriorityQueue) Metrics() Metrics
- func (pq *PriorityQueue) NominatedPods(nodeName string) []*v1.Pod
- func (pq *PriorityQueue) Pop() (*v1.Pod, error)
- func (pq *PriorityQueue) Push(pod *v1.Pod) error
- func (pq *PriorityQueue) RemoveNominatedNode(pod *v1.Pod) error
- func (pq *PriorityQueue) Reorder(comparator Compare) *PriorityQueue
- func (pq *PriorityQueue) Update(podNamespace, podName string, newPod *v1.Pod) error
- func (pq *PriorityQueue) UpdateNominatedNode(pod *v1.Pod, nodeName string) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrEmptyQueue is returned from Pop. ErrEmptyQueue = errors.New("No pod queued") // ErrDifferentNames is returned from Update. ErrDifferentNames = errors.New("Original and new pods have different names") )
Functions ¶
func DefaultComparator ¶
DefaultComparator returns true if pod0 has higher priority than pod1. If the priorities are equal, it compares the timestamps and returns true if pod0 is older than pod1.
Types ¶
type Compare ¶
Compare is a comparator function that returns true if pod0 has higher priority than pod1, or false otherwise.
type ErrNoMatchingPod ¶
type ErrNoMatchingPod struct {
// contains filtered or unexported fields
}
ErrNoMatchingPod is returned from Update.
func (*ErrNoMatchingPod) Error ¶
func (e *ErrNoMatchingPod) Error() string
type FIFOQueue ¶
type FIFOQueue struct {
// contains filtered or unexported fields
}
FIFOQueue stores pods in a FIFO queue.
func (*FIFOQueue) NominatedPods ¶
NominatedPods does nothing. FIFOQueue doesn't support preemption.
func (*FIFOQueue) RemoveNominatedNode ¶
RemoveNominatedNode does nothing. FIFOQueue doesn't support preemption.
type Metrics ¶
type Metrics struct {
PendingPodsNum int
}
Metrics represents a metrics of a PodQueue at one time point.
type PodQueue ¶
type PodQueue interface { // Push pushes the pod to the "end" of this PodQueue. Push(pod *v1.Pod) error // Pop pops the pod on the "front" of this PodQueue. // This method never blocks; Immediately returns ErrEmptyQueue if the queue is empty. Pop() (*v1.Pod, error) // Front refers (not pops) the pod on the "front" of this PodQueue. // This method never bocks; Immediately returns ErrEmptyQueue if the queue is empty. Front() (*v1.Pod, error) // Delete deletes the pod from this PodQueue. // Returns true if the pod is found, or false otherwise. Delete(podNamespace, podName string) bool // Update updates the pod to the newPod. // Returns ErrNoMatchingPod if an original pod is not found. // The original and new pods must have the same namespace/name; Otherwise ErrDifferentNames is // returned in the second field. Update(podNamespace, podName string, newPod *v1.Pod) error // NominatedPods returns a list of pods for which the node is nominated for scheduling. NominatedPods(nodeName string) []*v1.Pod // UpdateNominatedNode updates the node nomination for the pod. UpdateNominatedNode(pod *v1.Pod, nodeName string) error // RemoveNominatedNode removes the node nomination for the pod. RemoveNominatedNode(pod *v1.Pod) error // Metrics returns a metrics of this PodQueue. Metrics() Metrics }
PodQueue defines the interface of pod queues.
type PriorityQueue ¶
type PriorityQueue struct {
// contains filtered or unexported fields
}
PriorityQueue stores pods in a priority queue. The pods are sorted by their priority, which can be configured by users.
func NewPriorityQueue ¶
func NewPriorityQueue() *PriorityQueue
NewPriorityQueue creates a new PriorityQueue with DefaultComparator.
func NewPriorityQueueWithComparator ¶
func NewPriorityQueueWithComparator(comparator Compare) *PriorityQueue
NewPriorityQueueWithComparator creates a new PriorityQueue with the given comparator.
func (*PriorityQueue) Delete ¶
func (pq *PriorityQueue) Delete(podNamespace, podName string) bool
func (*PriorityQueue) Metrics ¶
func (pq *PriorityQueue) Metrics() Metrics
func (*PriorityQueue) NominatedPods ¶
func (pq *PriorityQueue) NominatedPods(nodeName string) []*v1.Pod
func (*PriorityQueue) RemoveNominatedNode ¶
func (pq *PriorityQueue) RemoveNominatedNode(pod *v1.Pod) error
func (*PriorityQueue) Reorder ¶
func (pq *PriorityQueue) Reorder(comparator Compare) *PriorityQueue
Reorder creates a new PriorityQueue with all pods stored in the original queue in the sorted order according to the given comparator.
func (*PriorityQueue) Update ¶
func (pq *PriorityQueue) Update(podNamespace, podName string, newPod *v1.Pod) error
func (*PriorityQueue) UpdateNominatedNode ¶
func (pq *PriorityQueue) UpdateNominatedNode(pod *v1.Pod, nodeName string) error