Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

koord-descheduler: LowNodeLoad supports anomaly detector #987

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions pkg/descheduler/apis/config/types_loadaware.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ type LowNodeLoadArgs struct {

// LowThresholds defines the low usage threshold of resources
LowThresholds ResourceThresholds

// AnomalyCondition indicates the node load anomaly thresholds,
// the default is 5 consecutive times exceeding HighThresholds,
// it is determined that the node is abnormal, and the Pods need to be migrated to reduce the load.
AnomalyCondition *LoadAnomalyCondition
}

type LowNodeLoadPodSelector struct {
Expand All @@ -72,3 +77,10 @@ type LowNodeLoadPodSelector struct {
// Selector label query over pods for migrated
Selector *metav1.LabelSelector
}

type LoadAnomalyCondition struct {
// Timeout indicates the expiration time of the abnormal state, the default is 1 minute
Timeout metav1.Duration
// ConsecutiveAbnormalities indicates the number of consecutive abnormalities
ConsecutiveAbnormalities uint32
}
8 changes: 8 additions & 0 deletions pkg/descheduler/apis/config/v1alpha2/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ var (
Duration: metav1.Duration{Duration: 5 * time.Minute},
},
}

defaultLoadAnomalyCondition = &LoadAnomalyCondition{
Timeout: &metav1.Duration{Duration: 1 * time.Minute},
ConsecutiveAbnormalities: 5,
}
)

func addDefaultingFuncs(scheme *runtime.Scheme) error {
Expand Down Expand Up @@ -247,4 +252,7 @@ func SetDefaults_LowNodeLoadArgs(obj *LowNodeLoadArgs) {
if obj.NodeFit == nil {
obj.NodeFit = pointer.Bool(true)
}
if obj.AnomalyCondition == nil || obj.AnomalyCondition.ConsecutiveAbnormalities == 0 {
obj.AnomalyCondition = defaultLoadAnomalyCondition
}
}
12 changes: 12 additions & 0 deletions pkg/descheduler/apis/config/v1alpha2/types_loadaware.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ type LowNodeLoadArgs struct {

// LowThresholds defines the low usage threshold of resources
LowThresholds ResourceThresholds `json:"lowThresholds,omitempty"`

// AnomalyCondition indicates the node load anomaly thresholds,
// the default is 5 consecutive times exceeding HighThresholds,
// it is determined that the node is abnormal, and the Pods need to be migrated to reduce the load.
AnomalyCondition *LoadAnomalyCondition `json:"anomalyCondition,omitempty"`
}

type LowNodeLoadPodSelector struct {
Expand All @@ -71,3 +76,10 @@ type LowNodeLoadPodSelector struct {
// Selector label query over pods for migrated
Selector *metav1.LabelSelector `json:"selector,omitempty"`
}

type LoadAnomalyCondition struct {
// Timeout indicates the expiration time of the abnormal state, the default is 1 minute
Timeout *metav1.Duration `json:"timeout,omitempty"`
// ConsecutiveAbnormalities indicates the number of consecutive abnormalities
ConsecutiveAbnormalities uint32 `json:"consecutiveAbnormalities,omitempty"`
}
54 changes: 54 additions & 0 deletions pkg/descheduler/apis/config/v1alpha2/zz_generated.conversion.go

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

26 changes: 26 additions & 0 deletions pkg/descheduler/apis/config/v1alpha2/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ func ValidateLowLoadUtilizationArgs(path *field.Path, args *deschedulerconfig.Lo
}
}

if args.AnomalyCondition.ConsecutiveAbnormalities <= 0 {
fieldPath := path.Child("anomalyDetectionThresholds").Child("consecutiveAbnormalities")
allErrs = append(allErrs, field.Invalid(fieldPath, args.AnomalyCondition.ConsecutiveAbnormalities, "consecutiveAbnormalities must be greater than 0"))
}

if len(allErrs) == 0 {
return nil
}
Expand Down
22 changes: 22 additions & 0 deletions pkg/descheduler/apis/config/zz_generated.deepcopy.go

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

Loading