nodegroupset

package
v0.0.0-...-0c26da3 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 12 Imported by: 7

Documentation

Index

Constants

View Source
const AzureDiskTopologyKey = "topology.disk.csi.azure.com/zone"

AzureDiskTopologyKey is the topology key of Azure Disk CSI driver

View Source
const AzureNodepoolLabel = "kubernetes.azure.com/agentpool"

AzureNodepoolLabel is an AKS label specifying which nodepool a particular node belongs to

View Source
const AzureNodepoolLegacyLabel = "agentpool"

AzureNodepoolLegacyLabel is a label specifying which Azure node pool a particular node belongs to.

Variables

View Source
var BasicIgnoredLabels = map[string]bool{
	apiv1.LabelHostname:                   true,
	apiv1.LabelZoneFailureDomain:          true,
	apiv1.LabelZoneRegion:                 true,
	apiv1.LabelZoneFailureDomainStable:    true,
	apiv1.LabelZoneRegionStable:           true,
	"beta.kubernetes.io/fluentd-ds-ready": true,
	"kops.k8s.io/instancegroup":           true,
}

BasicIgnoredLabels define a set of basic labels that should be ignored when comparing the similarity of two nodes. Customized IgnoredLabels can be implemented in the corresponding codes of specific cloud provider and the BasicIgnoredLabels should always be considered part of them.

Functions

func IsCloudProviderNodeInfoSimilar

func IsCloudProviderNodeInfoSimilar(
	n1, n2 *schedulerframework.NodeInfo, ignoredLabels map[string]bool, ratioOpts config.NodeGroupDifferenceRatios) bool

IsCloudProviderNodeInfoSimilar 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 set of labels passed in to be ignored 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

FindSimilarNodeGroups returns a list of NodeGroups similar to the given one using the BalancingNodeGroupSetProcessor's comparator function.

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

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]*schedulerframework.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(ignoredLabels []string, ratioOpts config.NodeGroupDifferenceRatios) NodeGroupSetProcessor

NewDefaultNodeGroupSetProcessor creates an instance of NodeGroupSetProcessor.

type NodeInfoComparator

type NodeInfoComparator func(n1, n2 *schedulerframework.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.

func CreateAwsNodeInfoComparator

func CreateAwsNodeInfoComparator(extraIgnoredLabels []string, ratioOpts config.NodeGroupDifferenceRatios) NodeInfoComparator

CreateAwsNodeInfoComparator returns a comparator that checks if two nodes should be considered part of the same NodeGroupSet. This is true if they match usual conditions checked by IsCloudProviderNodeInfoSimilar, even if they have different AWS-specific labels.

func CreateAzureNodeInfoComparator

func CreateAzureNodeInfoComparator(extraIgnoredLabels []string, ratioOpts config.NodeGroupDifferenceRatios) NodeInfoComparator

CreateAzureNodeInfoComparator returns a comparator that checks if two nodes should be considered part of the same NodeGroupSet. This is true if they either belong to the same Azure agentpool or match usual conditions checked by IsCloudProviderNodeInfoSimilar, even if they have different agentpool labels.

func CreateGceNodeInfoComparator

func CreateGceNodeInfoComparator(extraIgnoredLabels []string, ratioOpts config.NodeGroupDifferenceRatios) NodeInfoComparator

CreateGceNodeInfoComparator returns a comparator that checks if two nodes should be considered part of the same NodeGroupSet. This is true if they match usual conditions checked by IsCloudProviderNodeInfoSimilar, even if they have different GCE-specific labels.

func CreateGenericNodeInfoComparator

func CreateGenericNodeInfoComparator(extraIgnoredLabels []string, ratioOpts config.NodeGroupDifferenceRatios) NodeInfoComparator

CreateGenericNodeInfoComparator returns a generic comparator that checks for node group similarity

func CreateLabelNodeInfoComparator

func CreateLabelNodeInfoComparator(labels []string) NodeInfoComparator

CreateLabelNodeInfoComparator returns a comparator that checks for node group similarity using the given labels.

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

Jump to

Keyboard shortcuts

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