Skip to content

Commit

Permalink
feat(eviction): support rootfs eviction
Browse files Browse the repository at this point in the history
  • Loading branch information
nightmeng committed Jan 3, 2024
1 parent 59eb6f3 commit 69c497d
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions pkg/apis/config/v1alpha1/adminqos.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,12 @@ type EvictionConfig struct {
// +optional
DryRun []string `json:"dryRun"`

// MetricInsurancePeriod defines the metric insurance period for eviction manager and plugins.
// If set this period, eviction plugin will ignore the metric data that timestamp is older than
// this period.
// +optional
MetricInsurancePeriod *metav1.Duration `json:"metricInsurancePeriod,omitempty"`

// CPUPressureEvictionConfig is the config for cpu pressure eviction
// +optional
CPUPressureEvictionConfig *CPUPressureEvictionConfig `json:"cpuPressureEvictionConfig,omitempty"`
Expand All @@ -198,6 +204,10 @@ type EvictionConfig struct {
// +optional
MemoryPressureEvictionConfig *MemoryPressureEvictionConfig `json:"memoryPressureEvictionConfig,omitempty"`

// RootfsPressureEvictionConfig is the config for rootfs pressure eviction
// +optional
RootfsPressureEvictionConfig *RootfsPressureEvictionConfig `json:"rootfsPressureEvictionConfig,omitempty"`

// ReclaimedResourcesEvictionConfig is the config for reclaimed resources' eviction
// +optional
ReclaimedResourcesEvictionConfig *ReclaimedResourcesEvictionConfig `json:"reclaimedResourcesEvictionConfig,omitempty"`
Expand Down Expand Up @@ -371,6 +381,52 @@ type SystemLoadPressureEvictionConfig struct {
ThresholdMetPercentage *float64 `json:"thresholdMetPercentage,omitempty"`
}

type RootfsPressureEvictionConfig struct {
// EnableRootfsPressureEviction is whether to enable rootfs pressure eviction.
// +optional
EnableRootfsPressureEviction *bool `json:"enableRootfsPressureEviction,omitempty"`

// MinimumFreeThreshold is a threshold for a node.
// Once the rootfs free space of current node is lower than this threshold, the eviction manager will try to evict some pods.
// For example: "200Gi", "10%".
// +optional
MinimumFreeThreshold string `json:"minimumFreeThreshold,omitempty"`

// MinimumInodesFreeThreshold is a threshold for a node.
// Once the rootfs free inodes of current node is lower than this threshold, the eviction manager will try to evict some pods.
// +optional
// For example: "100000", "10%".
MinimumInodesFreeThreshold string `json:"minimumInodesFreeThreshold,omitempty"`

// PodMinimumUsedThreshold is a threshold for all pods.
// The eviction manager will ignore this pod if its rootfs used in bytes is lower than this threshold.
// +optional
// For example: "200GiM", "1%".
PodMinimumUsedThreshold string `json:"podMinimumUsedThreshold,omitempty"`

// PodMinimumInodesUsedThreshold is a threshold for all pods.
// The eviction manager will ignore this pod if its rootfs inodes used is lower than this threshold.
// +optional
// For example: "1000", "1%".
PodMinimumInodesUsedThreshold string `json:"podMinimumInodesUsedThreshold,omitempty"`

// ReclaimedQoSPodUsedPriorityThreshold is a threshold for all offline pods.
// The eviction manager will prioritize the eviction of offline pods that reach this threshold.
// +optional
// For example: "100GiM", "1%".
ReclaimedQoSPodUsedPriorityThreshold string `json:"reclaimedQoSPodUsedPriorityThreshold,omitempty"`

// ReclaimedQoSPodInodesUsedPriorityThreshold is a threshold for all offline pods.
// The eviction manager will prioritize the eviction of reclaimed pods that reach this threshold.
// +optional
// For example: "500", "1%".
ReclaimedQoSPodInodesUsedPriorityThreshold string `json:"reclaimedQoSPodInodesUsedPriorityThreshold,omitempty"`

// GracePeriod is the grace period of pod deletion
// +optional
GracePeriod *int64 `json:"gracePeriod,omitempty"`
}

// NumaEvictionRankingMetric is the metrics used to rank pods for eviction at the
// NUMA level
// +kubebuilder:validation:Enum=qos.pod;priority.pod;mem.total.numa.container
Expand All @@ -380,3 +436,5 @@ type NumaEvictionRankingMetric string
// system level
// +kubebuilder:validation:Enum=qos.pod;priority.pod;mem.usage.container
type SystemEvictionRankingMetric string

type ThresholdValue string

0 comments on commit 69c497d

Please sign in to comment.