resource

package
v0.0.0-...-1ba6007 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const LimitUnknown = math.MaxInt64

LimitUnknown is used as a value in ResourcesLimits if actual limit could not be obtained due to errors talking to cloud provider.

Variables

This section is empty.

Functions

This section is empty.

Types

type Delta

type Delta map[string]int64

Delta is a map: the key is resource type and the value is resource delta.

type Limits

type Limits map[string]int64

Limits is a map: the key is resource type and the value is resource limit.

type LimitsCheckResult

type LimitsCheckResult struct {
	Exceeded          bool
	ExceededResources []string
}

LimitsCheckResult contains the limit check result and the exceeded resources if any.

func CheckDeltaWithinLimits

func CheckDeltaWithinLimits(left Limits, delta Delta) LimitsCheckResult

CheckDeltaWithinLimits compares the resource limit and resource delta, and returns the limit check result.

func LimitsNotExceeded

func LimitsNotExceeded() LimitsCheckResult

LimitsNotExceeded returns a not exceeded limit check result.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager provides resource checks before scaling up the cluster.

func NewManager

NewManager creates an instance of scale up resource manager with provided parameters.

func (*Manager) ApplyLimits

func (m *Manager) ApplyLimits(ctx *context.AutoscalingContext, newCount int, resourceLeft Limits, nodeInfo *framework.NodeInfo, nodeGroup cloudprovider.NodeGroup) (int, errors.AutoscalerError)

ApplyLimits calculates the new node count by applying the left resource limits of the cluster.

func (*Manager) DeltaForNode

func (m *Manager) DeltaForNode(ctx *context.AutoscalingContext, nodeInfo *framework.NodeInfo, nodeGroup cloudprovider.NodeGroup) (Delta, errors.AutoscalerError)

DeltaForNode calculates the amount of resources that will be used from the cluster when creating a node.

func (*Manager) ResourcesLeft

func (m *Manager) ResourcesLeft(ctx *context.AutoscalingContext, nodeInfos map[string]*framework.NodeInfo, nodes []*corev1.Node) (Limits, errors.AutoscalerError)

ResourcesLeft calculates the amount of resources left in the cluster.

Jump to

Keyboard shortcuts

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