evictions

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EvictPodAnnotationKey = "descheduler.alpha.kubernetes.io/evict"
)

Variables

This section is empty.

Functions

func EvictPod

func EvictPod(ctx context.Context, client clientset.Interface, pod *corev1.Pod, policyGroupVersion string, deleteOptions *metav1.DeleteOptions) error

func HaveEvictAnnotation

func HaveEvictAnnotation(obj metav1.Object) bool

HaveEvictAnnotation checks if the pod have evict annotation

func IsPodEvictableBasedOnPriority

func IsPodEvictableBasedOnPriority(pod *corev1.Pod, priority int32) bool

IsPodEvictableBasedOnPriority checks if the given pod is evictable based on priority resolved from pod Spec.

func WithLabelSelector

func WithLabelSelector(labelSelector labels.Selector) func(opts *Options)

WithLabelSelector sets whether or not to apply label filtering when evicting. Any pod matching the label selector is considered evictable.

func WithNodeFit

func WithNodeFit(nodeFit bool) func(opts *Options)

WithNodeFit sets whether or not to consider taints, node selectors, and pod affinity when evicting. A pod whose tolerations, node selectors, and affinity match a node other than the one it is currently running on is evictable.

func WithPriorityThreshold

func WithPriorityThreshold(priority int32) func(opts *Options)

WithPriorityThreshold sets a threshold for pod's priority class. Any pod whose priority class is lower is evictable.

Types

type EvictionLimiter added in v1.2.0

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

func NewEvictionLimiter added in v1.2.0

func NewEvictionLimiter(
	maxPodsToEvictPerNode *uint,
	maxPodsToEvictPerNamespace *uint,
) *EvictionLimiter

func (*EvictionLimiter) AllowEvict added in v1.2.0

func (pe *EvictionLimiter) AllowEvict(pod *corev1.Pod) bool

func (*EvictionLimiter) Done added in v1.2.0

func (pe *EvictionLimiter) Done(pod *corev1.Pod)

func (*EvictionLimiter) NamespaceEvicted added in v1.2.0

func (pe *EvictionLimiter) NamespaceEvicted(namespace string) uint

func (*EvictionLimiter) NamespaceLimitExceeded added in v1.2.0

func (pe *EvictionLimiter) NamespaceLimitExceeded(namespace string) bool

func (*EvictionLimiter) NodeEvicted added in v1.2.0

func (pe *EvictionLimiter) NodeEvicted(nodeName string) uint

NodeEvicted gives a number of pods evicted for node

func (*EvictionLimiter) NodeLimitExceeded added in v1.2.0

func (pe *EvictionLimiter) NodeLimitExceeded(node *corev1.Node) bool

NodeLimitExceeded checks if the number of evictions for a node was exceeded

func (*EvictionLimiter) Reset added in v1.2.0

func (pe *EvictionLimiter) Reset()

func (*EvictionLimiter) TotalEvicted added in v1.2.0

func (pe *EvictionLimiter) TotalEvicted() uint

TotalEvicted gives a number of pods evicted through all nodes

type EvictorFilter

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

func NewEvictorFilter

func NewEvictorFilter(
	nodeGetter nodeGetterFn,
	nodeIndexer podutil.GetPodsAssignedToNodeFunc,
	evictLocalStoragePods bool,
	evictSystemCriticalPods bool,
	ignorePvcPods bool,
	evictFailedBarePods bool,
	opts ...func(opts *Options),
) *EvictorFilter

func (*EvictorFilter) Filter

func (ef *EvictorFilter) Filter(pod *corev1.Pod) bool

Filter decides when a pod is evictable

type Options

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

type PodEvictor

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

func NewPodEvictor

func NewPodEvictor(
	client clientset.Interface,
	eventRecorder events.EventRecorder,
	policyGroupVersion string,
	dryRun bool,
	maxPodsToEvictPerNode *uint,
	maxPodsToEvictPerNamespace *uint,
) *PodEvictor

func (*PodEvictor) Evict

func (pe *PodEvictor) Evict(ctx context.Context, pod *corev1.Pod, opts framework.EvictOptions) bool

func (*PodEvictor) NamespaceEvicted

func (pe *PodEvictor) NamespaceEvicted(namespace string) uint

func (*PodEvictor) NamespaceLimitExceeded

func (pe *PodEvictor) NamespaceLimitExceeded(namespace string) bool

func (*PodEvictor) NodeEvicted

func (pe *PodEvictor) NodeEvicted(nodeName string) uint

NodeEvicted gives a number of pods evicted for node

func (*PodEvictor) NodeLimitExceeded

func (pe *PodEvictor) NodeLimitExceeded(nodeName string) bool

NodeLimitExceeded checks if the number of evictions for a node was exceeded

func (*PodEvictor) TotalEvicted

func (pe *PodEvictor) TotalEvicted() int

TotalEvicted gives a number of pods evicted through all nodes

Jump to

Keyboard shortcuts

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