eviction

package
v0.18.2-0...-866293b Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2016 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package eviction is responsible for enforcing eviction thresholds to maintain node stability.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PodIsEvicted

func PodIsEvicted(podStatus api.PodStatus) bool

PodIsEvicted returns true if the reported pod status is due to an eviction.

Types

type ActivePodsFunc

type ActivePodsFunc func() []*api.Pod

ActivePodsFunc returns pods bound to the kubelet that are active (i.e. non-terminal state)

type Config

type Config struct {
	// PressureTransitionPeriod is duration the kubelet has to wait before transititioning out of a pressure condition.
	PressureTransitionPeriod time.Duration
	// Maximum allowed grace period (in seconds) to use when terminating pods in response to a soft eviction threshold being met.
	MaxPodGracePeriodSeconds int64
	// Thresholds define the set of conditions monitored to trigger eviction.
	Thresholds []Threshold
}

Config holds information about how eviction is configured.

type DiskInfoProvider

type DiskInfoProvider interface {
	// HasDedicatedImageFs returns true if the imagefs is on a separate device from the rootfs.
	HasDedicatedImageFs() (bool, error)
}

DiskInfoProvider is responsible for informing the manager how disk is configured.

type ImageGC

type ImageGC interface {
	// DeleteUnusedImages deletes unused images and returns the number of bytes freed, or an error.
	DeleteUnusedImages() (int64, error)
}

ImageGC is responsible for performing garbage collection of unused images.

type KillPodFunc

type KillPodFunc func(pod *api.Pod, status api.PodStatus, gracePeriodOverride *int64) error

KillPodFunc kills a pod. The pod status is updated, and then it is killed with the specified grace period. This function must block until either the pod is killed or an error is encountered. Arguments: pod - the pod to kill status - the desired status to associate with the pod (i.e. why its killed) gracePeriodOverride - the grace period override to use instead of what is on the pod spec

type Manager

type Manager interface {
	// Start starts the control loop to monitor eviction thresholds at specified interval.
	Start(diskInfoProvider DiskInfoProvider, podFunc ActivePodsFunc, monitoringInterval time.Duration) error

	// IsUnderMemoryPressure returns true if the node is under memory pressure.
	IsUnderMemoryPressure() bool

	// IsUnderDiskPressure returns true if the node is under disk pressure.
	IsUnderDiskPressure() bool
}

Manager evaluates when an eviction threshold for node stability has been met on the node.

func NewManager

func NewManager(
	summaryProvider stats.SummaryProvider,
	config Config,
	killPodFunc KillPodFunc,
	imageGC ImageGC,
	recorder record.EventRecorder,
	nodeRef *api.ObjectReference,
	clock clock.Clock) (Manager, lifecycle.PodAdmitHandler, error)

NewManager returns a configured Manager and an associated admission handler to enforce eviction configuration.

type Signal

type Signal string

Signal defines a signal that can trigger eviction of pods on a node.

const (
	// SignalMemoryAvailable is memory available (i.e. capacity - workingSet), in bytes.
	SignalMemoryAvailable Signal = "memory.available"
	// SignalNodeFsAvailable is amount of storage available on filesystem that kubelet uses for volumes, daemon logs, etc.
	SignalNodeFsAvailable Signal = "nodefs.available"
	// SignalNodeFsInodesFree is amount of inodes available on filesystem that kubelet uses for volumes, daemon logs, etc.
	SignalNodeFsInodesFree Signal = "nodefs.inodesFree"
	// SignalImageFsAvailable is amount of storage available on filesystem that container runtime uses for storing images and container writable layers.
	SignalImageFsAvailable Signal = "imagefs.available"
	// SignalImageFsInodesFree is amount of inodes available on filesystem that container runtime uses for storing images and container writeable layers.
	SignalImageFsInodesFree Signal = "imagefs.inodesFree"
)

type Threshold

type Threshold struct {
	// Signal defines the entity that was measured.
	Signal Signal
	// Operator represents a relationship of a signal to a value.
	Operator ThresholdOperator
	// Value is the threshold the resource is evaluated against.
	Value ThresholdValue
	// GracePeriod represents the amount of time that a threshold must be met before eviction is triggered.
	GracePeriod time.Duration
	// MinReclaim represents the minimum amount of resource to reclaim if the threshold is met.
	MinReclaim *ThresholdValue
}

Threshold defines a metric for when eviction should occur.

func ParseThresholdConfig

func ParseThresholdConfig(evictionHard, evictionSoft, evictionSoftGracePeriod, evictionMinimumReclaim string) ([]Threshold, error)

ParseThresholdConfig parses the flags for thresholds.

type ThresholdOperator

type ThresholdOperator string

ThresholdOperator is the operator used to express a Threshold.

const (
	// OpLessThan is the operator that expresses a less than operator.
	OpLessThan ThresholdOperator = "LessThan"
)

type ThresholdValue

type ThresholdValue struct {

	// Quantity is a quantity associated with the signal that is evaluated against the specified operator.
	Quantity *resource.Quantity
	// Percentage represents the usage percentage over the total resource that is evaluated against the specified operator.
	Percentage float32
}

ThresholdValue is a value holder that abstracts literal versus percentage based quantity

Jump to

Keyboard shortcuts

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