Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(cfg *config.Config, k8scli kubernetes.Interface, nodeProviders map[string]NodeProvider, mReg metrics.Instrumenter, logger log.Logger) controller.Controller
New creates a node reaper controller.
Types ¶
type ClusterHealthCalculator ¶
ClusterHealthCalculator implements heuristics to decide whether too many Nodes are unhealthy before reaping of a node
func NewAbsoluteClusterHealthCalculator ¶
func NewAbsoluteClusterHealthCalculator(maxUnhealthyNodes uint) ClusterHealthCalculator
NewAbsoluteClusterHealthCalculator calculates cluster health by absolute number of unhealthy Nodes
func NewClusterHealthCalculator ¶
func NewClusterHealthCalculator(mnu config.MaxNodesUnhealthy) (ClusterHealthCalculator, error)
NewClusterHealthCalculator creates a cluster health calculator of type in pseudo enum noderepaer.MaxNodesUnhealthyType
func NewPercentualClusterHealthCalculator ¶
func NewPercentualClusterHealthCalculator(maxUnhealthyNodesPercent uint) ClusterHealthCalculator
NewPercentualClusterHealthCalculator calculates cluster health by percentage of unhealthy Nodes
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is the Node Reaper handler
type NodeEvaluablePredicate ¶
type NodeEvaluablePredicate struct { Expression string EvaluableExpression *govaluate.EvaluableExpression }
NodeEvaluablePredicate holds an evaluableExpression and a node
func NewEvaluablePredicate ¶
func NewEvaluablePredicate(expression string) (NodeEvaluablePredicate, error)
NewEvaluablePredicate creates an initialised NodeEvaluablePredicate for evaluating Node health
type NodeProvider ¶
type NodeProvider interface { // Reap deletes a node from a backing node provider such as aws, gcloud or azure. Reap(corev1.Node) error // Type returns the Node Provider Type // The string returned must match the prefix of the node's spec.providerID. The prefix is the text before colon, in other words with regex (?:(?!:).)* // Example: for the node spec below, it has to match aws. // --- // spec: // externalID: i-0cd1c351f3c0d11a1 // providerID: aws:///us-west-2a/i-0cd1c351f3c0d11a1 // unschedulable: true Type() string }
NodeProvider must be implemented by plugins that supply a Node Provider
func LoadNodeProviderPlugin ¶
func LoadNodeProviderPlugin(path string) (NodeProvider, error)
LoadNodeProviderPlugin loads a NodeProvider plugin
type NodeProviders ¶
type NodeProviders map[string]NodeProvider
NodeProviders serves to standardise how a collection of NodeProvider should be represented
type NodeReaper ¶
type NodeReaper struct {
// contains filtered or unexported fields
}
NodeReaper is the Node Reaper
func (NodeReaper) Run ¶
func (nr NodeReaper) Run(node *corev1.Node) error
Run assesses the reapability of a node, then reaps it if all conditions are met
func (*NodeReaper) SetDrainNodeFn ¶
func (nr *NodeReaper) SetDrainNodeFn(fn drainNodeFn) *NodeReaper
SetDrainNodeFn sets nr.drainNodeFn for mocking
func (*NodeReaper) SetGetNodesFn ¶
func (nr *NodeReaper) SetGetNodesFn(fn getNodesFn) *NodeReaper
SetGetNodesFn sets nr.getNodesFn for mocking