Documentation ¶
Index ¶
- type NodeGroupResources
- type NodeGroupSchedulingMetadata
- type NodeSchedulingMetadata
- type Resources
- func (r *Resources) Add(other *Resources)
- func (r *Resources) AddFromReservation(reservation *v1beta2.Reservation)
- func (r *Resources) AddFromResourceList(resourceList corev1.ResourceList)
- func (r *Resources) Copy() *Resources
- func (r *Resources) Eq(other *Resources) bool
- func (r *Resources) GreaterThan(other *Resources) bool
- func (r *Resources) SetMaxResource(resourceList corev1.ResourceList)
- func (r *Resources) Sub(other *Resources)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NodeGroupResources ¶
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 []*v1beta2.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, overheadUsage NodeGroupResources) NodeGroupSchedulingMetadata
NodeSchedulingMetadataForNodes calculate available and schedulable resources. Available resources are computed by subtracting current and overhead usage from allocatable per node. Schedulable resources are computed by subtracting overhead 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 SchedulableResources *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
func CreateSchedulingMetadata ¶ added in v0.12.0
func CreateSchedulingMetadata(cpu, memory, nvidiaGPU int64, zoneLabel string) *NodeSchedulingMetadata
CreateSchedulingMetadata creates a new NodeSchedulingMetadata struct with provided specs as the available capacity. Total capacity is set to infinity. When total capacity is relevant use CreateSchedulingMetadataWithTotals instead.
func CreateSchedulingMetadataWithTotals ¶ added in v0.12.0
func CreateSchedulingMetadataWithTotals( availableCPU, cpuTotal, availableMemory, memoryTotal, availableNvidiaGPU, nvidiaGPUTotal int64, zoneLabel string) *NodeSchedulingMetadata
CreateSchedulingMetadataWithTotals creates a new NodeSchedulingMetadata struct with the provided usage and total capacity specs.
type Resources ¶
type Resources struct { CPU resource.Quantity Memory resource.Quantity NvidiaGPU resource.Quantity }
Resources represents the CPU and Memory resource quantities
func CreateResources ¶ added in v0.12.0
CreateResources creates a new Resources struct with given specs.
func (*Resources) AddFromReservation ¶
func (r *Resources) AddFromReservation(reservation *v1beta2.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) Eq ¶
Eq returns true if all of CPU, Memory and NvidiaGPU quantities are equal between this Resources object and other
func (*Resources) GreaterThan ¶
GreaterThan returns true if any of CPU, Memory or NvidiaGPU 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