deletion

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIProvider

type APIProvider interface {
	Run(<-chan struct{})
	DesiredGroupSize(string) (int, error)
	OutdatedLaunchConfig(*config.Ops, *core_v1.Node) (bool, error)
	PreDrain(*config.Ops, *core_v1.Node) error
	DetachNode(*config.Ops, *core_v1.Node) error
}

APIProvider handles the provider-specific API requests needed for getting the needed instanceGroupsize and any provider-specific drain logic

type Deleter

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

Deleter handles the actual deletion logic

func New

func New(opts *config.Ops, controller *controller.Controller, provider APIProvider, stateMap *configmap.ConfigMap, metrics *metrics.Reporter) *Deleter

New creates the deleter

func (*Deleter) Run

func (d *Deleter) Run(stopCh <-chan struct{})

Run starts the deleter deleting nodes

func (*Deleter) StateTransitionFunction

func (d *Deleter) StateTransitionFunction(nodeName string, oldState, newState State) (bool, error)

StateTransitionFunction makes the needed decisions and API calls to move a node between states

func (*Deleter) WantToDelete

func (d *Deleter) WantToDelete(node *core_v1.Node) (bool, metrics.Reason)

WantToDelete determines whether the controller wants delete the node and returns the reason why if it does The clauses are ordered the way they are for metrics reasons, ie if a node is both too old and has outdated config, we probably want to report the outdated config, rather than the age

type Group

type Group struct {
	Name             string
	Key              string
	IsReal           bool
	MaxSurge         int
	MaxUnavailable   int
	DeletionSchedule *cron.Schedule
	NumDesired       int
	Nodes            map[string]*NodeState
	PriorityNodes    map[string]struct{}
}

Group represents the deletion states and settings for a single group

func (*Group) Advance

func (g *Group) Advance(f StateTransitionFunction)

Advance tries to move as many nodes in the group as possible to deletion

type GroupStates

type GroupStates struct {
	Groups map[string]*Group
}

GroupStates represents a set of state machines describing the progress in deleting nodes from each group

func (*GroupStates) Advance

func (gs *GroupStates) Advance(f StateTransitionFunction)

Advance tries to advance deletion for all groups, in parallel

func (*GroupStates) Debug

func (gs *GroupStates) Debug()

Debug outputs some quick stats about each groups' state

func (*GroupStates) SerializeState

func (gs *GroupStates) SerializeState() SerializedState

SerializeState extracts the basic information about node states to a separate struct

type NodeState

type NodeState struct {
	Name         string       `json:"-"`
	State        State        `json:"state"`
	CreationTime meta_v1.Time `json:"-"`
	NeverDelete  bool         `json:"-"`
}

NodeState represents the state of deletion for a single node

type SerializedState

type SerializedState struct {
	NodeStates map[string]NodeState `json:"nodeStates"`
}

SerializedState is a snapshot of the deletion state for every node. Can be serialized to and from a configmap.

type State

type State string

State is an enumeration of the stages of the deletion process

const (
	// DontWantDelete means the controller doesn't want to delete the node
	DontWantDelete State = "dont_want_delete"
	// WantDelete means the controller does want to delete the node, but hasn't started yet
	WantDelete State = "want_delete"
	// Detached means the controller has detached the node from the underlying ASG, and is waiting for overprovision before deleting
	Detached State = "detached"
	// ReadyToDelete means the controller is ready to actually begin deleting a node
	ReadyToDelete State = "ready_to_delete"
	// Deleting means the controller has instructed nodereaperd to delete the node
	Deleting State = "deleting"
)

type StateTransitionFunction

type StateTransitionFunction func(nodeName string, oldState, newState State) (bool, error)

StateTransitionFunction attempts to move a node from oldState to newState

Jump to

Keyboard shortcuts

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