sorter

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EvictionCost

func EvictionCost(p1, p2 *corev1.Pod) int

func KoordinatorPriorityClass

func KoordinatorPriorityClass(p1, p2 *corev1.Pod) int

KoordinatorPriorityClass compares pods by the Koordinator PriorityClass

func KoordinatorQoSClass

func KoordinatorQoSClass(p1, p2 *corev1.Pod) int

KoordinatorQoSClass compares pods by the Koordinator QoSClass

func KubernetesQoSClass

func KubernetesQoSClass(p1, p2 *corev1.Pod) int

KubernetesQoSClass compares pods by Kubernetes QosClass

func PodCreationTimestamp

func PodCreationTimestamp(p1, p2 *corev1.Pod) int

PodCreationTimestamp compares the pods by the creation timestamp

func PodDeletionCost

func PodDeletionCost(p1, p2 *corev1.Pod) int

func Priority

func Priority(p1, p2 *corev1.Pod) int

Priority compares pods by Priority

func ResourceUsageScorer

func ResourceUsageScorer(resToWeightMap map[corev1.ResourceName]int64) func(requested, allocatable corev1.ResourceList) int64

func SortPodsByUsage

func SortPodsByUsage(pods []*corev1.Pod, podMetrics map[types.NamespacedName]*slov1alpha1.ResourceMap, nodeAllocatableMap map[string]corev1.ResourceList, resourceToWeightMap map[corev1.ResourceName]int64)

Types

type CompareFn

type CompareFn func(p1, p2 *corev1.Pod) int

CompareFn compares p1 and p2 and returns:

-1 if p1 <  p2
 0 if p1 == p2
+1 if p1 >  p2

func PodUsage

func PodUsage(podMetrics map[types.NamespacedName]*slov1alpha1.ResourceMap, nodeAllocatableMap map[string]corev1.ResourceList, resourceToWeightMap map[corev1.ResourceName]int64) CompareFn

PodUsage compares pods by the actual usage

func Reverse

func Reverse(cmp CompareFn) CompareFn

type MultiSorter

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

MultiSorter implements the Sort interface

func OrderedBy

func OrderedBy(cmp ...CompareFn) *MultiSorter

OrderedBy returns a Sorter sorted using the cmp functions, sorts in ascending order by default

func PodSorter

func PodSorter(cmp ...CompareFn) *MultiSorter

func (*MultiSorter) Ascending

func (ms *MultiSorter) Ascending() *MultiSorter

func (*MultiSorter) Descending

func (ms *MultiSorter) Descending() *MultiSorter

func (*MultiSorter) Len

func (ms *MultiSorter) Len() int

Len is part of sort.Interface.

func (*MultiSorter) Less

func (ms *MultiSorter) Less(i, j int) bool

Less is part of sort.Interface.

func (*MultiSorter) Sort

func (ms *MultiSorter) Sort(pods []*corev1.Pod)

Sort sorts the pods according to the cmp functions passed to OrderedBy.

func (*MultiSorter) Swap

func (ms *MultiSorter) Swap(i, j int)

Swap is part of sort.Interface.

Jump to

Keyboard shortcuts

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