Skip to content

Commit

Permalink
add cpu system pressure eviction dynamic config
Browse files Browse the repository at this point in the history
  • Loading branch information
WangZzzhe committed May 14, 2024
1 parent 0f4045c commit 5dafdcc
Show file tree
Hide file tree
Showing 5 changed files with 252 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,78 @@ spec:
be triggered
type: string
type: object
cpuSystemPressureEvictionConfig:
description: CPUSystemPressureEvictionConfig is the config
for cpu system pressure eviction
properties:
RankingLabels:
additionalProperties:
items:
type: string
type: array
type: object
checkCPUManager:
type: boolean
enableCPUSystemPressureEviction:
type: boolean
evictionCoolDownTime:
description: EvictionCoolDownTime is the cool down duration
of pod eviction
type: string
evictionRankingMetrics:
description: EvictionRankingMetrics is the metric list
for ranking eviction pods
items:
type: string
type: array
gracePeriod:
format: int64
type: integer
loadLowerBoundRatio:
description: LoadLowerBoundRatio is the lower bound ratio
of node, if the load of the node is greater than the
load lower bound repeatedly, the cordon will be triggered
maximum: 1
minimum: 0
type: number
loadUpperBoundRatio:
description: LoadUpperBoundRatio is the upper bound ratio
of node, if the load of the node is greater than the
load upper bound repeatedly, the eviction will be triggered
maximum: 1
minimum: 0
type: number
metricRingSize:
description: MetricRingSize is the size of the load metric
ring
minimum: 1
type: integer
thresholdMetPercentage:
description: ThresholdMetPercentage is the percentage
of the number of times the metric over the upper bound
to the total number of times the metric is measured,
if the percentage is greater than the threshold met
percentage, the eviction or node tainted will be triggered
maximum: 1
minimum: 0
type: number
usageLowerBoundRatio:
description: UsageLowerBoundRatio is the lower bound ratio
of node, if the cpu usage of the node is greater than
the usage lower bound repeatedly, the cordon will be
triggered
maximum: 1
minimum: 0
type: number
usageUpperBoundRatio:
description: UsageUpperBoundRatio is the upper bound ratio
of node, if the cpu usage of the node is greater than
the usage upper bound repeatedly, the eviction will
be triggered
maximum: 1
minimum: 0
type: number
type: object
dryRun:
description: DryRun is the list of eviction plugins to dryRun
'*' means "all dry-run by default" 'foo' means "dry-run
Expand Down Expand Up @@ -228,6 +300,8 @@ spec:
- qos.pod
- priority.pod
- mem.usage.container
- native.qos.pod
- owner.pod
type: string
minItems: 1
type: array
Expand Down
74 changes: 73 additions & 1 deletion pkg/apis/config/v1alpha1/adminqos.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ type EvictionConfig struct {
// ReclaimedResourcesEvictionConfig is the config for reclaimed resources' eviction
// +optional
ReclaimedResourcesEvictionConfig *ReclaimedResourcesEvictionConfig `json:"reclaimedResourcesEvictionConfig,omitempty"`

// CPUSystemPressureEvictionConfig is the config for cpu system pressure eviction
// +optional
CPUSystemPressureEvictionConfig *CPUSystemPressureEvictionConfig `json:"cpuSystemPressureEvictionConfig,omitempty"`
}

type ReclaimedResourcesEvictionConfig struct {
Expand Down Expand Up @@ -466,12 +470,80 @@ type RootfsPressureEvictionConfig struct {
GracePeriod *int64 `json:"gracePeriod,omitempty"`
}

type CPUSystemPressureEvictionConfig struct {
// +optional
EnableCPUSystemPressureEviction *bool `json:"enableCPUSystemPressureEviction,omitempty"`

// LoadUpperBoundRatio is the upper bound ratio of node, if the load
// of the node is greater than the load upper bound repeatedly, the
// eviction will be triggered
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=1
// +optional
LoadUpperBoundRatio *float64 `json:"loadUpperBoundRatio,omitempty"`

// LoadLowerBoundRatio is the lower bound ratio of node, if the load
// of the node is greater than the load lower bound repeatedly, the
// cordon will be triggered
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=1
// +optional
LoadLowerBoundRatio *float64 `json:"loadLowerBoundRatio,omitempty"`

// UsageUpperBoundRatio is the upper bound ratio of node, if the cpu usage
// of the node is greater than the usage upper bound repeatedly, the
// eviction will be triggered
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=1
// +optional
UsageUpperBoundRatio *float64 `json:"usageUpperBoundRatio,omitempty"`

// UsageLowerBoundRatio is the lower bound ratio of node, if the cpu usage
// of the node is greater than the usage lower bound repeatedly, the
// cordon will be triggered
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=1
// +optional
UsageLowerBoundRatio *float64 `json:"usageLowerBoundRatio,omitempty"`

// ThresholdMetPercentage is the percentage of the number of times the metric
// over the upper bound to the total number of times the metric is measured, if the
// percentage is greater than the threshold met percentage, the eviction or
// node tainted will be triggered
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=1
// +optional
ThresholdMetPercentage *float64 `json:"thresholdMetPercentage,omitempty"`

// MetricRingSize is the size of the load metric ring
// +kubebuilder:validation:Minimum=1
// +optional
MetricRingSize *int `json:"metricRingSize,omitempty"`

// EvictionCoolDownTime is the cool down duration of pod eviction
// +optional
EvictionCoolDownTime *metav1.Duration `json:"evictionCoolDownTime,omitempty"`

// EvictionRankingMetrics is the metric list for ranking eviction pods
// +optional
EvictionRankingMetrics []string `json:"evictionRankingMetrics,omitempty"`

// +optional
GracePeriod *int64 `json:"gracePeriod,omitempty"`

// +optional
CheckCPUManager *bool `json:"checkCPUManager,omitempty"`

// +optional
RankingLabels map[string][]string `json:"RankingLabels,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
type NumaEvictionRankingMetric string

// SystemEvictionRankingMetric is the metrics used to rank pods for eviction at the
// system level
// +kubebuilder:validation:Enum=qos.pod;priority.pod;mem.usage.container
// +kubebuilder:validation:Enum=qos.pod;priority.pod;mem.usage.container;native.qos.pod;owner.pod
type SystemEvictionRankingMetric string
91 changes: 91 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 5dafdcc

Please sign in to comment.