diff --git a/config/crd/bases/config.katalyst.kubewharf.io_adminqosconfigurations.yaml b/config/crd/bases/config.katalyst.kubewharf.io_adminqosconfigurations.yaml index 6872adb..21914b1 100644 --- a/config/crd/bases/config.katalyst.kubewharf.io_adminqosconfigurations.yaml +++ b/config/crd/bases/config.katalyst.kubewharf.io_adminqosconfigurations.yaml @@ -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 @@ -228,6 +300,8 @@ spec: - qos.pod - priority.pod - mem.usage.container + - native.qos.pod + - owner.pod type: string minItems: 1 type: array diff --git a/pkg/apis/config/v1alpha1/adminqos.go b/pkg/apis/config/v1alpha1/adminqos.go index 46d56e2..0afac04 100644 --- a/pkg/apis/config/v1alpha1/adminqos.go +++ b/pkg/apis/config/v1alpha1/adminqos.go @@ -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 { @@ -466,6 +470,74 @@ 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 @@ -473,5 +545,5 @@ 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 diff --git a/pkg/apis/config/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/config/v1alpha1/zz_generated.deepcopy.go index e17bf24..aa701fe 100644 --- a/pkg/apis/config/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/config/v1alpha1/zz_generated.deepcopy.go @@ -474,6 +474,92 @@ func (in *CPUPressureEvictionConfig) DeepCopy() *CPUPressureEvictionConfig { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CPUSystemPressureEvictionConfig) DeepCopyInto(out *CPUSystemPressureEvictionConfig) { + *out = *in + if in.EnableCPUSystemPressureEviction != nil { + in, out := &in.EnableCPUSystemPressureEviction, &out.EnableCPUSystemPressureEviction + *out = new(bool) + **out = **in + } + if in.LoadUpperBoundRatio != nil { + in, out := &in.LoadUpperBoundRatio, &out.LoadUpperBoundRatio + *out = new(float64) + **out = **in + } + if in.LoadLowerBoundRatio != nil { + in, out := &in.LoadLowerBoundRatio, &out.LoadLowerBoundRatio + *out = new(float64) + **out = **in + } + if in.UsageUpperBoundRatio != nil { + in, out := &in.UsageUpperBoundRatio, &out.UsageUpperBoundRatio + *out = new(float64) + **out = **in + } + if in.UsageLowerBoundRatio != nil { + in, out := &in.UsageLowerBoundRatio, &out.UsageLowerBoundRatio + *out = new(float64) + **out = **in + } + if in.ThresholdMetPercentage != nil { + in, out := &in.ThresholdMetPercentage, &out.ThresholdMetPercentage + *out = new(float64) + **out = **in + } + if in.MetricRingSize != nil { + in, out := &in.MetricRingSize, &out.MetricRingSize + *out = new(int) + **out = **in + } + if in.EvictionCoolDownTime != nil { + in, out := &in.EvictionCoolDownTime, &out.EvictionCoolDownTime + *out = new(v1.Duration) + **out = **in + } + if in.EvictionRankingMetrics != nil { + in, out := &in.EvictionRankingMetrics, &out.EvictionRankingMetrics + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.GracePeriod != nil { + in, out := &in.GracePeriod, &out.GracePeriod + *out = new(int64) + **out = **in + } + if in.CheckCPUManager != nil { + in, out := &in.CheckCPUManager, &out.CheckCPUManager + *out = new(bool) + **out = **in + } + if in.RankingLabels != nil { + in, out := &in.RankingLabels, &out.RankingLabels + *out = make(map[string][]string, len(*in)) + for key, val := range *in { + var outVal []string + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = make([]string, len(*in)) + copy(*out, *in) + } + (*out)[key] = outVal + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CPUSystemPressureEvictionConfig. +func (in *CPUSystemPressureEvictionConfig) DeepCopy() *CPUSystemPressureEvictionConfig { + if in == nil { + return nil + } + out := new(CPUSystemPressureEvictionConfig) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CgroupConfig) DeepCopyInto(out *CgroupConfig) { *out = *in @@ -653,6 +739,11 @@ func (in *EvictionConfig) DeepCopyInto(out *EvictionConfig) { *out = new(ReclaimedResourcesEvictionConfig) (*in).DeepCopyInto(*out) } + if in.CPUSystemPressureEvictionConfig != nil { + in, out := &in.CPUSystemPressureEvictionConfig, &out.CPUSystemPressureEvictionConfig + *out = new(CPUSystemPressureEvictionConfig) + (*in).DeepCopyInto(*out) + } return } diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index 9aaf89e..ecb7828 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -51,14 +51,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{ // AddToScheme adds all types of this clientset into the given scheme. This allows composition // of clientsets, like in: // -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) // -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) // // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index ffa9cdb..1569ec3 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -51,14 +51,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{ // AddToScheme adds all types of this clientset into the given scheme. This allows composition // of clientsets, like in: // -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) // -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) // // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly.