1
0
mirror of https://github.com/kubernetes-sigs/descheduler.git synced 2026-01-28 14:41:10 +01:00

Fix computation of number of evicted pods.

This commit is contained in:
Avesh Agarwal
2017-09-27 18:31:27 -04:00
parent 2161b3b3e7
commit 179646a332

View File

@@ -124,7 +124,7 @@ func classifyNodes(npm NodePodsMap, thresholds api.ResourceThresholds, targetThr
return lowNodes, targetNodes, otherNodes
}
func evictPodsFromTargetNodes(client clientset.Interface, evictionPolicyGroupVersion string, targetNodes []NodeUsageMap, lowNodes []NodeUsageMap, targetThresholds api.ResourceThresholds, dryRun bool) int {
func evictPodsFromTargetNodes(client clientset.Interface, evictionPolicyGroupVersion string, targetNodes, lowNodes []NodeUsageMap, targetThresholds api.ResourceThresholds, dryRun bool) int {
podsEvicted := 0
SortNodesByUsage(targetNodes)
@@ -155,6 +155,7 @@ func evictPodsFromTargetNodes(client clientset.Interface, evictionPolicyGroupVer
fmt.Printf("Error when evicting pod: %#v (%#v)\n", pod.Name, err)
} else {
fmt.Printf("Evicted pod: %#v (%#v)\n", pod.Name, err)
podsEvicted++
nodePodsUsage = nodePodsUsage - onePodPercentage
totalPods--
if nodePodsUsage <= targetThresholds[v1.ResourcePods] || totalPods <= 0 {