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

Merge pull request #16 from aveshagarwal/master-fix-number-evicted-pods

Fix computation of number of evicted pods.
This commit is contained in:
Avesh Agarwal
2017-09-27 19:01:22 -04:00
committed by GitHub

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 {