From 0620fb38417010a937da0816d7c3fe645e0beba4 Mon Sep 17 00:00:00 2001 From: luomingmeng Date: Tue, 18 Nov 2025 21:22:31 +0800 Subject: [PATCH] fix(adminqos): update validation minimum to -1 for grace periods Update kubebuilder validation minimum from 0 to -1 for all grace period fields in adminqos configuration. This allows for more flexible configuration options where negative values might be needed. --- ...t.kubewharf.io_adminqosconfigurations.yaml | 19 ++++++++++++------- pkg/apis/config/v1alpha1/adminqos.go | 18 +++++++++++------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/config/crd/bases/config.katalyst.kubewharf.io_adminqosconfigurations.yaml b/config/crd/bases/config.katalyst.kubewharf.io_adminqosconfigurations.yaml index a6d5dbb8..552efa52 100644 --- a/config/crd/bases/config.katalyst.kubewharf.io_adminqosconfigurations.yaml +++ b/config/crd/bases/config.katalyst.kubewharf.io_adminqosconfigurations.yaml @@ -188,7 +188,7 @@ spec: description: GracePeriod is the grace period of cpu pressure eviction format: int64 - minimum: 0 + minimum: -1 type: integer loadEvictionCoolDownTime: description: |- @@ -257,7 +257,7 @@ spec: GracePeriod is the grace period (in seconds) after a pod starts before it can be considered for eviction due to NUMA CPU pressure. 0 means no grace period. format: int64 - minimum: 0 + minimum: -1 type: integer metricRingSize: description: MetricRingSize is the size of the metric @@ -310,7 +310,10 @@ spec: type: string type: array gracePeriod: + description: GracePeriod is the grace period of cpu system + pressure eviction format: int64 + minimum: -1 type: integer loadLowerBoundRatio: description: |- @@ -388,7 +391,7 @@ spec: description: GracePeriod is the grace period of memory pressure eviction format: int64 - minimum: 0 + minimum: -1 type: integer numaEvictionRankingMetrics: description: |- @@ -420,7 +423,7 @@ spec: description: ReclaimedGracePeriod is the grace period of memory pressure reclaimed eviction format: int64 - minimum: 0 + minimum: -1 type: integer rssOveruseRateThreshold: description: RSSOveruseRateThreshold is the threshold @@ -477,7 +480,7 @@ spec: description: GracePeriod is the grace period of nic health eviction format: int64 - minimum: 0 + minimum: -1 type: integer nicUnhealthyToleranceDuration: description: |- @@ -499,13 +502,13 @@ spec: description: GracePeriod is the grace period of reclaimed resources' eviction format: int64 - minimum: 0 + minimum: -1 type: integer thresholdMetToleranceDuration: description: ThresholdMetToleranceDuration is the tolerance duration before eviction. format: int64 - minimum: 0 + minimum: -1 type: integer type: object rootfsPressureEvictionConfig: @@ -523,6 +526,7 @@ spec: gracePeriod: description: GracePeriod is the grace period of pod deletion format: int64 + minimum: -1 type: integer minimumImageFsDiskCapacityThreshold: anyOf: @@ -609,6 +613,7 @@ spec: gracePeriod: description: GracePeriod is the grace period of pod deletion format: int64 + minimum: -1 type: integer hardThreshold: description: |- diff --git a/pkg/apis/config/v1alpha1/adminqos.go b/pkg/apis/config/v1alpha1/adminqos.go index 654cefb9..51f7e05e 100644 --- a/pkg/apis/config/v1alpha1/adminqos.go +++ b/pkg/apis/config/v1alpha1/adminqos.go @@ -380,12 +380,12 @@ type ReclaimedResourcesEvictionConfig struct { EvictionThreshold map[v1.ResourceName]float64 `json:"evictionThreshold"` // GracePeriod is the grace period of reclaimed resources' eviction - // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Minimum=-1 // +optional GracePeriod *int64 `json:"gracePeriod,omitempty"` // ThresholdMetToleranceDuration is the tolerance duration before eviction. - // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Minimum=-1 // +optional ThresholdMetToleranceDuration *int64 `json:"thresholdMetToleranceDuration,omitempty"` } @@ -449,7 +449,7 @@ type CPUPressureEvictionConfig struct { MinSuppressionToleranceDuration *metav1.Duration `json:"minSuppressionToleranceDuration,omitempty"` // GracePeriod is the grace period of cpu pressure eviction - // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Minimum=-1 // +optional GracePeriod *int64 `json:"gracePeriod,omitempty"` @@ -477,7 +477,7 @@ type NumaCPUPressureEvictionConfig struct { // GracePeriod is the grace period (in seconds) after a pod starts before it can be considered for eviction // due to NUMA CPU pressure. 0 means no grace period. - // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Minimum=-1 // +optional GracePeriod *int64 `json:"gracePeriod,omitempty"` @@ -555,12 +555,12 @@ type MemoryPressureEvictionConfig struct { RSSOveruseRateThreshold *float64 `json:"rssOveruseRateThreshold,omitempty"` // GracePeriod is the grace period of memory pressure eviction - // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Minimum=-1 // +optional GracePeriod *int64 `json:"gracePeriod,omitempty"` // ReclaimedGracePeriod is the grace period of memory pressure reclaimed eviction - // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Minimum=-1 // +optional ReclaimedGracePeriod *int64 `json:"reclaimedGracePeriod,omitempty"` } @@ -592,6 +592,7 @@ type SystemLoadPressureEvictionConfig struct { CoolDownTime *int64 `json:"coolDownTime,omitempty"` // GracePeriod is the grace period of pod deletion + // +kubebuilder:validation:Minimum=-1 // +optional GracePeriod *int64 `json:"gracePeriod,omitempty"` @@ -654,6 +655,7 @@ type RootfsPressureEvictionConfig struct { MinimumImageFsDiskCapacityThreshold *resource.Quantity `json:"minimumImageFsDiskCapacityThreshold,omitempty"` // GracePeriod is the grace period of pod deletion + // +kubebuilder:validation:Minimum=-1 // +optional GracePeriod *int64 `json:"gracePeriod,omitempty"` @@ -687,7 +689,7 @@ type NetworkEvictionConfig struct { NICUnhealthyToleranceDuration *metav1.Duration `json:"nicUnhealthyToleranceDuration,omitempty"` // GracePeriod is the grace period of nic health eviction - // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Minimum=-1 // +optional GracePeriod *int64 `json:"gracePeriod,omitempty"` } @@ -750,6 +752,8 @@ type CPUSystemPressureEvictionConfig struct { // +optional EvictionRankingMetrics []string `json:"evictionRankingMetrics,omitempty"` + // GracePeriod is the grace period of cpu system pressure eviction + // +kubebuilder:validation:Minimum=-1 // +optional GracePeriod *int64 `json:"gracePeriod,omitempty"`