scaledowncandidates

package
v0.0.0-...-5458e1c Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCombinedScaleDownCandidatesProcessor

func NewCombinedScaleDownCandidatesProcessor() *combinedScaleDownCandidatesProcessor

NewCombinedScaleDownCandidatesProcessor returns a default implementation of the scale down candidates processor, which wraps and sequentially runs other sub-processors.

Types

type CandidatesComparer

type CandidatesComparer interface {
	// ScaleDownEarlierThan return true if node1 should be scaled down earlier than node2.
	ScaleDownEarlierThan(node1, node2 *apiv1.Node) bool
}

CandidatesComparer is an used for sorting scale down candidates.

type NodeSorter

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

NodeSorter struct contain the list of nodes and the list of processors that should be applied for sorting.

func (*NodeSorter) Len

func (n *NodeSorter) Len() int

Len return the length of node's list.

func (*NodeSorter) Less

func (n *NodeSorter) Less(i, j int) bool

Less return true if node with index i is less than node with index j.

func (*NodeSorter) Sort

func (n *NodeSorter) Sort() []*apiv1.Node

Sort return list of nodes in descending order.

func (*NodeSorter) Swap

func (n *NodeSorter) Swap(i, j int)

Swap is swapping the nodes in the list.

type Observer

type Observer interface {
	// UpdateScaleDownCandidates updates scale down candidates.
	UpdateScaleDownCandidates([]*apiv1.Node, time.Time)
}

Observer is an observer of scale down candidates

type ObserversList

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

ObserversList is a slice of observers of scale down candidates

func NewObserversList

func NewObserversList() *ObserversList

NewObserversList return empty list of observers.

func (*ObserversList) Register

func (l *ObserversList) Register(o Observer)

Register adds new observer to the list.

func (*ObserversList) Update

func (l *ObserversList) Update(nodes []*apiv1.Node, now time.Time)

Update updates scale down candidates for each observer.

type ScaleDownCandidatesDelayProcessor

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

ScaleDownCandidatesDelayProcessor is a processor to filter out nodes according to scale down delay per nodegroup

func NewScaleDownCandidatesDelayProcessor

func NewScaleDownCandidatesDelayProcessor() *ScaleDownCandidatesDelayProcessor

NewScaleDownCandidatesDelayProcessor returns a new ScaleDownCandidatesDelayProcessor.

func (*ScaleDownCandidatesDelayProcessor) CleanUp

func (p *ScaleDownCandidatesDelayProcessor) CleanUp()

CleanUp is called at CA termination.

func (*ScaleDownCandidatesDelayProcessor) GetPodDestinationCandidates

func (p *ScaleDownCandidatesDelayProcessor) GetPodDestinationCandidates(ctx *context.AutoscalingContext,
	nodes []*apiv1.Node) ([]*apiv1.Node, errors.AutoscalerError)

GetPodDestinationCandidates returns nodes as is no processing is required here

func (*ScaleDownCandidatesDelayProcessor) GetScaleDownCandidates

func (p *ScaleDownCandidatesDelayProcessor) GetScaleDownCandidates(ctx *context.AutoscalingContext,
	nodes []*apiv1.Node) ([]*apiv1.Node, errors.AutoscalerError)

GetScaleDownCandidates returns filter nodes based on if scale down is enabled or disabled per nodegroup.

func (*ScaleDownCandidatesDelayProcessor) RegisterFailedScaleDown

func (p *ScaleDownCandidatesDelayProcessor) RegisterFailedScaleDown(nodeGroup cloudprovider.NodeGroup,
	reason string, currentTime time.Time)

RegisterFailedScaleDown records failed scale-down for a nodegroup.

func (*ScaleDownCandidatesDelayProcessor) RegisterFailedScaleUp

func (p *ScaleDownCandidatesDelayProcessor) RegisterFailedScaleUp(_ cloudprovider.NodeGroup,
	_ string, _ string, _ string, _ string, _ time.Time)

RegisterFailedScaleUp records when the last scale up failed for a nodegroup.

func (*ScaleDownCandidatesDelayProcessor) RegisterScaleDown

func (p *ScaleDownCandidatesDelayProcessor) RegisterScaleDown(nodeGroup cloudprovider.NodeGroup,
	nodeName string, currentTime time.Time, _ time.Time)

RegisterScaleDown records when the last scale down happened for a nodegroup.

func (*ScaleDownCandidatesDelayProcessor) RegisterScaleUp

func (p *ScaleDownCandidatesDelayProcessor) RegisterScaleUp(nodeGroup cloudprovider.NodeGroup,
	_ int, currentTime time.Time)

RegisterScaleUp records when the last scale up happened for a nodegroup.

type ScaleDownCandidatesSortingProcessor

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

ScaleDownCandidatesSortingProcessor is a wrapper for preFilteringProcessor that takes into account previous scale down candidates. This is necessary for efficient parallel scale down.

func NewScaleDownCandidatesSortingProcessor

func NewScaleDownCandidatesSortingProcessor(sorting []CandidatesComparer) *ScaleDownCandidatesSortingProcessor

NewScaleDownCandidatesSortingProcessor returns a new PreFilteringScaleDownNodeProcessor.

func (*ScaleDownCandidatesSortingProcessor) CleanUp

CleanUp is called at CA termination.

func (*ScaleDownCandidatesSortingProcessor) GetPodDestinationCandidates

func (p *ScaleDownCandidatesSortingProcessor) GetPodDestinationCandidates(ctx *context.AutoscalingContext,
	nodes []*apiv1.Node) ([]*apiv1.Node, errors.AutoscalerError)

GetPodDestinationCandidates returns nodes that potentially could act as destinations for pods that would become unscheduled after a scale down.

func (*ScaleDownCandidatesSortingProcessor) GetScaleDownCandidates

GetScaleDownCandidates returns filter nodes and move previous scale down candidates to the beginning of the list.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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