eviction

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2024 License: Apache-2.0 Imports: 11 Imported by: 3

Documentation

Index

Constants

View Source
const (
	FakeMetricQoSLevel = "qos.pod"
	FakeMetricPriority = "priority.pod"
)

Fake metrics are not fetched from meta-server

View Source
const (
	// DefaultEnableNumaLevelEviction is the default value of whether enable numa-level eviction
	DefaultEnableNumaLevelEviction = true
	// DefaultEnableSystemLevelEviction is the default value of whether enable system-level eviction
	DefaultEnableSystemLevelEviction = true
	// DefaultNumaVictimMinimumUtilizationThreshold is the victim's minimum memory usage on a NUMA node, if a pod
	// uses less memory on a NUMA node than this threshold,it won't be evicted by this NUMA's memory pressure.
	DefaultNumaVictimMinimumUtilizationThreshold = 0.001
	// DefaultNumaFreeBelowWatermarkTimesThreshold is the default threshold for the number of times
	// that NUMA's free memory falls below the watermark
	DefaultNumaFreeBelowWatermarkTimesThreshold = 4
	// DefaultSystemFreeMemoryThresholdMinimum is the minimum of free memory threshold.
	DefaultSystemFreeMemoryThresholdMinimum = "0Gi"
	// DefaultSystemKswapdRateThreshold is the default threshold for the rate of kswapd reclaiming rate
	DefaultSystemKswapdRateThreshold = 2000
	// DefaultSystemKswapdRateExceedTimesThreshold is the default threshold for the number of times
	// that the kswapd reclaiming rate exceeds the threshold
	DefaultSystemKswapdRateExceedDurationThreshold = 120
	// DefaultGracePeriod is the default value of grace period
	DefaultGracePeriod int64 = -1
	// DefaultEnableRssOveruseDetection is the default value of whether enable pod-level rss overuse detection
	DefaultEnableRssOveruseDetection = false
	// DefaultRSSOveruseRateThreshold is the default threshold for the rate of rss
	DefaultRSSOveruseRateThreshold = 1.05
)

Variables

View Source
var (
	// FakeEvictionRankingMetrics is fake metrics to rank pods
	FakeEvictionRankingMetrics = []string{FakeMetricQoSLevel, FakeMetricPriority}
	// DefaultNumaEvictionRankingMetrics is the default metrics used to rank pods for eviction at the NUMA level
	DefaultNumaEvictionRankingMetrics = append(FakeEvictionRankingMetrics, consts.MetricsMemTotalPerNumaContainer)
	// DefaultSystemEvictionRankingMetrics is the default metrics used to rank pods for eviction at the system level
	DefaultSystemEvictionRankingMetrics = append(FakeEvictionRankingMetrics, consts.MetricMemUsageContainer)
)

Functions

func ParseThresholdValue added in v0.4.1

func ParseThresholdValue(val string) (*evictionapi.ThresholdValue, error)

Types

type CPUPressureEvictionConfiguration

type CPUPressureEvictionConfiguration struct {
	EnableLoadEviction              bool
	LoadUpperBoundRatio             float64
	LoadLowerBoundRatio             float64
	LoadThresholdMetPercentage      float64
	LoadMetricRingSize              int
	LoadEvictionCoolDownTime        time.Duration
	EnableSuppressionEviction       bool
	MaxSuppressionToleranceRate     float64
	MinSuppressionToleranceDuration time.Duration
	GracePeriod                     int64
}

func NewCPUPressureEvictionConfiguration

func NewCPUPressureEvictionConfiguration() *CPUPressureEvictionConfiguration

func (*CPUPressureEvictionConfiguration) ApplyConfiguration

func (c *CPUPressureEvictionConfiguration) ApplyConfiguration(conf *crd.DynamicConfigCRD)

type EvictionConfiguration

type EvictionConfiguration struct {
	// Dryrun plugins is the list of plugins to dryrun
	// '*' means "all dryrun by default"
	// 'foo' means "dryrun 'foo'"
	// first item for a particular name wins
	DryRun []string

	*CPUPressureEvictionConfiguration
	*MemoryPressureEvictionConfiguration
	*RootfsPressureEvictionConfiguration
	*ReclaimedResourcesEvictionConfiguration
	*SystemLoadEvictionPluginConfiguration
}

func NewEvictionConfiguration

func NewEvictionConfiguration() *EvictionConfiguration

func (*EvictionConfiguration) ApplyConfiguration

func (c *EvictionConfiguration) ApplyConfiguration(conf *crd.DynamicConfigCRD)

type MemoryPressureEvictionConfiguration

type MemoryPressureEvictionConfiguration struct {
	EnableNumaLevelEviction                 bool
	EnableSystemLevelEviction               bool
	NumaVictimMinimumUtilizationThreshold   float64
	NumaFreeBelowWatermarkTimesThreshold    int
	SystemFreeMemoryThresholdMinimum        int64
	SystemKswapdRateThreshold               int
	SystemKswapdRateExceedDurationThreshold int
	NumaEvictionRankingMetrics              []string
	SystemEvictionRankingMetrics            []string
	EnableRSSOveruseEviction                bool
	RSSOveruseRateThreshold                 float64
	GracePeriod                             int64
}

func NewMemoryPressureEvictionPluginConfiguration

func NewMemoryPressureEvictionPluginConfiguration() *MemoryPressureEvictionConfiguration

func (*MemoryPressureEvictionConfiguration) ApplyConfiguration

func (c *MemoryPressureEvictionConfiguration) ApplyConfiguration(conf *crd.DynamicConfigCRD)

ApplyConfiguration applies dynamic.DynamicConfigCRD to MemoryPressureEvictionConfiguration

type ReclaimedResourcesEvictionConfiguration

type ReclaimedResourcesEvictionConfiguration struct {
	EvictionThreshold             native.ResourceThreshold
	DeletionGracePeriod           int64
	ThresholdMetToleranceDuration int64
}

func NewReclaimedResourcesEvictionConfiguration

func NewReclaimedResourcesEvictionConfiguration() *ReclaimedResourcesEvictionConfiguration

func (*ReclaimedResourcesEvictionConfiguration) ApplyConfiguration

func (c *ReclaimedResourcesEvictionConfiguration) ApplyConfiguration(conf *crd.DynamicConfigCRD)

type RootfsPressureEvictionConfiguration added in v0.4.0

type RootfsPressureEvictionConfiguration struct {
	EnableRootfsPressureEviction               bool
	MinimumImageFsFreeThreshold                *evictionapi.ThresholdValue
	MinimumImageFsInodesFreeThreshold          *evictionapi.ThresholdValue
	PodMinimumUsedThreshold                    *evictionapi.ThresholdValue
	PodMinimumInodesUsedThreshold              *evictionapi.ThresholdValue
	ReclaimedQoSPodUsedPriorityThreshold       *evictionapi.ThresholdValue
	ReclaimedQoSPodInodesUsedPriorityThreshold *evictionapi.ThresholdValue
	MinimumImageFsDiskCapacityThreshold        *resource.Quantity
	GracePeriod                                int64
}

func NewRootfsPressureEvictionPluginConfiguration added in v0.4.0

func NewRootfsPressureEvictionPluginConfiguration() *RootfsPressureEvictionConfiguration

func (*RootfsPressureEvictionConfiguration) ApplyTo added in v0.4.0

type SystemLoadEvictionPluginConfiguration added in v0.4.0

type SystemLoadEvictionPluginConfiguration struct {
	// SoftThreshold is the soft threshold of system load pressure, it should be an integral multiple of 100, which means
	// the real threshold is (SoftThreshold / 100) * CoreNumber
	SoftThreshold int64
	// HardThreshold is the hard threshold of system load pressure, it should be an integral multiple of 100, which means
	// the real threshold is (SoftThreshold / 100) * CoreNumber
	HardThreshold int64
	// HistorySize is the size of the load metric ring, which is used to calculate the system load
	HistorySize int64
	// SyncPeriod is the interval in seconds of the plugin fetch the load information
	SyncPeriod int64
	// CoolDownTimeInSeconds is the cool-down time of the plugin evict pods
	CoolDownTime int64
	// GracePeriod is the grace period of pod deletion
	GracePeriod int64
	// the plugin considers the node is facing load pressure only when the ratio of load history which is greater than
	// threshold is greater than this percentage
	ThresholdMetPercentage float64
}

func NewSystemLoadEvictionPluginConfiguration added in v0.4.0

func NewSystemLoadEvictionPluginConfiguration() *SystemLoadEvictionPluginConfiguration

func (*SystemLoadEvictionPluginConfiguration) ApplyConfiguration added in v0.4.0

func (l *SystemLoadEvictionPluginConfiguration) ApplyConfiguration(conf *crd.DynamicConfigCRD)

Jump to

Keyboard shortcuts

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