Documentation ¶
Index ¶
- Constants
- func ConfigurePredicateCheckerForLoop(unschedulablePods []*apiv1.Pod, schedulablePods []*apiv1.Pod, ...)
- func NewFilterOutSchedulablePodListProcessor() pods.PodListProcessor
- func NewScaleTestAutoscalingContext(options config.AutoscalingOptions, fakeClient kube_client.Interface, ...) context.AutoscalingContext
- func NewTestProcessors() *processors.AutoscalingProcessors
- func ScaleUp(context *context.AutoscalingContext, ...) (*status.ScaleUpStatus, errors.AutoscalerError)
- func UpdateClusterStateMetrics(csr *clusterstate.ClusterStateRegistry)
- type Autoscaler
- type AutoscalerOptions
- type NodeDeleteStatus
- func (n *NodeDeleteStatus) AddNodeDeleteResult(nodeName string, result status.NodeDeleteResult)
- func (n *NodeDeleteStatus) GetAndClearNodeDeleteResults() map[string]status.NodeDeleteResult
- func (n *NodeDeleteStatus) IsDeleteInProgress() bool
- func (n *NodeDeleteStatus) SetDeleteInProgress(status bool)
- type ScaleDown
- func (sd *ScaleDown) CleanUp(timestamp time.Time)
- func (sd *ScaleDown) CleanUpUnneededNodes()
- func (sd *ScaleDown) GetCandidatesForScaleDown() []*apiv1.Node
- func (sd *ScaleDown) SoftTaintUnneededNodes(allNodes []*apiv1.Node) (errors []error)
- func (sd *ScaleDown) TryToScaleDown(allNodes []*apiv1.Node, pods []*apiv1.Pod, ...) (*status.ScaleDownStatus, errors.AutoscalerError)
- func (sd *ScaleDown) UpdateUnneededNodes(nodes []*apiv1.Node, nodesToCheck []*apiv1.Node, pods []*apiv1.Pod, ...) errors.AutoscalerError
- type StaticAutoscaler
Constants ¶
const ( // MaxKubernetesEmptyNodeDeletionTime is the maximum time needed by Kubernetes to delete an empty node. MaxKubernetesEmptyNodeDeletionTime = 3 * time.Minute // MaxCloudProviderNodeDeletionTime is the maximum time needed by cloud provider to delete a node. MaxCloudProviderNodeDeletionTime = 5 * time.Minute // MaxPodEvictionTime is the maximum time CA tries to evict a pod before giving up. MaxPodEvictionTime = 2 * time.Minute // EvictionRetryTime is the time after CA retries failed pod eviction. EvictionRetryTime = 10 * time.Second // PodEvictionHeadroom is the extra time we wait to catch situations when the pod is ignoring SIGTERM and // is killed with SIGKILL after MaxGracefulTerminationTime PodEvictionHeadroom = 30 * time.Second )
const (
// ReschedulerTaintKey is the name of the taint created by rescheduler.
ReschedulerTaintKey = "CriticalAddonsOnly"
)
const (
// ScaleDownDisabledKey is the name of annotation marking node as not eligible for scale down.
ScaleDownDisabledKey = "cluster-autoscaler.kubernetes.io/scale-down-disabled"
)
Variables ¶
This section is empty.
Functions ¶
func ConfigurePredicateCheckerForLoop ¶
func ConfigurePredicateCheckerForLoop(unschedulablePods []*apiv1.Pod, schedulablePods []*apiv1.Pod, predicateChecker *simulator.PredicateChecker)
ConfigurePredicateCheckerForLoop can be run to update predicateChecker configuration based on current state of the cluster.
func NewFilterOutSchedulablePodListProcessor ¶
func NewFilterOutSchedulablePodListProcessor() pods.PodListProcessor
NewFilterOutSchedulablePodListProcessor creates a PodListProcessor filtering out schedulable pods
func NewScaleTestAutoscalingContext ¶
func NewScaleTestAutoscalingContext( options config.AutoscalingOptions, fakeClient kube_client.Interface, listers kube_util.ListerRegistry, provider cloudprovider.CloudProvider, processorCallbacks processor_callbacks.ProcessorCallbacks) context.AutoscalingContext
NewScaleTestAutoscalingContext creates a new test autoscaling context for scaling tests.
func NewTestProcessors ¶
func NewTestProcessors() *processors.AutoscalingProcessors
NewTestProcessors returns a set of simple processors for use in tests.
func ScaleUp ¶
func ScaleUp(context *context.AutoscalingContext, processors *ca_processors.AutoscalingProcessors, clusterStateRegistry *clusterstate.ClusterStateRegistry, unschedulablePods []*apiv1.Pod, nodes []*apiv1.Node, daemonSets []*appsv1.DaemonSet, nodeInfos map[string]*schedulernodeinfo.NodeInfo) (*status.ScaleUpStatus, errors.AutoscalerError)
ScaleUp tries to scale the cluster up. Return true if it found a way to increase the size, false if it didn't and error if an error occurred. Assumes that all nodes in the cluster are ready and in sync with instance groups.
func UpdateClusterStateMetrics ¶
func UpdateClusterStateMetrics(csr *clusterstate.ClusterStateRegistry)
UpdateClusterStateMetrics updates metrics related to cluster state
Types ¶
type Autoscaler ¶
type Autoscaler interface { // RunOnce represents an iteration in the control-loop of CA RunOnce(currentTime time.Time) errors.AutoscalerError // ExitCleanUp is a clean-up performed just before process termination. ExitCleanUp() }
Autoscaler is the main component of CA which scales up/down node groups according to its configuration The configuration can be injected at the creation of an autoscaler
func NewAutoscaler ¶
func NewAutoscaler(opts AutoscalerOptions) (Autoscaler, errors.AutoscalerError)
NewAutoscaler creates an autoscaler of an appropriate type according to the parameters
type AutoscalerOptions ¶
type AutoscalerOptions struct { config.AutoscalingOptions KubeClient kube_client.Interface EventsKubeClient kube_client.Interface AutoscalingKubeClients *context.AutoscalingKubeClients CloudProvider cloudprovider.CloudProvider PredicateChecker *simulator.PredicateChecker ExpanderStrategy expander.Strategy EstimatorBuilder estimator.EstimatorBuilder Processors *ca_processors.AutoscalingProcessors Backoff backoff.Backoff }
AutoscalerOptions is the whole set of options for configuring an autoscaler
type NodeDeleteStatus ¶
NodeDeleteStatus tells whether a node is being deleted right now.
func (*NodeDeleteStatus) AddNodeDeleteResult ¶
func (n *NodeDeleteStatus) AddNodeDeleteResult(nodeName string, result status.NodeDeleteResult)
AddNodeDeleteResult adds a node delete result to the result map.
func (*NodeDeleteStatus) GetAndClearNodeDeleteResults ¶
func (n *NodeDeleteStatus) GetAndClearNodeDeleteResults() map[string]status.NodeDeleteResult
GetAndClearNodeDeleteResults returns the whole result map and replaces it with a new empty one.
func (*NodeDeleteStatus) IsDeleteInProgress ¶
func (n *NodeDeleteStatus) IsDeleteInProgress() bool
IsDeleteInProgress returns true if a node is being deleted.
func (*NodeDeleteStatus) SetDeleteInProgress ¶
func (n *NodeDeleteStatus) SetDeleteInProgress(status bool)
SetDeleteInProgress sets deletion process status
type ScaleDown ¶
type ScaleDown struct {
// contains filtered or unexported fields
}
ScaleDown is responsible for maintaining the state needed to perform unneeded node removals.
func NewScaleDown ¶
func NewScaleDown(context *context.AutoscalingContext, clusterStateRegistry *clusterstate.ClusterStateRegistry) *ScaleDown
NewScaleDown builds new ScaleDown object.
func (*ScaleDown) CleanUpUnneededNodes ¶
func (sd *ScaleDown) CleanUpUnneededNodes()
CleanUpUnneededNodes clears the list of unneeded nodes.
func (*ScaleDown) GetCandidatesForScaleDown ¶
GetCandidatesForScaleDown gets candidates for scale down.
func (*ScaleDown) SoftTaintUnneededNodes ¶
SoftTaintUnneededNodes manage soft taints of unneeded nodes.
func (*ScaleDown) TryToScaleDown ¶
func (sd *ScaleDown) TryToScaleDown(allNodes []*apiv1.Node, pods []*apiv1.Pod, pdbs []*policyv1.PodDisruptionBudget, currentTime time.Time) (*status.ScaleDownStatus, errors.AutoscalerError)
TryToScaleDown tries to scale down the cluster. It returns a result inside a ScaleDownStatus indicating if any node was removed and error if such occurred.
func (*ScaleDown) UpdateUnneededNodes ¶
func (sd *ScaleDown) UpdateUnneededNodes( nodes []*apiv1.Node, nodesToCheck []*apiv1.Node, pods []*apiv1.Pod, timestamp time.Time, pdbs []*policyv1.PodDisruptionBudget) errors.AutoscalerError
UpdateUnneededNodes calculates which nodes are not needed, i.e. all pods can be scheduled somewhere else, and updates unneededNodes map accordingly. It also computes information where pods can be rescheduled and node utilization level. Timestamp is the current timestamp. The computations are made only for the nodes managed by CA.
type StaticAutoscaler ¶
type StaticAutoscaler struct { // AutoscalingContext consists of validated settings and options for this autoscaler *context.AutoscalingContext // contains filtered or unexported fields }
StaticAutoscaler is an autoscaler which has all the core functionality of a CA but without the reconfiguration feature
func NewStaticAutoscaler ¶
func NewStaticAutoscaler( opts config.AutoscalingOptions, predicateChecker *simulator.PredicateChecker, autoscalingKubeClients *context.AutoscalingKubeClients, processors *ca_processors.AutoscalingProcessors, cloudProvider cloudprovider.CloudProvider, expanderStrategy expander.Strategy, estimatorBuilder estimator.EstimatorBuilder, backoff backoff.Backoff) *StaticAutoscaler
NewStaticAutoscaler creates an instance of Autoscaler filled with provided parameters
func (*StaticAutoscaler) ExitCleanUp ¶
func (a *StaticAutoscaler) ExitCleanUp()
ExitCleanUp performs all necessary clean-ups when the autoscaler's exiting.
func (*StaticAutoscaler) RunOnce ¶
func (a *StaticAutoscaler) RunOnce(currentTime time.Time) errors.AutoscalerError
RunOnce iterates over node groups and scales them up/down if necessary