node

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TaintKey            = "dbschenker.com/node-undertaker"
	TaintValue          = ""
	Label               = "dbschenker.com/node-undertaker"
	TimestampAnnotation = "dbschenker.com/node-undertaker-timestamp"
)
View Source
const (
	NodeUnhealthy            string = "unhealthy"
	NodeTerminating                 = "terminating"
	NodeTainted                     = "tainted"
	NodeDraining                    = "draining"
	NodeHealthy                     = ""
	NodePreparingTermination        = "preparing_termination"
	NodeTerminationPrepared         = "termination_prepared"
)
View Source
const (
	ReportingController = "dbschenker.com/node-undertaker"
)

Variables

This section is empty.

Functions

func ReportEvent

func ReportEvent(ctx context.Context, cfg *config.Config, lvl log.Level, n NODE, action, reason, reasonDesc, msgOverride string)

Types

type NODE

type NODE interface {
	IsGrownUp(cfg *config.Config) bool
	HasFreshLease(ctx context.Context, cfg *config.Config) (bool, error)
	GetLabel() string
	RemoveLabel()
	RemoveActionTimestamp()
	SetLabel(label string)
	SetActionTimestamp(t time.Time)
	GetActionTimestamp() (time.Time, error)
	Taint()
	Untaint()
	StartDrain(ctx context.Context, cfg *config.Config)
	Terminate(ctx context.Context, cfg *config.Config) (string, error)
	PrepareTermination(ctx context.Context, cfg *config.Config) (string, error)
	Save(ctx context.Context, cfg *config.Config) error
	GetName() string
	GetKind() string
}

type Node

type Node struct {
	*v1.Node
	// contains filtered or unexported fields
}

func CreateNode

func CreateNode(n *v1.Node) *Node

func (*Node) GetActionTimestamp

func (n *Node) GetActionTimestamp() (time.Time, error)

func (*Node) GetKind

func (n *Node) GetKind() string

func (*Node) GetLabel

func (n *Node) GetLabel() string

func (*Node) GetName

func (n *Node) GetName() string

func (*Node) HasFreshLease

func (n *Node) HasFreshLease(ctx context.Context, cfg *config.Config) (bool, error)

func (*Node) IsGrownUp

func (n *Node) IsGrownUp(cfg *config.Config) bool

func (*Node) PrepareTermination

func (n *Node) PrepareTermination(ctx context.Context, cfg *config.Config) (string, error)

func (*Node) RemoveActionTimestamp

func (n *Node) RemoveActionTimestamp()

func (*Node) RemoveLabel

func (n *Node) RemoveLabel()

func (*Node) Save

func (n *Node) Save(ctx context.Context, cfg *config.Config) error

TODO: check if saving whole object works fine. Maybe it should be done using patches: https://stackoverflow.com/questions/57310483/whats-the-shortest-way-to-add-a-label-to-a-pod-using-the-kubernetes-go-client

func (*Node) SetActionTimestamp

func (n *Node) SetActionTimestamp(t time.Time)

func (*Node) SetLabel

func (n *Node) SetLabel(label string)

func (*Node) StartDrain

func (n *Node) StartDrain(ctx context.Context, cfg *config.Config)

func (*Node) Taint

func (n *Node) Taint()

func (*Node) Terminate

func (n *Node) Terminate(ctx context.Context, cfg *config.Config) (string, error)

Terminate deletes node from cloud provider

func (*Node) Untaint

func (n *Node) Untaint()

Jump to

Keyboard shortcuts

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