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

PodEvictor: add a new param thresholdPriority to IsEvictable

This commit is contained in:
lixiang
2020-08-07 16:03:50 +08:00
parent ae38aa63af
commit 95ce2a4ff7
11 changed files with 73 additions and 34 deletions

View File

@@ -20,6 +20,7 @@ import (
"context"
"math"
"os"
"sigs.k8s.io/descheduler/pkg/utils"
"sort"
"strings"
"testing"
@@ -509,7 +510,10 @@ func evictPods(ctx context.Context, t *testing.T, clientSet clientset.Interface,
continue
}
// List all the pods on the current Node
podsOnANode, err := podutil.ListPodsOnANode(ctx, clientSet, node, podutil.WithFilter(podEvictor.IsEvictable))
podsOnANode, err := podutil.ListPodsOnANode(ctx, clientSet, node,
podutil.WithFilter(func(pod *v1.Pod) bool {
return podEvictor.IsEvictable(pod, utils.SystemCriticalPriority)
}))
if err != nil {
t.Errorf("Error listing pods on a node %v", err)
}
@@ -521,7 +525,10 @@ func evictPods(ctx context.Context, t *testing.T, clientSet clientset.Interface,
}
t.Log("Eviction of pods starting")
startEndToEndForLowNodeUtilization(ctx, clientSet, nodeInformer, podEvictor)
podsOnleastUtilizedNode, err := podutil.ListPodsOnANode(ctx, clientSet, leastLoadedNode, podutil.WithFilter(podEvictor.IsEvictable))
podsOnleastUtilizedNode, err := podutil.ListPodsOnANode(ctx, clientSet, leastLoadedNode,
podutil.WithFilter(func(pod *v1.Pod) bool {
return podEvictor.IsEvictable(pod, utils.SystemCriticalPriority)
}))
if err != nil {
t.Errorf("Error listing pods on a node %v", err)
}