drainability

package
v0.0.0-...-7df4f84 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DrainContext

type DrainContext struct {
	RemainingPdbTracker pdb.RemainingPdbTracker
	Listers             kube_util.ListerRegistry
	Timestamp           time.Time
}

DrainContext contains parameters for drainability rules.

type OutcomeType

type OutcomeType int

OutcomeType identifies the action that should be taken when it comes to draining a pod.

const (
	// UndefinedOutcome means the Rule did not match and that another one
	// has to be applied.
	UndefinedOutcome OutcomeType = iota
	// DrainOk means that the pod can be drained.
	DrainOk
	// BlockDrain means that the pod should block drain for its entire node.
	BlockDrain
	// SkipDrain means that the pod doesn't block drain of other pods, but
	// should not be drained itself.
	SkipDrain
)

type Status

type Status struct {
	// Outcome indicates what can happen when it comes to draining a
	// specific pod.
	Outcome OutcomeType
	// Overrides specifies Outcomes that should be trumped by this Status.
	// If Overrides is empty, this Status is returned immediately.
	// If Overrides is non-empty, we continue running the remaining Rules. If a
	// Rule is encountered that matches one of the Outcomes specified by this
	// field, this Status will will be returned instead.
	Overrides []OutcomeType
	// Reason contains the reason why a pod is blocking node drain. It is
	// set only when Outcome is BlockDrain.
	BlockingReason drain.BlockingPodReason
	// Error contains an optional error message.
	Error error
}

Status contains all information about drainability of a single pod. TODO(x13n): Move values from drain.BlockingPodReason to some typed string.

func NewBlockedStatus

func NewBlockedStatus(reason drain.BlockingPodReason, err error) Status

NewBlockedStatus returns a new Status indicating that a pod is blocked and cannot be drained.

func NewDrainableStatus

func NewDrainableStatus() Status

NewDrainableStatus returns a new Status indicating that a pod can be drained.

func NewSkipStatus

func NewSkipStatus() Status

NewSkipStatus returns a new Status indicating that a pod should be skipped when draining a node.

func NewUndefinedStatus

func NewUndefinedStatus() Status

NewUndefinedStatus returns a new Status that doesn't contain a decision.

Jump to

Keyboard shortcuts

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