interruptioneventstore

package
v1.13.3 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	sync.RWMutex
	NthConfig config.Config

	Workers chan int
	// contains filtered or unexported fields
}

Store is the drain event store data structure

func New

func New(nthConfig config.Config) *Store

New Creates a new interruption event store

func (*Store) AddInterruptionEvent

func (s *Store) AddInterruptionEvent(interruptionEvent *monitor.InterruptionEvent)

AddInterruptionEvent adds an interruption event to the internal store

func (*Store) CancelInterruptionEvent

func (s *Store) CancelInterruptionEvent(eventID string)

CancelInterruptionEvent removes an interruption event from the internal store

func (*Store) GetActiveEvent

func (s *Store) GetActiveEvent() (*monitor.InterruptionEvent, bool)

GetActiveEvent returns true if there are interruption events in the internal store

func (*Store) IgnoreEvent

func (s *Store) IgnoreEvent(eventID string)

IgnoreEvent will store an event ID so that monitor loops cannot write to the store with the same event ID Drain actions are ignored on the passed in event ID by setting the NodeProcessed flag to true

func (*Store) MarkAllAsProcessed added in v1.13.1

func (s *Store) MarkAllAsProcessed(nodeName string)

MarkAllAsProcessed should be called after the node has been drained to prevent further unnecessary drain calls to the k8s api

func (*Store) ShouldDrainNode

func (s *Store) ShouldDrainNode() bool

ShouldDrainNode returns true if there are drainable events in the internal store

func (*Store) ShouldUncordonNode

func (s *Store) ShouldUncordonNode(nodeName string) bool

ShouldUncordonNode returns true if there was a interruption event but it was canceled and the store is now empty or only consists of ignored events

func (*Store) TimeUntilDrain

func (s *Store) TimeUntilDrain(interruptionEvent *monitor.InterruptionEvent) time.Duration

TimeUntilDrain returns the duration until a node drain should occur (can return a negative duration)

Jump to

Keyboard shortcuts

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