orchestrator

package
v0.0.0-...-eeb2ccb Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// BackoffReason node group is in backoff.
	BackoffReason = NewSkippedReasons("in backoff after failed scale-up")
	// MaxLimitReachedReason node group reached max size limit.
	MaxLimitReachedReason = NewSkippedReasons("max node group size reached")
	// NotReadyReason node group is not ready.
	NotReadyReason = NewSkippedReasons("not ready for scale-up")
)
View Source
var (
	// AllOrNothingReason means the node group was rejected because not all pods would fit it when using all-or-nothing strategy.
	AllOrNothingReason = NewRejectedReasons("not all pods would fit and scale-up is using all-or-nothing strategy")
)

Functions

func GetPodsAwaitingEvaluation

func GetPodsAwaitingEvaluation(egs []*equivalence.PodGroup, bestOption string) []*apiv1.Pod

GetPodsAwaitingEvaluation returns list of pods for which CA was unable to help this scale up loop (but should be able to help).

func GetRemainingPods

func GetRemainingPods(egs []*equivalence.PodGroup, skipped map[string]status.Reasons) []status.NoScaleUpInfo

GetRemainingPods returns information about pods which CA is unable to help at this moment.

Types

type AsyncNodeGroupInitializer

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

AsyncNodeGroupInitializer is a component of the Orchestrator responsible for initial scale up of asynchronously created node groups.

func (*AsyncNodeGroupInitializer) ChangeTargetSize

func (s *AsyncNodeGroupInitializer) ChangeTargetSize(nodeGroup string, delta int64)

ChangeTargetSize changes by delta a target size of an upcoming node group.

func (*AsyncNodeGroupInitializer) GetTargetSize

func (s *AsyncNodeGroupInitializer) GetTargetSize(nodeGroup string) int64

GetTargetSize returns a target size of an upcoming node group.

func (*AsyncNodeGroupInitializer) InitializeNodeGroup

func (s *AsyncNodeGroupInitializer) InitializeNodeGroup(result nodegroups.AsyncNodeGroupCreationResult)

InitializeNodeGroup performs the initial scale up of the node group and all additionally created node groups.

func (*AsyncNodeGroupInitializer) SetTargetSize

func (s *AsyncNodeGroupInitializer) SetTargetSize(nodeGroup string, size int64)

SetTargetSize sets a target size of an upcoming node group.

type MaxResourceLimitReached

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

MaxResourceLimitReached contains information why given node group was skipped.

func NewMaxResourceLimitReached

func NewMaxResourceLimitReached(resources []string) *MaxResourceLimitReached

NewMaxResourceLimitReached returns a reason describing which cluster wide resource limits were reached.

func (*MaxResourceLimitReached) Reasons

func (sr *MaxResourceLimitReached) Reasons() []string

Reasons returns a slice of reasons why the node group was not considered for scale up.

func (*MaxResourceLimitReached) Resources

func (sr *MaxResourceLimitReached) Resources() []string

Resources returns a slice of resources which were missing in the node group.

type RejectedReasons

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

RejectedReasons contains information why given node group was rejected as a scale-up option.

func NewRejectedReasons

func NewRejectedReasons(m string) *RejectedReasons

NewRejectedReasons creates new RejectedReason object.

func (*RejectedReasons) Reasons

func (sr *RejectedReasons) Reasons() []string

Reasons returns a slice of reasons why the node group was not considered for scale up.

type ScaleUpOrchestrator

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

ScaleUpOrchestrator implements scaleup.Orchestrator interface.

func New

func New() *ScaleUpOrchestrator

New returns new instance of scale up Orchestrator.

func (*ScaleUpOrchestrator) ComputeExpansionOption

func (o *ScaleUpOrchestrator) ComputeExpansionOption(
	nodeGroup cloudprovider.NodeGroup,
	schedulablePodGroups map[string][]estimator.PodEquivalenceGroup,
	nodeInfos map[string]*framework.NodeInfo,
	currentNodeCount int,
	now time.Time,
	allOrNothing bool,
) expander.Option

ComputeExpansionOption computes expansion option based on pending pods and cluster state.

func (*ScaleUpOrchestrator) ComputeSimilarNodeGroups

func (o *ScaleUpOrchestrator) ComputeSimilarNodeGroups(
	nodeGroup cloudprovider.NodeGroup,
	nodeInfos map[string]*framework.NodeInfo,
	schedulablePodGroups map[string][]estimator.PodEquivalenceGroup,
	now time.Time,
) []cloudprovider.NodeGroup

ComputeSimilarNodeGroups finds similar node groups which can schedule the same set of pods as the main node group.

func (*ScaleUpOrchestrator) CreateNodeGroup

func (o *ScaleUpOrchestrator) CreateNodeGroup(
	initialOption *expander.Option,
	nodeInfos map[string]*framework.NodeInfo,
	schedulablePodGroups map[string][]estimator.PodEquivalenceGroup,
	podEquivalenceGroups []*equivalence.PodGroup,
	daemonSets []*appsv1.DaemonSet,
	allOrNothing bool,
) ([]nodegroups.CreateNodeGroupResult, *status.ScaleUpStatus, errors.AutoscalerError)

CreateNodeGroup will try to create a new node group based on the initialOption.

func (*ScaleUpOrchestrator) GetCappedNewNodeCount

func (o *ScaleUpOrchestrator) GetCappedNewNodeCount(newNodeCount, currentNodeCount int) (int, errors.AutoscalerError)

GetCappedNewNodeCount caps resize according to cluster wide node count limit.

func (*ScaleUpOrchestrator) Initialize

func (o *ScaleUpOrchestrator) Initialize(
	autoscalingContext *context.AutoscalingContext,
	processors *ca_processors.AutoscalingProcessors,
	clusterStateRegistry *clusterstate.ClusterStateRegistry,
	estimatorBuilder estimator.EstimatorBuilder,
	taintConfig taints.TaintConfig,
)

Initialize initializes the orchestrator object with required fields.

func (*ScaleUpOrchestrator) IsNodeGroupReadyToScaleUp

func (o *ScaleUpOrchestrator) IsNodeGroupReadyToScaleUp(nodeGroup cloudprovider.NodeGroup, now time.Time) *SkippedReasons

IsNodeGroupReadyToScaleUp returns nil if node group is ready to be scaled up, otherwise a reason is provided.

func (*ScaleUpOrchestrator) IsNodeGroupResourceExceeded

func (o *ScaleUpOrchestrator) IsNodeGroupResourceExceeded(resourcesLeft resource.Limits, nodeGroup cloudprovider.NodeGroup, nodeInfo *framework.NodeInfo, numNodes int) status.Reasons

IsNodeGroupResourceExceeded returns nil if node group resource limits are not exceeded, otherwise a reason is provided.

func (*ScaleUpOrchestrator) ScaleUp

func (o *ScaleUpOrchestrator) ScaleUp(
	unschedulablePods []*apiv1.Pod,
	nodes []*apiv1.Node,
	daemonSets []*appsv1.DaemonSet,
	nodeInfos map[string]*framework.NodeInfo,
	allOrNothing bool,
) (*status.ScaleUpStatus, errors.AutoscalerError)

ScaleUp tries to scale the cluster up. Returns appropriate status or error if an unexpected error occurred. Assumes that all nodes in the cluster are ready and in sync with instance groups.

func (*ScaleUpOrchestrator) ScaleUpToNodeGroupMinSize

func (o *ScaleUpOrchestrator) ScaleUpToNodeGroupMinSize(
	nodes []*apiv1.Node,
	nodeInfos map[string]*framework.NodeInfo,
) (*status.ScaleUpStatus, errors.AutoscalerError)

ScaleUpToNodeGroupMinSize tries to scale up node groups that have less nodes than the configured min size. The source of truth for the current node group size is the TargetSize queried directly from cloud providers. Returns appropriate status or error if an unexpected error occurred.

func (*ScaleUpOrchestrator) SchedulablePodGroups

func (o *ScaleUpOrchestrator) SchedulablePodGroups(
	podEquivalenceGroups []*equivalence.PodGroup,
	nodeGroup cloudprovider.NodeGroup,
	nodeInfo *framework.NodeInfo,
) []estimator.PodEquivalenceGroup

SchedulablePodGroups returns a list of pods that could be scheduled in a given node group after a scale up.

func (*ScaleUpOrchestrator) UpcomingNodes

func (o *ScaleUpOrchestrator) UpcomingNodes(nodeInfos map[string]*framework.NodeInfo) ([]*framework.NodeInfo, errors.AutoscalerError)

UpcomingNodes returns a list of nodes that are not ready but should be.

type SkippedReasons

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

SkippedReasons contains information why given node group was skipped.

func NewSkippedReasons

func NewSkippedReasons(m string) *SkippedReasons

NewSkippedReasons creates new SkippedReason object.

func (*SkippedReasons) Reasons

func (sr *SkippedReasons) Reasons() []string

Reasons returns a slice of reasons why the node group was not considered for scale up.

Jump to

Keyboard shortcuts

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