From 5789b458f326f46a78b580360f99ba346474f18f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E9=B8=BF=E6=96=8C?= Date: Tue, 19 Sep 2023 14:40:28 +0800 Subject: [PATCH] enhancement(eviction): system load eviction configuration --- ...t.kubewharf.io_adminqosconfigurations.yaml | 46 +++++++++++++++ pkg/apis/config/v1alpha1/adminqos.go | 40 +++++++++++++ .../config/v1alpha1/zz_generated.deepcopy.go | 56 +++++++++++++++++++ 3 files changed, 142 insertions(+) diff --git a/config/crd/bases/config.katalyst.kubewharf.io_adminqosconfigurations.yaml b/config/crd/bases/config.katalyst.kubewharf.io_adminqosconfigurations.yaml index aba5787..cfd2eca 100644 --- a/config/crd/bases/config.katalyst.kubewharf.io_adminqosconfigurations.yaml +++ b/config/crd/bases/config.katalyst.kubewharf.io_adminqosconfigurations.yaml @@ -217,6 +217,52 @@ spec: format: int64 type: integer type: object + systemLoadPressureEvictionConfig: + description: SystemLoadPressureEvictionConfig is the config + for system load eviction + properties: + coolDownTime: + description: CoolDownTime is the cool-down time of the + plugin evict pods + format: int64 + minimum: 1 + type: integer + gracePeriod: + description: GracePeriod is the grace period of pod deletion + format: int64 + type: integer + hardThreshold: + description: 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 + format: int64 + type: integer + historySize: + description: HistorySize is the size of the load metric + ring, which is used to calculate the system load + format: int64 + minimum: 1 + type: integer + softThreshold: + description: 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 + format: int64 + type: integer + syncPeriod: + description: SyncPeriod is the interval in seconds of + the plugin fetch the load information + format: int64 + minimum: 1 + type: integer + thresholdMetPercentage: + description: 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 + type: number + type: object type: object reclaimedResourceConfig: description: ReclaimedResourceConfig is a configuration for reclaim diff --git a/pkg/apis/config/v1alpha1/adminqos.go b/pkg/apis/config/v1alpha1/adminqos.go index 2d40ebe..f0e0143 100644 --- a/pkg/apis/config/v1alpha1/adminqos.go +++ b/pkg/apis/config/v1alpha1/adminqos.go @@ -189,6 +189,10 @@ type EvictionConfig struct { // +optional CPUPressureEvictionConfig *CPUPressureEvictionConfig `json:"cpuPressureEvictionConfig,omitempty"` + // SystemLoadPressureEvictionConfig is the config for system load eviction + // +optional + SystemLoadPressureEvictionConfig *SystemLoadPressureEvictionConfig `json:"systemLoadPressureEvictionConfig,omitempty"` + // MemoryPressureEvictionConfig is the config for memory pressure eviction // +optional MemoryPressureEvictionConfig *MemoryPressureEvictionConfig `json:"memoryPressureEvictionConfig,omitempty"` @@ -320,6 +324,42 @@ type MemoryPressureEvictionConfig struct { GracePeriod *int64 `json:"gracePeriod,omitempty"` } +type SystemLoadPressureEvictionConfig 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 + // +optional + SoftThreshold *int64 `json:"softThreshold,omitempty"` + + // 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 + // +optional + HardThreshold *int64 `json:"hardThreshold,omitempty"` + + // HistorySize is the size of the load metric ring, which is used to calculate the system load + // +kubebuilder:validation:Minimum=1 + // +optional + HistorySize *int64 `json:"historySize,omitempty"` + + // SyncPeriod is the interval in seconds of the plugin fetch the load information + // +kubebuilder:validation:Minimum=1 + // +optional + SyncPeriod *int64 `json:"syncPeriod,omitempty"` + + // CoolDownTime is the cool-down time of the plugin evict pods + // +kubebuilder:validation:Minimum=1 + // +optional + CoolDownTime *int64 `json:"coolDownTime,omitempty"` + + // GracePeriod is the grace period of pod deletion + // +optional + GracePeriod *int64 `json:"gracePeriod,omitempty"` + + // 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 + // +optional + ThresholdMetPercentage *float64 `json:"thresholdMetPercentage,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 diff --git a/pkg/apis/config/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/config/v1alpha1/zz_generated.deepcopy.go index c576499..af9b6ae 100644 --- a/pkg/apis/config/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/config/v1alpha1/zz_generated.deepcopy.go @@ -398,6 +398,11 @@ func (in *EvictionConfig) DeepCopyInto(out *EvictionConfig) { *out = new(CPUPressureEvictionConfig) (*in).DeepCopyInto(*out) } + if in.SystemLoadPressureEvictionConfig != nil { + in, out := &in.SystemLoadPressureEvictionConfig, &out.SystemLoadPressureEvictionConfig + *out = new(SystemLoadPressureEvictionConfig) + (*in).DeepCopyInto(*out) + } if in.MemoryPressureEvictionConfig != nil { in, out := &in.MemoryPressureEvictionConfig, &out.MemoryPressureEvictionConfig *out = new(MemoryPressureEvictionConfig) @@ -860,6 +865,57 @@ func (in *ReclaimedResourcesEvictionConfig) DeepCopy() *ReclaimedResourcesEvicti return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SystemLoadPressureEvictionConfig) DeepCopyInto(out *SystemLoadPressureEvictionConfig) { + *out = *in + if in.SoftThreshold != nil { + in, out := &in.SoftThreshold, &out.SoftThreshold + *out = new(int64) + **out = **in + } + if in.HardThreshold != nil { + in, out := &in.HardThreshold, &out.HardThreshold + *out = new(int64) + **out = **in + } + if in.HistorySize != nil { + in, out := &in.HistorySize, &out.HistorySize + *out = new(int64) + **out = **in + } + if in.SyncPeriod != nil { + in, out := &in.SyncPeriod, &out.SyncPeriod + *out = new(int64) + **out = **in + } + if in.CoolDownTime != nil { + in, out := &in.CoolDownTime, &out.CoolDownTime + *out = new(int64) + **out = **in + } + if in.GracePeriod != nil { + in, out := &in.GracePeriod, &out.GracePeriod + *out = new(int64) + **out = **in + } + if in.ThresholdMetPercentage != nil { + in, out := &in.ThresholdMetPercentage, &out.ThresholdMetPercentage + *out = new(float64) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SystemLoadPressureEvictionConfig. +func (in *SystemLoadPressureEvictionConfig) DeepCopy() *SystemLoadPressureEvictionConfig { + if in == nil { + return nil + } + out := new(SystemLoadPressureEvictionConfig) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TargetConfig) DeepCopyInto(out *TargetConfig) { *out = *in