util

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: Apache-2.0 Imports: 25 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildBestEffortPod added in v1.6.0

func BuildBestEffortPod(namespace, name, nodeName string, p v1.PodPhase, groupName string, labels map[string]string, selector map[string]string) *v1.Pod

BuildBestEffortPod builds a BestEffort pod object

func BuildDynamicPVC added in v1.6.0

func BuildDynamicPVC(namespace, name string, req v1.ResourceList) (*v1.PersistentVolumeClaim, *v1.PersistentVolume, *storagev1.StorageClass)

BuildDynamicPVC create pv pvc and storage class

func BuildNode

func BuildNode(name string, alloc v1.ResourceList, labels map[string]string) *v1.Node

BuildNode builts node object

func BuildPod

func BuildPod(namespace, name, nodeName string, p v1.PodPhase, req v1.ResourceList, groupName string, labels map[string]string, selector map[string]string) *v1.Pod

BuildPod builds a Burstable pod object

func BuildPodWithPVC added in v1.6.0

func BuildPodWithPVC(namespace, name, nodename string, p v1.PodPhase, req v1.ResourceList, pvc *v1.PersistentVolumeClaim, groupName string, labels map[string]string, selector map[string]string) *v1.Pod

BuildPodWithPVC builts Pod object with pvc volume

func BuildPodWithPriority added in v1.6.0

func BuildPodWithPriority(namespace, name, nodeName string, p v1.PodPhase, req v1.ResourceList, groupName string, labels map[string]string, selector map[string]string, priority *int32) *v1.Pod

BuildPodWithPriority builds a pod object with priority

func CalculateNumOfFeasibleNodesToFind

func CalculateNumOfFeasibleNodesToFind(numAllNodes int32) (numNodes int32)

CalculateNumOfFeasibleNodesToFind returns the number of feasible nodes that once found, the scheduler stops its search for more feasible nodes.

func ConvertRes2ResList added in v1.7.0

func ConvertRes2ResList(res *api.Resource) v1.ResourceList

ConvertRes2ResList convert resource type from api.Resource in scheduler to v1.ResourceList in yaml

func GetMinInt added in v1.2.0

func GetMinInt(vals ...int) int

GetMinInt return minimum int from vals

func GetNodeList

func GetNodeList(nodes map[string]*api.NodeInfo, nodeList []string) []*api.NodeInfo

GetNodeList returns values of the map 'nodes'

func PrioritizeNodes

func PrioritizeNodes(task *api.TaskInfo, nodes []*api.NodeInfo, batchFn api.BatchNodeOrderFn, mapFn api.NodeOrderMapFn, reduceFn api.NodeOrderReduceFn) map[float64][]*api.NodeInfo

PrioritizeNodes returns a map whose key is node's score and value are corresponding nodes

func SelectBestNode

func SelectBestNode(nodeScores map[float64][]*api.NodeInfo) *api.NodeInfo

SelectBestNode returns best node whose score is highest, pick one randomly if there are many nodes with same score.

func SortNodes

func SortNodes(nodeScores map[float64][]*api.NodeInfo) []*api.NodeInfo

SortNodes returns nodes by order of score

func ValidateVictims added in v0.4.0

func ValidateVictims(preemptor *api.TaskInfo, node *api.NodeInfo, victims []*api.TaskInfo) error

ValidateVictims returns an error if the resources of the victims can't satisfy the preemptor

Types

type FakeBinder

type FakeBinder struct {
	Binds   map[string]string
	Channel chan string
}

FakeBinder is used as fake binder

func (*FakeBinder) Bind

func (fb *FakeBinder) Bind(kubeClient kubernetes.Interface, tasks []*api.TaskInfo) ([]*api.TaskInfo, error)

Bind used by fake binder struct to bind pods

type FakeEvictor

type FakeEvictor struct {
	sync.Mutex

	Channel chan string
	// contains filtered or unexported fields
}

FakeEvictor is used as fake evictor

func (*FakeEvictor) Evict

func (fe *FakeEvictor) Evict(p *v1.Pod, reason string) error

Evict is used by fake evictor to evict pods

func (*FakeEvictor) Evicts

func (fe *FakeEvictor) Evicts() []string

Evicts returns copy of evicted pods.

type FakeStatusUpdater

type FakeStatusUpdater struct {
}

FakeStatusUpdater is used for fake status update

func (*FakeStatusUpdater) UpdatePodCondition

func (ftsu *FakeStatusUpdater) UpdatePodCondition(pod *v1.Pod, podCondition *v1.PodCondition) (*v1.Pod, error)

UpdatePodCondition is a empty function

func (*FakeStatusUpdater) UpdatePodGroup

func (ftsu *FakeStatusUpdater) UpdatePodGroup(pg *api.PodGroup) (*api.PodGroup, error)

UpdatePodGroup is a empty function

type FakeVolumeBinder

type FakeVolumeBinder struct {
	Actions map[string][]string
	// contains filtered or unexported fields
}

FakeVolumeBinder is used as fake volume binder

func NewFakeVolumeBinder added in v1.6.0

func NewFakeVolumeBinder(kubeClient kubernetes.Interface) *FakeVolumeBinder

NewFakeVolumeBinder create fake volume binder with kubeclient

func (*FakeVolumeBinder) AllocateVolumes

func (fvb *FakeVolumeBinder) AllocateVolumes(task *api.TaskInfo, hostname string, podVolumes *volumescheduling.PodVolumes) error

AllocateVolumes is a empty function

func (*FakeVolumeBinder) BindVolumes

func (fvb *FakeVolumeBinder) BindVolumes(task *api.TaskInfo, podVolumes *volumescheduling.PodVolumes) error

BindVolumes is a empty function

func (*FakeVolumeBinder) GetPodVolumes added in v1.3.0

func (fvb *FakeVolumeBinder) GetPodVolumes(task *api.TaskInfo, node *v1.Node) (*volumescheduling.PodVolumes, error)

GetPodVolumes is a empty function

func (*FakeVolumeBinder) RevertVolumes added in v1.6.0

func (fvb *FakeVolumeBinder) RevertVolumes(task *api.TaskInfo, podVolumes *volumescheduling.PodVolumes)

RevertVolumes is a empty function

type PredicateHelper added in v1.5.0

type PredicateHelper interface {
	PredicateNodes(task *api.TaskInfo, nodes []*api.NodeInfo, fn api.PredicateFn, enableErrorCache bool) ([]*api.NodeInfo, *api.FitErrors)
}

func NewPredicateHelper added in v1.5.0

func NewPredicateHelper() PredicateHelper

type PriorityQueue

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

PriorityQueue implements a scheduling queue.

func NewPriorityQueue

func NewPriorityQueue(lessFn api.LessFn) *PriorityQueue

NewPriorityQueue returns a PriorityQueue

func (*PriorityQueue) Empty

func (q *PriorityQueue) Empty() bool

Empty check if queue is empty

func (*PriorityQueue) Len

func (q *PriorityQueue) Len() int

Len returns Len of the priority queue

func (*PriorityQueue) Pop

func (q *PriorityQueue) Pop() interface{}

Pop pops element in the priority Queue

func (*PriorityQueue) Push

func (q *PriorityQueue) Push(it interface{})

Push pushes element in the priority Queue

type StatusSets added in v1.8.0

type StatusSets []*api.Status

func (StatusSets) ContainsErrorSkipOrWait added in v1.8.0

func (s StatusSets) ContainsErrorSkipOrWait() bool

func (StatusSets) ContainsUnschedulable added in v1.8.0

func (s StatusSets) ContainsUnschedulable() bool

func (StatusSets) ContainsUnschedulableAndUnresolvable added in v1.8.0

func (s StatusSets) ContainsUnschedulableAndUnresolvable() bool

func (StatusSets) Message added in v1.8.1

func (s StatusSets) Message() string

Message return the message generated from StatusSets

func (StatusSets) Reasons added in v1.8.1

func (s StatusSets) Reasons() []string

Reasons return the reasons list

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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