From 179646a3322014b6e610800d277eeae0c5e46543 Mon Sep 17 00:00:00 2001 From: Avesh Agarwal Date: Wed, 27 Sep 2017 18:31:27 -0400 Subject: [PATCH] Fix computation of number of evicted pods. --- pkg/descheduler/strategies/lownodeutilization.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/descheduler/strategies/lownodeutilization.go b/pkg/descheduler/strategies/lownodeutilization.go index 96e64c707..b247eea9d 100644 --- a/pkg/descheduler/strategies/lownodeutilization.go +++ b/pkg/descheduler/strategies/lownodeutilization.go @@ -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 {