k8s

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2021 License: Apache-2.0, BSD-3-Clause, MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExternalResourcePrefix = "mixer.io/ext-"
)

Variables

This section is empty.

Functions

func GetPodKey

func GetPodKey(pod *v1.Pod) string

GetPodKey output the key identification for pod, which is namespace and pod name

func GetPodResourceRequest

func GetPodResourceRequest(pod *v1.Pod) v1.ResourceList

GetPodResourceRequest output pod's extended request resource quantity

func OrderedBy

func OrderedBy(cmp ...cmpFunc) *multiSorter

OrderedBy returns a Sorter that sorts using the cmp functions, in order. Call its Sort method to sort the data.

func SortByPriority

func SortByPriority(p1, p2 *v1.Pod) int

SortByPriority compare pods by Priority

func SortByResource

func SortByResource(usageMap map[string]int64) cmpFunc

SortByResource compare pods by resource usage Now just compare with usage quantity, not compare with request

func SortByStartTime

func SortByStartTime(p1, p2 *v1.Pod) int

SortByStartTime compare pods by the running duration

Types

type NodeInfo

type NodeInfo struct {
	// total requested extended resources of all pods on this node
	RequestedResource v1.ResourceList
}

NodeInfo group node level info

func NewNodeInfo

func NewNodeInfo(pods ...*v1.Pod) *NodeInfo

NewNodeInfo new a NodeInfo object. If any pods are given in arguments, their extended resources will be accumulated.

func (*NodeInfo) AddPod

func (n *NodeInfo) AddPod(pod *v1.Pod)

AddPod accumulate pod's extended resources to the NodeInfo

func (*NodeInfo) Less

func (n *NodeInfo) Less(rl v1.ResourceList) bool

the function check if the extended request resource are less than resources given in parameter

func (*NodeInfo) More

func (n *NodeInfo) More(rl v1.ResourceList) (bool, v1.ResourceName)

the function check if the extended request resources are more than resources given in parameter

func (*NodeInfo) ReduceRequestedResource

func (n *NodeInfo) ReduceRequestedResource(resQuan v1.ResourceList)

ReduceRequestedResource take off the resource quantity from node's total request resource quantity

func (*NodeInfo) ResetNodeInfo

func (n *NodeInfo) ResetNodeInfo(pods ...*v1.Pod)

ResetNodeInfo clear the NodeInfo object. If any pods are given in arguments, their extended resources will be accumulated.

Jump to

Keyboard shortcuts

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