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

Update implementation of RemoveDuplicates strategy.

This commit is contained in:
Avesh Agarwal
2017-08-28 12:32:17 -04:00
parent 2259a793ec
commit 0f30358750
2 changed files with 7 additions and 3 deletions

View File

@@ -53,7 +53,7 @@ func Run(rs *options.ReschedulerServer) error {
return err
}
strategies.RemoveDuplicatePods(rs.Client, evictionPolicyGroupVersion, nodes)
strategies.RemoveDuplicatePods(rs.Client, reschedulerPolicy.Strategies["RemoveDuplicates"], evictionPolicyGroupVersion, nodes)
strategies.LowNodeUtilization(rs.Client, reschedulerPolicy.Strategies["LowNodeUtilization"], evictionPolicyGroupVersion, nodes)
return nil

View File

@@ -23,6 +23,7 @@ import (
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
"github.com/aveshagarwal/rescheduler/pkg/api"
"github.com/aveshagarwal/rescheduler/pkg/rescheduler/evictions"
podutil "github.com/aveshagarwal/rescheduler/pkg/rescheduler/pod"
)
@@ -30,7 +31,11 @@ import (
//type creator string
type DuplicatePodsMap map[string][]*v1.Pod
func RemoveDuplicatePods(client clientset.Interface, policyGroupVersion string, nodes []*v1.Node) error {
func RemoveDuplicatePods(client clientset.Interface, strategy api.ReschedulerStrategy, policyGroupVersion string, nodes []*v1.Node) {
if !strategy.Enabled {
return
}
for _, node := range nodes {
fmt.Printf("\nProcessing node: %#v\n", node.Name)
dpm := RemoveDuplicatePodsOnANode(client, node)
@@ -50,7 +55,6 @@ func RemoveDuplicatePods(client clientset.Interface, policyGroupVersion string,
}
}
}
return nil
}
func RemoveDuplicatePodsOnANode(client clientset.Interface, node *v1.Node) DuplicatePodsMap {