util

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateNodeMapAndSlice

func GenerateNodeMapAndSlice(nodes map[string]*api.NodeInfo) (map[string]*cache.NodeInfo, []*v1.Node)

GenerateNodeMapAndSlice returns the nodeMap and nodeSlice generated from ssn

func HaveAffinity

func HaveAffinity(pod *v1.Pod) bool

HaveAffinity checks pod have affinity or not

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 algorithm.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 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 (*PodLister) AffinityFilteredList

func (pl *PodLister) AffinityFilteredList(podFilter algorithm.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 algorithm.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.

Jump to

Keyboard shortcuts

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