Documentation ¶
Overview ¶
Package eviction is responsible for enforcing eviction thresholds to maintain node stability.
Index ¶
- func ParseThresholdConfig(allocatableConfig []string, ...) ([]evictionapi.Threshold, error)
- func PodIsEvicted(podStatus v1.PodStatus) bool
- type ActivePodsFunc
- type CapacityProvider
- type Config
- type ContainerGC
- type DiskInfoProvider
- type ImageGC
- type KillPodFunc
- type Manager
- type PodCleanedUpFunc
- type ThresholdNotifier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseThresholdConfig ¶
func ParseThresholdConfig(allocatableConfig []string, evictionHard, evictionSoft, evictionSoftGracePeriod, evictionMinimumReclaim string) ([]evictionapi.Threshold, error)
ParseThresholdConfig parses the flags for thresholds.
func PodIsEvicted ¶ added in v1.4.0
PodIsEvicted returns true if the reported pod status is due to an eviction.
Types ¶
type ActivePodsFunc ¶
ActivePodsFunc returns pods bound to the kubelet that are active (i.e. non-terminal state)
type CapacityProvider ¶ added in v1.7.3
type CapacityProvider interface { // GetCapacity returns the amount of compute resources tracked by container manager available on the node. GetCapacity() v1.ResourceList // GetNodeAllocatable returns the amount of compute resources that have to be reserved from scheduling. GetNodeAllocatableReservation() v1.ResourceList }
CapacityProvider is responsible for providing the resource capacity and reservation information
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 []evictionapi.Threshold // KernelMemcgNotification if true will integrate with the kernel memcg notification to determine if memory thresholds are crossed. KernelMemcgNotification bool }
Config holds information about how eviction is configured.
type ContainerGC ¶ added in v1.7.1
type ContainerGC interface { // DeleteAllUnusedContainers deletes all unused containers, even those that belong to pods that are terminated, but not deleted. // It returns an error if it is unsuccessful. DeleteAllUnusedContainers() error }
ContainerGC is responsible for performing garbage collection of unused containers.
type DiskInfoProvider ¶ added in v1.4.0
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 ¶ added in v1.4.0
type ImageGC interface { // DeleteUnusedImages deletes unused images and returns the number of bytes freed, and an error. // This returns the bytes freed even if an error is returned. DeleteUnusedImages() (int64, error) }
ImageGC is responsible for performing garbage collection of unused images.
type KillPodFunc ¶
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, podCleanedUpFunc PodCleanedUpFunc, capacityProvider CapacityProvider, monitoringInterval time.Duration) // 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, containerGC ContainerGC, recorder record.EventRecorder, nodeRef *v1.ObjectReference, clock clock.Clock) (Manager, lifecycle.PodAdmitHandler)
NewManager returns a configured Manager and an associated admission handler to enforce eviction configuration.
type PodCleanedUpFunc ¶ added in v1.7.1
PodCleanedUpFunc returns true if all resources associated with a pod have been reclaimed.
type ThresholdNotifier ¶ added in v1.5.0
type ThresholdNotifier interface {
Start(stopCh <-chan struct{})
}
ThresholdNotifier notifies the user when an attribute crosses a threshold value
func NewMemCGThresholdNotifier ¶ added in v1.5.0
func NewMemCGThresholdNotifier(path, attribute, threshold, description string, handler thresholdNotifierHandlerFunc) (ThresholdNotifier, error)
NewMemCGThresholdNotifier sends notifications when a cgroup threshold is crossed (in either direction) for a given cgroup attribute