1
0
mirror of https://github.com/kubernetes-sigs/descheduler.git synced 2026-01-26 21:31:18 +01:00

Separate migration of strategy configuration from the constructing and running the plugins (#999)

* Remove log level from Errors

Every error printed via Errors is expected to be important and always
printable.

* Invoke first Deschedule and then Balance extension points (breaking change)

* Separate plugin arg conversion from pluginsMap

* Seperate profile population from plugin execution

* Convert strategy params into profiles outside the main descheduling loop

Strategy params are static and do not change in time.

* Bump the internal DeschedulerPolicy to v1alpha2

Drop conversion from v1alpha1 to internal

* add tests to v1alpha1 to internal conversion

* add tests to strategyParamsToPluginArgs params wiring

* in v1alpha1 evictableNamespaces are still Namespaces

* add test passing in all params

Co-authored-by: Lucas Severo Alves <lseveroa@redhat.com>
This commit is contained in:
Jan Chaloupka
2022-11-14 17:48:41 +01:00
committed by GitHub
parent d997be59a9
commit 6e953b2ff3
21 changed files with 2138 additions and 1114 deletions

View File

@@ -151,11 +151,11 @@ func (d *DefaultEvictor) PreEvictionFilter(pod *v1.Pod) bool {
if defaultEvictorArgs.NodeFit {
nodes, err := nodeutil.ReadyNodes(context.TODO(), d.handle.ClientSet(), d.handle.SharedInformerFactory().Core().V1().Nodes().Lister(), defaultEvictorArgs.NodeSelector)
if err != nil {
klog.V(1).ErrorS(fmt.Errorf("Pod fails the following checks"), "pod", klog.KObj(pod))
klog.ErrorS(fmt.Errorf("Pod fails the following checks"), "pod", klog.KObj(pod))
return false
}
if !nodeutil.PodFitsAnyOtherNode(d.handle.GetPodsAssignedToNodeFunc(), pod, nodes) {
klog.V(1).ErrorS(fmt.Errorf("pod does not fit on any other node because of nodeSelector(s), Taint(s), or nodes marked as unschedulable"), "pod", klog.KObj(pod))
klog.ErrorS(fmt.Errorf("pod does not fit on any other node because of nodeSelector(s), Taint(s), or nodes marked as unschedulable"), "pod", klog.KObj(pod))
return false
}
return true

View File

@@ -299,7 +299,7 @@ func evictPods(
WithoutNamespaces(excludedNamespaces).
BuildFilterFunc()
if err != nil {
klog.V(1).ErrorS(err, "could not build preEvictionFilter with namespace exclusion")
klog.ErrorS(err, "could not build preEvictionFilter with namespace exclusion")
continue
}

View File

@@ -33,7 +33,15 @@ func ValidateHighNodeUtilizationArgs(args *HighNodeUtilizationArgs) error {
}
func ValidateLowNodeUtilizationArgs(args *LowNodeUtilizationArgs) error {
return validateLowNodeUtilizationThresholds(args.Thresholds, args.TargetThresholds, args.UseDeviationThresholds)
// only exclude can be set, or not at all
if args.EvictableNamespaces != nil && len(args.EvictableNamespaces.Include) > 0 {
return fmt.Errorf("only Exclude namespaces can be set, inclusion is not supported")
}
err := validateLowNodeUtilizationThresholds(args.Thresholds, args.TargetThresholds, args.UseDeviationThresholds)
if err != nil {
return err
}
return nil
}
func validateLowNodeUtilizationThresholds(thresholds, targetThresholds api.ResourceThresholds, useDeviationThresholds bool) error {

View File

@@ -33,7 +33,7 @@ func ValidateRemovePodsHavingTooManyRestartsArgs(args *RemovePodsHavingTooManyRe
}
if args.PodRestartThreshold < 1 {
return fmt.Errorf("PodsHavingTooManyRestarts threshold not set")
return fmt.Errorf("invalid PodsHavingTooManyRestarts threshold")
}
return nil