1
0
mirror of https://github.com/kubernetes-sigs/descheduler.git synced 2026-01-26 05:14:13 +01:00

Do some code cleans.

Signed-off-by: yanggang <gang.yang@daocloud.io>
This commit is contained in:
yanggang
2023-04-26 21:05:20 +08:00
parent 776f196569
commit 71fb4a2117
2 changed files with 16 additions and 47 deletions

View File

@@ -53,26 +53,6 @@ func GetPriorityFromPriorityClass(ctx context.Context, client clientset.Interfac
return SystemCriticalPriority, nil
}
// GetPriorityFromStrategyParams gets priority from the given StrategyParameters.
// It will return SystemCriticalPriority by default.
func GetPriorityFromStrategyParams(ctx context.Context, client clientset.Interface, priorityThreshold *api.PriorityThreshold) (priority int32, err error) {
if priorityThreshold == nil {
return SystemCriticalPriority, nil
}
if priorityThreshold.Value != nil {
priority = *priorityThreshold.Value
} else {
priority, err = GetPriorityFromPriorityClass(ctx, client, priorityThreshold.Name)
if err != nil {
return
}
}
if priority > SystemCriticalPriority {
return 0, fmt.Errorf("Priority threshold can't be greater than %d", SystemCriticalPriority)
}
return
}
// GetPriorityValueFromPriorityThreshold gets priority from the given PriorityThreshold.
// It will return SystemCriticalPriority by default.
func GetPriorityValueFromPriorityThreshold(ctx context.Context, client clientset.Interface, priorityThreshold *api.PriorityThreshold) (priority int32, err error) {