resources

package
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NodeGroupResources

type NodeGroupResources map[string]*Resources

NodeGroupResources represents resources for a group of nodes

func AvailableForNodes

func AvailableForNodes(nodes []*corev1.Node, currentUsage NodeGroupResources) NodeGroupResources

AvailableForNodes finds available resources by subtracting current usage from allocatable per node

func UsageForNodes

func UsageForNodes(resourceReservations []*v1beta1.ResourceReservation) NodeGroupResources

UsageForNodes tallies resource usages per node from the given list of resource reservations

func (NodeGroupResources) Add

func (nodeResources NodeGroupResources) Add(other NodeGroupResources)

Add adds all resources in other into the receiver, modifies receiver

func (NodeGroupResources) Sub

func (nodeResources NodeGroupResources) Sub(other NodeGroupResources)

Sub subtract all resources in other from the receiver, modifies receiver

type NodeGroupSchedulingMetadata

type NodeGroupSchedulingMetadata map[string]*NodeSchedulingMetadata

NodeGroupSchedulingMetadata represents NodeSchedulingMetadata for a group of nodes

func NodeSchedulingMetadataForNodes

func NodeSchedulingMetadataForNodes(nodes []*corev1.Node, currentUsage NodeGroupResources) NodeGroupSchedulingMetadata

NodeSchedulingMetadataForNodes calculate available resources by subtracting current usage from allocatable per node

func (NodeGroupSchedulingMetadata) SubtractUsageIfExists

func (nodesSchedulingMetadata NodeGroupSchedulingMetadata) SubtractUsageIfExists(usedResourcesByNodeName NodeGroupResources)

SubtractUsageIfExists subtracts usedResourcesByNodeName from the receiver, modifies receiver, only for nodes that exist in receiver

type NodeSchedulingMetadata

type NodeSchedulingMetadata struct {
	AvailableResources *Resources
	CreationTimestamp  time.Time
	ZoneLabel          string
	AllLabels          map[string]string
	Unschedulable      bool
	Ready              bool
}

NodeSchedulingMetadata represents various parameters of a node that are considered in scheduling decisions

type Resources

type Resources struct {
	CPU    resource.Quantity
	Memory resource.Quantity
}

Resources represents the CPU and Memory resource quantities

func Zero

func Zero() *Resources

Zero returns a Resources object with quantities of zero

func (*Resources) Add

func (r *Resources) Add(other *Resources)

Add modifies the receiver in place.

func (*Resources) AddFromReservation

func (r *Resources) AddFromReservation(reservation *v1beta1.Reservation)

AddFromReservation modifies the receiver in place.

func (*Resources) AddFromResourceList

func (r *Resources) AddFromResourceList(resourceList corev1.ResourceList)

AddFromResourceList modified the receiver in place

func (*Resources) Copy

func (r *Resources) Copy() *Resources

Copy returns a clone of the Resources object

func (*Resources) Eq

func (r *Resources) Eq(other *Resources) bool

Eq returns true if both CPU and Memory quantities are equal between this Resources object and other

func (*Resources) GreaterThan

func (r *Resources) GreaterThan(other *Resources) bool

GreaterThan returns true if either the CPU or Memory quantities of this object are greater than those of other

func (*Resources) SetMaxResource added in v0.2.9

func (r *Resources) SetMaxResource(resourceList corev1.ResourceList)

SetMaxResource modifies the receiver in place to set each resource to the greater value of itself or the corresponding resource in resourceList

func (*Resources) Sub

func (r *Resources) Sub(other *Resources)

Sub modifies the receiver in place

Jump to

Keyboard shortcuts

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