util

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2021 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// Permit indicates that plugin callback function permits job to be inqueue, pipelined, or other status
	Permit = 1
	// Abstain indicates that plugin callback function abstains in voting job to be inqueue, pipelined, or other status
	Abstain = 0
	// Reject indicates that plugin callback function rejects job to be inqueue, pipelined, or other status
	Reject = -1
)

Variables

This section is empty.

Functions

func GenerateNodeMapAndSlice

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

GenerateNodeMapAndSlice returns the nodeMap and nodeSlice generated from ssn

func HaveAffinity

func HaveAffinity(pod *v1.Pod) bool

HaveAffinity checks pod have affinity or not

func NormalizeScore added in v1.4.0

func NormalizeScore(maxPriority int64, reverse bool, scores map[string]int64)

NormalizeScore normalizes the score for each filteredNode

Types

type CachedNodeInfo

type CachedNodeInfo struct {
	Session *framework.Session
}

CachedNodeInfo is used in nodeorder and predicate plugin

func (*CachedNodeInfo) GetNodeInfo

func (c *CachedNodeInfo) GetNodeInfo(name string) (*v1.Node, error)

GetNodeInfo is used to get info of a particular node

type NodeLister

type NodeLister struct {
	Session *framework.Session
}

NodeLister is used in nodeorder plugin

func (*NodeLister) List

func (nl *NodeLister) List() ([]*v1.Node, error)

List is used to list all the nodes

type PodAffinityLister

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

PodAffinityLister is used to list pod with affinity

func (*PodAffinityLister) FilteredList

func (pal *PodAffinityLister) FilteredList(podFilter PodFilter, selector labels.Selector) ([]*v1.Pod, error)

FilteredList is used to list all the pods with affinity under filter condition

func (*PodAffinityLister) List

func (pal *PodAffinityLister) List(selector labels.Selector) ([]*v1.Pod, error)

List method is used to list all the pods

type PodFilter added in v1.3.0

type PodFilter func(*v1.Pod) bool

PodFilter is a function to filter a pod. If pod passed return true else return false.

type PodLister

type PodLister struct {
	Session *framework.Session

	CachedPods       map[api.TaskID]*v1.Pod
	Tasks            map[api.TaskID]*api.TaskInfo
	TaskWithAffinity map[api.TaskID]*api.TaskInfo
}

PodLister is used in predicate and nodeorder plugin

func NewPodLister

func NewPodLister(ssn *framework.Session) *PodLister

NewPodLister returns a PodLister generate from ssn

func NewPodListerFromNode added in v1.2.0

func NewPodListerFromNode(ssn *framework.Session) *PodLister

NewPodListerFromNode returns a PodLister generate from ssn

func (*PodLister) AffinityFilteredList

func (pl *PodLister) AffinityFilteredList(podFilter PodFilter, selector labels.Selector) ([]*v1.Pod, error)

AffinityFilteredList is used to list all the pods with affinity under filter condition

func (*PodLister) AffinityLister

func (pl *PodLister) AffinityLister() *PodAffinityLister

AffinityLister generate a PodAffinityLister following current PodLister

func (*PodLister) FilteredList

func (pl *PodLister) FilteredList(podFilter PodFilter, selector labels.Selector) ([]*v1.Pod, error)

FilteredList is used to list all the pods under filter condition

func (*PodLister) GetPod

func (pl *PodLister) GetPod(task *api.TaskInfo) *v1.Pod

GetPod will get pod with proper nodeName, from cache or DeepCopy keeping this function read only to avoid concurrent panic of map

func (*PodLister) List

func (pl *PodLister) List(selector labels.Selector) ([]*v1.Pod, error)

List method is used to list all the pods

func (*PodLister) UpdateTask

func (pl *PodLister) UpdateTask(task *api.TaskInfo, nodeName string) *v1.Pod

UpdateTask will update the pod nodeName in cache using nodeName NOT thread safe, please ensure UpdateTask is the only called function of PodLister at the same time.

type PodsLister added in v1.3.0

type PodsLister interface {
	// Returns the list of pods.
	List(labels.Selector) ([]*v1.Pod, error)
	// This is similar to "List()", but the returned slice does not
	// contain pods that don't pass `podFilter`.
	FilteredList(podFilter PodFilter, selector labels.Selector) ([]*v1.Pod, error)
}

PodsLister interface represents anything that can list pods for a scheduler.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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