clusterstate

package
v0.0.0-...-89f796a Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxNodeStartupTime is the maximum time from the moment the node is registered to the time the node is ready.
	MaxNodeStartupTime = 5 * time.Minute

	// MaxStatusSettingDelayAfterCreation is the maximum time for node to set its initial status after the
	// node is registered.
	MaxStatusSettingDelayAfterCreation = time.Minute
)

Variables

This section is empty.

Functions

func GetReadinessState

func GetReadinessState(node *apiv1.Node) (isNodeReady bool, lastTransitionTime time.Time, err error)

GetReadinessState gets readiness state for the node

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

type ClusterStateRegistry struct {
	sync.Mutex
	// contains filtered or unexported fields
}

ClusterStateRegistry is a structure to keep track the current state of the cluster.

func NewClusterStateRegistry

func NewClusterStateRegistry(cloudProvider cloudprovider.CloudProvider, config ClusterStateRegistryConfig) *ClusterStateRegistry

NewClusterStateRegistry creates new ClusterStateRegistry.

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 functiom may overestimate the number of nodes.

func (*ClusterStateRegistry) IsClusterHealthy

func (csr *ClusterStateRegistry) IsClusterHealthy(currentTime time.Time) 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) 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

func (csr *ClusterStateRegistry) UpdateNodes(nodes []*apiv1.Node, currentTime time.Time) error

UpdateNodes updates the state of the nodes in the ClusterStateRegistry and recalculates the statss

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 higer than that then MaxTotalUnreadyPercentage applies.
	OkTotalUnreadyCount int
}

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 whtn 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
}

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 excpected 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.

Jump to

Keyboard shortcuts

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