nodes

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterNodesByNodeAffinity

func FilterNodesByNodeAffinity(nodes []*corev1.Node, affinity *corev1.NodeSelector) ([]*corev1.Node, error)

FilterNodesByNodeAffinity returns nodes that match the node affinity.

func FilterSchedulableNodes

func FilterSchedulableNodes(nodes []*corev1.Node, tolerations []corev1.Toleration) ([]*corev1.Node, error)

FilterSchedulableNodes filters schedulable nodes that match the given tolerations.

func ListAllNodes

func ListAllNodes(nodeLister listv1.NodeLister) ([]*corev1.Node, error)

ListAllNodes returns all nodes.

func ListNodesByLabelSelector

func ListNodesByLabelSelector(nodeLister listv1.NodeLister, selector labels.Selector) ([]*corev1.Node, error)

ListNodesByLabelSelector returns nodes that match the node selector.

func ListNodesByNodeClaim

func ListNodesByNodeClaim(nodeLister listv1.NodeLister, claim *pb.NodeClaim) ([]*corev1.Node, error)

ListNodesByNodeClaim returns all nodes that match the node claim.

Types

type NodeInfo

type NodeInfo struct {
	Node *corev1.Node

	AllocatableResource *util.Resource
	IdleResource        *util.Resource
}

NodeInfo is the wrapper of a node and its resource.

func NewNodeInfo

func NewNodeInfo(node *corev1.Node) *NodeInfo

NewNodeInfo returns an instance of NodeInfo. The initial IdleResource equals with AllocatableResource.

func (*NodeInfo) AssignedPodRequest

func (ni *NodeInfo) AssignedPodRequest(pods []*corev1.Pod) error

AssignedPodRequest counts the effective request resource of pods for the node. IdleResource will be subtracted from the all pod request resources when this function is called.

func (*NodeInfo) MaxReplicaDivided

func (ni *NodeInfo) MaxReplicaDivided(rl corev1.ResourceList) int64

MaxReplicaDivided returns how many replicas that the node can produce.

Jump to

Keyboard shortcuts

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