Documentation ¶
Index ¶
- Constants
- func IsNodeInfoSimilar(n1, n2 *schedulernodeinfo.NodeInfo) bool
- type BalancingNodeGroupSetProcessor
- func (b *BalancingNodeGroupSetProcessor) BalanceScaleUpBetweenGroups(context *context.AutoscalingContext, groups []cloudprovider.NodeGroup, ...) ([]ScaleUpInfo, errors.AutoscalerError)
- func (b *BalancingNodeGroupSetProcessor) CleanUp()
- func (b *BalancingNodeGroupSetProcessor) FindSimilarNodeGroups(context *context.AutoscalingContext, nodeGroup cloudprovider.NodeGroup, ...) ([]cloudprovider.NodeGroup, errors.AutoscalerError)
- type NoOpNodeGroupSetProcessor
- func (n *NoOpNodeGroupSetProcessor) BalanceScaleUpBetweenGroups(context *context.AutoscalingContext, groups []cloudprovider.NodeGroup, ...) ([]ScaleUpInfo, errors.AutoscalerError)
- func (n *NoOpNodeGroupSetProcessor) CleanUp()
- func (n *NoOpNodeGroupSetProcessor) FindSimilarNodeGroups(context *context.AutoscalingContext, nodeGroup cloudprovider.NodeGroup, ...) ([]cloudprovider.NodeGroup, errors.AutoscalerError)
- type NodeGroupSetProcessor
- type NodeInfoComparator
- type ScaleUpInfo
Constants ¶
const ( // MaxAllocatableDifferenceRatio describes how Node.Status.Allocatable can differ between // groups in the same NodeGroupSet MaxAllocatableDifferenceRatio = 0.05 // MaxFreeDifferenceRatio describes how free resources (allocatable - daemon and system pods) // can differ between groups in the same NodeGroupSet MaxFreeDifferenceRatio = 0.05 )
Variables ¶
This section is empty.
Functions ¶
func IsNodeInfoSimilar ¶
func IsNodeInfoSimilar(n1, n2 *schedulernodeinfo.NodeInfo) bool
IsNodeInfoSimilar returns true if two NodeInfos are similar enough to consider that the NodeGroups they come from are part of the same NodeGroupSet. The criteria are somewhat arbitrary, but generally we check if resources provided by both nodes are similar enough to likely be the same type of machine and if the set of labels is the same (except for a pre-defined set of labels like hostname or zone).
Types ¶
type BalancingNodeGroupSetProcessor ¶
type BalancingNodeGroupSetProcessor struct {
Comparator NodeInfoComparator
}
BalancingNodeGroupSetProcessor tries to keep similar node groups balanced on scale-up.
func (*BalancingNodeGroupSetProcessor) BalanceScaleUpBetweenGroups ¶
func (b *BalancingNodeGroupSetProcessor) BalanceScaleUpBetweenGroups(context *context.AutoscalingContext, groups []cloudprovider.NodeGroup, newNodes int) ([]ScaleUpInfo, errors.AutoscalerError)
BalanceScaleUpBetweenGroups distributes a given number of nodes between given set of NodeGroups. The nodes are added to smallest group first, trying to make the group sizes as evenly balanced as possible.
Returns ScaleUpInfos for groups that need to be resized.
MaxSize of each group will be respected. If newNodes > total free capacity of all NodeGroups it will be capped to total capacity. In particular if all group already have MaxSize, empty list will be returned.
func (*BalancingNodeGroupSetProcessor) CleanUp ¶
func (b *BalancingNodeGroupSetProcessor) CleanUp()
CleanUp performs final clean up of processor state.
func (*BalancingNodeGroupSetProcessor) FindSimilarNodeGroups ¶
func (b *BalancingNodeGroupSetProcessor) FindSimilarNodeGroups(context *context.AutoscalingContext, nodeGroup cloudprovider.NodeGroup, nodeInfosForGroups map[string]*schedulernodeinfo.NodeInfo) ([]cloudprovider.NodeGroup, errors.AutoscalerError)
FindSimilarNodeGroups returns a list of NodeGroups similar to the given one. Two groups are similar if the NodeInfos for them compare equal using IsNodeInfoSimilar.
type NoOpNodeGroupSetProcessor ¶
type NoOpNodeGroupSetProcessor struct { }
NoOpNodeGroupSetProcessor returns no similar node groups and doesn't do any balancing.
func (*NoOpNodeGroupSetProcessor) BalanceScaleUpBetweenGroups ¶
func (n *NoOpNodeGroupSetProcessor) BalanceScaleUpBetweenGroups(context *context.AutoscalingContext, groups []cloudprovider.NodeGroup, newNodes int) ([]ScaleUpInfo, errors.AutoscalerError)
BalanceScaleUpBetweenGroups splits a scale-up between provided NodeGroups.
func (*NoOpNodeGroupSetProcessor) CleanUp ¶
func (n *NoOpNodeGroupSetProcessor) CleanUp()
CleanUp performs final clean up of processor state.
func (*NoOpNodeGroupSetProcessor) FindSimilarNodeGroups ¶
func (n *NoOpNodeGroupSetProcessor) FindSimilarNodeGroups(context *context.AutoscalingContext, nodeGroup cloudprovider.NodeGroup, nodeInfosForGroups map[string]*schedulernodeinfo.NodeInfo) ([]cloudprovider.NodeGroup, errors.AutoscalerError)
FindSimilarNodeGroups returns a list of NodeGroups similar to the one provided in parameter.
type NodeGroupSetProcessor ¶
type NodeGroupSetProcessor interface { FindSimilarNodeGroups(context *context.AutoscalingContext, nodeGroup cloudprovider.NodeGroup, nodeInfosForGroups map[string]*schedulernodeinfo.NodeInfo) ([]cloudprovider.NodeGroup, errors.AutoscalerError) BalanceScaleUpBetweenGroups(context *context.AutoscalingContext, groups []cloudprovider.NodeGroup, newNodes int) ([]ScaleUpInfo, errors.AutoscalerError) CleanUp() }
NodeGroupSetProcessor finds nodegroups that are similar and allows balancing scale-up between them.
func NewDefaultNodeGroupSetProcessor ¶
func NewDefaultNodeGroupSetProcessor() NodeGroupSetProcessor
NewDefaultNodeGroupSetProcessor creates an instance of NodeGroupSetProcessor.
type NodeInfoComparator ¶
type NodeInfoComparator func(n1, n2 *schedulernodeinfo.NodeInfo) bool
NodeInfoComparator is a function that tells if two nodes are from NodeGroups similar enough to be considered a part of a single NodeGroupSet.
type ScaleUpInfo ¶
type ScaleUpInfo struct { // Group is the group to be scaled-up Group cloudprovider.NodeGroup // CurrentSize is the current size of the Group CurrentSize int // NewSize is the size the Group will be scaled-up to NewSize int // MaxSize is the maximum allowed size of the Group MaxSize int }
ScaleUpInfo contains information about planned scale-up of a single NodeGroup
func (ScaleUpInfo) String ¶
func (s ScaleUpInfo) String() string
String is used for printing ScaleUpInfo for logging, etc