evictor

package
v0.126.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: Apache-2.0 Imports: 12 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// EvictionKind represents the kind of evictions object
	EvictionKind = "Eviction"
	// EvictionSubresource represents the kind of evictions object as Pod's subresource
	EvictionSubresource = "pods/eviction"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Evictor

type Evictor struct {
	DryRun bool

	UseEvictions bool
	// contains filtered or unexported fields
}

Evictor contains the parameters to control the behaviour of the evictor

func New

func New(clientSet kubernetes.Interface, maxGracePeriod time.Duration, ignoreDaemonSets []metav1.ObjectMeta, disableEviction bool) *Evictor

func (*Evictor) CanUseEvictions

func (d *Evictor) CanUseEvictions() error

CanUseEvictions uses Discovery API to find out if evictions are supported

func (*Evictor) EvictOrDeletePod

func (d *Evictor) EvictOrDeletePod(pod corev1.Pod) error

EvictOrDeletePod will evict Pod if policy API is available, otherwise deletes it. If disableEviction is true, we skip straight to the delete step NOTE: CanUseEvictions must be called prior to this

func (*Evictor) GetPodsForEviction

func (d *Evictor) GetPodsForEviction(nodeName string) (*PodDeleteList, []error)

GetPodsForEviction lists all pods on a given node, filters those using the default filters, and returns PodDeleteList along with any errors. All pods that are ready to be deleted can be obtained with .Pods(), and string with all warning can be obtained with .Warnings()

type PodDelete

type PodDelete struct {
	Pod    corev1.Pod
	Status PodDeleteStatus
}

type PodDeleteList

type PodDeleteList struct {
	Items []PodDelete
}

func (*PodDeleteList) Pods

func (l *PodDeleteList) Pods() []corev1.Pod

func (*PodDeleteList) Warnings

func (l *PodDeleteList) Warnings() string

type PodDeleteStatus

type PodDeleteStatus struct {
	Delete  bool
	Reason  string
	Message string
}

Jump to

Keyboard shortcuts

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