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 885d446
Show file tree
Hide file tree
Showing 5 changed files with 144 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,55 @@ spec:
format: int64
type: integer
type: object
rootfsPressureEvictionConfig:
description: RootfsPressureEvictionConfig is the config for
rootfs pressure eviction
properties:
enableRootfsPressureEviction:
description: EnableRootfsPressureEviction is whether to
enable rootfs pressure eviction.
type: boolean
gracePeriod:
description: GracePeriod is the grace period of pod deletion
format: int64
type: integer
minimumFreeThreshold:
description: '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%".'
type: string
minimumInodesFreeThreshold:
description: '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. For example: "100000", "10%".'
type: string
podMinimumInodesUsedThreshold:
description: 'PodMinimumInodesUsedThreshold is a threshold
for all pods. The eviction manager will ignore this
pod if its rootfs inodes used is lower than this threshold.
For example: "1000", "1%".'
type: string
podMinimumUsedThreshold:
description: '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.
For example: "200Gi", "1%".'
type: string
reclaimedQoSPodInodesUsedPriorityThreshold:
description: 'ReclaimedQoSPodInodesUsedPriorityThreshold
is a threshold for all offline pods. The eviction manager
will prioritize the eviction of reclaimed pods that
reach this threshold. For example: "500", "1%".'
type: string
reclaimedQoSPodUsedPriorityThreshold:
description: 'ReclaimedQoSPodUsedPriorityThreshold is
a threshold for all offline pods. The eviction manager
will prioritize the eviction of offline pods that reach
this threshold. For example: "100Gi", "1%".'
type: string
type: object
systemLoadPressureEvictionConfig:
description: SystemLoadPressureEvictionConfig is the config
for system load eviction
Expand Down
50 changes: 50 additions & 0 deletions pkg/apis/config/v1alpha1/adminqos.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,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 +375,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: "200Gi", "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: "100Gi", "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 Down
31 changes: 31 additions & 0 deletions pkg/apis/config/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions pkg/client/clientset/versioned/fake/register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions pkg/client/clientset/versioned/scheme/register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 885d446

Please sign in to comment.