detector

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2020 License: Apache-2.0 Imports: 9 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsInvalidConfig

func IsInvalidConfig(err error) bool

IsInvalidConfig asserts invalidConfigError.

Types

type Config

type Config struct {
	Logger    micrologger.Logger
	K8sClient client.Client

	// MaxNodeTerminationPercentage defines a maximum percentage of nodes that will be returned as 'marked for termination'
	// ie: if the value is 0.5 and cluster have 10 nodes, than `DetectBadNodes`can only return maximum of 5 nodes
	// marked for termination at single run
	MaxNodeTerminationPercentage float64
	// NotReadyTickThreshold defines a how many times the node must bee seen as NotReady in order to return it as 'marked for termination'
	NotReadyTickThreshold int
	// PauseBetweenTermination defines a pause between 2 intervals where node termination can occur.
	// This is a safeguard to prevent nodes being terminated over and over or to not terminate too much at once.
	// ie: if the value is 5m it means once it returned nodes for termination it wont return another nodes for another 5 min.
	PauseBetweenTermination time.Duration
}

type Detector

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

func NewDetector

func NewDetector(config Config) (*Detector, error)

func (*Detector) DetectBadNodes

func (d *Detector) DetectBadNodes(ctx context.Context) ([]corev1.Node, error)

DetectBadNodes will return list of nodes that should be terminated which in documentation terminology is used as 'marked for termination'.

func (*Detector) ResetTickCounters added in v1.0.1

func (d *Detector) ResetTickCounters(ctx context.Context) error

ResetTickCounters will reset tick counters to zero on all k8s nodes in a cluster

Jump to

Keyboard shortcuts

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