util

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2019 License: Apache-2.0 Imports: 18 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildNode added in v0.5.0

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

BuildNode builts node object

func BuildPod added in v0.5.0

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 builts Pod object

func BuildResourceList added in v0.5.0

func BuildResourceList(cpu string, memory string) v1.ResourceList

BuildResourceList builts resource list object

func BuildResourceListWithGPU added in v0.5.0

func BuildResourceListWithGPU(cpu string, memory string, GPU string) v1.ResourceList

BuildResourceListWithGPU builts resource list with GPU

func GetNodeList added in v0.5.0

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

GetNodeList returns values of the map 'nodes'

func PredicateNodes added in v0.5.0

func PredicateNodes(task *api.TaskInfo, nodes []*api.NodeInfo, fn api.PredicateFn) []*api.NodeInfo

PredicateNodes returns nodes that fit task

func SelectBestNode added in v0.4.1

func SelectBestNode(priorityList HostPriorityList) string

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

func SortNodes added in v0.5.0

func SortNodes(priorityList HostPriorityList, nodesInfo map[string]*api.NodeInfo) []*api.NodeInfo

SortNodes returns nodes by order of score

Types

type FakeBinder added in v0.5.0

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

FakeBinder is used as fake binder

func (*FakeBinder) Bind added in v0.5.0

func (fb *FakeBinder) Bind(p *v1.Pod, hostname string) error

Bind used by fake binder struct to bind pods

type FakeEvictor added in v0.5.0

type FakeEvictor struct {
	sync.Mutex
	Evicts  []string
	Channel chan string
}

FakeEvictor is used as fake evictor

func (*FakeEvictor) Evict added in v0.5.0

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

Evict is used by fake evictor to evict pods

type FakeStatusUpdater added in v0.5.0

type FakeStatusUpdater struct {
}

FakeStatusUpdater is used for fake status update

func (*FakeStatusUpdater) UpdatePodCondition added in v0.5.0

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

UpdatePodCondition is a empty function

func (*FakeStatusUpdater) UpdatePodGroup added in v0.5.0

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

UpdatePodGroup is a empty function

type FakeVolumeBinder added in v0.5.0

type FakeVolumeBinder struct {
}

FakeVolumeBinder is used as fake volume binder

func (*FakeVolumeBinder) AllocateVolumes added in v0.5.0

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

AllocateVolumes is a empty function

func (*FakeVolumeBinder) BindVolumes added in v0.5.0

func (fvb *FakeVolumeBinder) BindVolumes(task *api.TaskInfo) error

BindVolumes is a empty function

type HostPriority added in v0.5.0

type HostPriority struct {
	// Name of the host
	Host string
	// Score associated with the host
	Score float64
}

HostPriority represents the priority of scheduling to a particular host, higher priority is better.

type HostPriorityList added in v0.5.0

type HostPriorityList []HostPriority

HostPriorityList declares a []HostPriority type.

func PrioritizeNodes added in v0.5.0

func PrioritizeNodes(
	task *api.TaskInfo,
	filterNodes []*api.NodeInfo,
	priorityConfigs []algorithm.PriorityConfig,
) (HostPriorityList, error)

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

func (HostPriorityList) Len added in v0.5.0

func (h HostPriorityList) Len() int

func (HostPriorityList) Less added in v0.5.0

func (h HostPriorityList) Less(i, j int) bool

func (HostPriorityList) Swap added in v0.5.0

func (h HostPriorityList) Swap(i, j int)

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

Jump to

Keyboard shortcuts

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