Documentation ¶
Index ¶
- Constants
- type AcceptableRange
- type ClusterStateRegistry
- func (csr *ClusterStateRegistry) GetClusterReadiness() Readiness
- func (csr *ClusterStateRegistry) GetIncorrectNodeGroupSize(nodeGroupName string) *IncorrectNodeGroupSize
- func (csr *ClusterStateRegistry) GetStatus(now time.Time) *api.ClusterAutoscalerStatus
- func (csr *ClusterStateRegistry) GetUnregisteredNodes() []UnregisteredNode
- func (csr *ClusterStateRegistry) GetUpcomingNodes() map[string]int
- func (csr *ClusterStateRegistry) IsClusterHealthy() bool
- func (csr *ClusterStateRegistry) IsNodeGroupHealthy(nodeGroupName string) bool
- func (csr *ClusterStateRegistry) IsNodeGroupSafeToScaleUp(nodeGroupName string, now time.Time) bool
- func (csr *ClusterStateRegistry) IsNodeGroupScalingUp(nodeGroupName string) bool
- func (csr *ClusterStateRegistry) Recalculate()
- func (csr *ClusterStateRegistry) RegisterFailedScaleUp(nodeGroupName string, reason metrics.FailedScaleUpReason)
- func (csr *ClusterStateRegistry) RegisterScaleDown(request *ScaleDownRequest)
- func (csr *ClusterStateRegistry) RegisterScaleUp(request *ScaleUpRequest)
- func (csr *ClusterStateRegistry) UpdateNodes(nodes []*apiv1.Node, currentTime time.Time) error
- func (csr *ClusterStateRegistry) UpdateScaleDownCandidates(nodes []*apiv1.Node, now time.Time)
- type ClusterStateRegistryConfig
- type IncorrectNodeGroupSize
- type Readiness
- type ScaleDownRequest
- type ScaleUpRequest
- type UnregisteredNode
Constants ¶
const ( // MaxNodeStartupTime is the maximum time from the moment the node is registered to the time the node is ready. MaxNodeStartupTime = 15 * time.Minute // MaxStatusSettingDelayAfterCreation is the maximum time for node to set its initial status after the // node is registered. MaxStatusSettingDelayAfterCreation = 2 * time.Minute // MaxNodeGroupBackoffDuration is the maximum backoff duration for a NodeGroup after new nodes failed to start. MaxNodeGroupBackoffDuration = 30 * time.Minute // InitialNodeGroupBackoffDuration is the duration of first backoff after a new node failed to start. InitialNodeGroupBackoffDuration = 5 * time.Minute // NodeGroupBackoffResetTimeout is the time after last failed scale-up when the backoff duration is reset. NodeGroupBackoffResetTimeout = 3 * time.Hour )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AcceptableRange ¶
type AcceptableRange struct { // MinNodes is the minimum number of nodes in the group. MinNodes int // MaxNodes is the maximum number of nodes in the group. MaxNodes int // CurrentTarget is the current target size of the group. CurrentTarget int }
AcceptableRange contains information about acceptable size of a node group.
type ClusterStateRegistry ¶
ClusterStateRegistry is a structure to keep track the current state of the cluster.
func NewClusterStateRegistry ¶
func NewClusterStateRegistry(cloudProvider cloudprovider.CloudProvider, config ClusterStateRegistryConfig, logRecorder *utils.LogEventRecorder) *ClusterStateRegistry
NewClusterStateRegistry creates new ClusterStateRegistry.
func (*ClusterStateRegistry) GetClusterReadiness ¶
func (csr *ClusterStateRegistry) GetClusterReadiness() Readiness
GetClusterReadiness returns current readiness stats of cluster
func (*ClusterStateRegistry) GetIncorrectNodeGroupSize ¶
func (csr *ClusterStateRegistry) GetIncorrectNodeGroupSize(nodeGroupName string) *IncorrectNodeGroupSize
GetIncorrectNodeGroupSize gets IncorrectNodeGroupSizeInformation for the given node group.
func (*ClusterStateRegistry) GetStatus ¶
func (csr *ClusterStateRegistry) GetStatus(now time.Time) *api.ClusterAutoscalerStatus
GetStatus returns ClusterAutoscalerStatus with the current cluster autoscaler status.
func (*ClusterStateRegistry) GetUnregisteredNodes ¶
func (csr *ClusterStateRegistry) GetUnregisteredNodes() []UnregisteredNode
GetUnregisteredNodes returns a list of all unregistered nodes.
func (*ClusterStateRegistry) GetUpcomingNodes ¶
func (csr *ClusterStateRegistry) GetUpcomingNodes() map[string]int
GetUpcomingNodes returns how many new nodes will be added shortly to the node groups or should become ready soon. The function may overestimate the number of nodes.
func (*ClusterStateRegistry) IsClusterHealthy ¶
func (csr *ClusterStateRegistry) IsClusterHealthy() bool
IsClusterHealthy returns true if the cluster health is within the acceptable limits
func (*ClusterStateRegistry) IsNodeGroupHealthy ¶
func (csr *ClusterStateRegistry) IsNodeGroupHealthy(nodeGroupName string) bool
IsNodeGroupHealthy returns true if the node group health is within the acceptable limits
func (*ClusterStateRegistry) IsNodeGroupSafeToScaleUp ¶
func (csr *ClusterStateRegistry) IsNodeGroupSafeToScaleUp(nodeGroupName string, now time.Time) bool
IsNodeGroupSafeToScaleUp returns true if node group can be scaled up now.
func (*ClusterStateRegistry) IsNodeGroupScalingUp ¶
func (csr *ClusterStateRegistry) IsNodeGroupScalingUp(nodeGroupName string) bool
IsNodeGroupScalingUp returns true if the node group is currently scaling up.
func (*ClusterStateRegistry) Recalculate ¶
func (csr *ClusterStateRegistry) Recalculate()
Recalculate cluster state after scale-ups or scale-downs were registered.
func (*ClusterStateRegistry) RegisterFailedScaleUp ¶
func (csr *ClusterStateRegistry) RegisterFailedScaleUp(nodeGroupName string, reason metrics.FailedScaleUpReason)
RegisterFailedScaleUp should be called after getting error from cloudprovider when trying to scale-up node group. It will mark this group as not safe to autoscale for some time.
func (*ClusterStateRegistry) RegisterScaleDown ¶
func (csr *ClusterStateRegistry) RegisterScaleDown(request *ScaleDownRequest)
RegisterScaleDown registers node scale down.
func (*ClusterStateRegistry) RegisterScaleUp ¶
func (csr *ClusterStateRegistry) RegisterScaleUp(request *ScaleUpRequest)
RegisterScaleUp registers scale up.
func (*ClusterStateRegistry) UpdateNodes ¶
UpdateNodes updates the state of the nodes in the ClusterStateRegistry and recalculates the stats
func (*ClusterStateRegistry) UpdateScaleDownCandidates ¶
func (csr *ClusterStateRegistry) UpdateScaleDownCandidates(nodes []*apiv1.Node, now time.Time)
UpdateScaleDownCandidates updates scale down candidates
type ClusterStateRegistryConfig ¶
type ClusterStateRegistryConfig struct { // Maximum percentage of unready nodes in total in, if the number is higher than OkTotalUnreadyCount MaxTotalUnreadyPercentage float64 // Number of nodes that can be unready in total. If the number is higher than that then MaxTotalUnreadyPercentage applies. OkTotalUnreadyCount int // Maximum time CA waits for node to be provisioned MaxNodeProvisionTime time.Duration }
ClusterStateRegistryConfig contains configuration information for ClusterStateRegistry.
type IncorrectNodeGroupSize ¶
type IncorrectNodeGroupSize struct { // ExpectedSize is the size of the node group measured on the cloud provider side. ExpectedSize int // CurrentSize is the size of the node group measured on the kubernetes side. CurrentSize int // FirstObserved is the time when the given difference occurred. FirstObserved time.Time }
IncorrectNodeGroupSize contains information about how much the current size of the node group differs from the expected size. Prolonged, stable mismatch is an indication of quota or startup issues.
type Readiness ¶
type Readiness struct { // Number of ready nodes. Ready int // Number of unready nodes that broke down after they started. Unready int // Number of nodes that are being currently deleted. They exist in K8S but // are not included in NodeGroup.TargetSize(). Deleted int // Number of nodes that failed to start within a reasonable limit. LongNotStarted int // Number of nodes that are not yet fully started. NotStarted int // Number of all registered nodes in the group (ready/unready/deleted/etc). Registered int // Number of nodes that failed to register within a reasonable limit. LongUnregistered int // Number of nodes that haven't yet registered. Unregistered int // Time when the readiness was measured. Time time.Time }
Readiness contains readiness information about a group of nodes.
type ScaleDownRequest ¶
type ScaleDownRequest struct { // NodeName is the name of the node to be deleted. NodeName string // NodeGroupName is the node group of the deleted node. NodeGroupName string // Time is the time when the node deletion was requested. Time time.Time // ExpectedDeleteTime is the time when the node is expected to be deleted. ExpectedDeleteTime time.Time }
ScaleDownRequest contains information about the requested node deletion.
type ScaleUpRequest ¶
type ScaleUpRequest struct { // NodeGroupName is the node group to be scaled up. NodeGroupName string // Time is the time when the request was submitted. Time time.Time // ExpectedAddTime is the time at which the request should be fulfilled. ExpectedAddTime time.Time // How much the node group is increased. Increase int }
ScaleUpRequest contains information about the requested node group scale up.
type UnregisteredNode ¶
type UnregisteredNode struct { // Node is a dummy node that contains only the name of the node. Node *apiv1.Node // UnregisteredSince is the time when the node was first spotted. UnregisteredSince time.Time }
UnregisteredNode contains information about nodes that are present on the cluster provider side but failed to register in Kubernetes.