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

Update rescheduler's implementation.

This commit is contained in:
Avesh Agarwal
2017-08-05 00:21:23 -04:00
parent 1462cefa22
commit 7755fded12
3 changed files with 14 additions and 6 deletions

View File

@@ -26,7 +26,7 @@ var (
AddToScheme = SchemeBuilder.AddToScheme
)
// GroupName is the group name use in this package
// GroupName is the group name used in this package
const GroupName = "reschedulercomponentconfig"
// SchemeGroupVersion is group version used to register these objects

View File

@@ -56,8 +56,8 @@ func Run(rs *options.ReschedulerServer) error {
}
fmt.Printf("\nreschedulerPolicy: %#v\n", reschedulerPolicy)
policyGroupVersion, err := eutils.SupportEviction(rs.Client)
if err != nil || len(policyGroupVersion) == 0 {
evictionPolicyGroupVersion, err := eutils.SupportEviction(rs.Client)
if err != nil || len(evictionPolicyGroupVersion) == 0 {
return err
}
@@ -67,7 +67,8 @@ func Run(rs *options.ReschedulerServer) error {
return err
}
strategies.LowNodeUtilization(rs.Client, policyGroupVersion, nodes)
strategies.RemoveDuplicatePods(rs.Client, policyGroupVersion, nodes)
strategies.RemoveDuplicatePods(rs.Client, evictionPolicyGroupVersion, nodes)
strategies.LowNodeUtilization(rs.Client, evictionPolicyGroupVersion, nodes)
return nil
}

View File

@@ -29,12 +29,19 @@ import (
podutil "github.com/aveshagarwal/rescheduler/pkg/rescheduler/pod"
)
type NodeUsageMap map[*v1.Node]api.ResourceThresholds
func LowNodeUtilization(client clientset.Interface, policyGroupVersion string, nodes []*v1.Node) {
nodeUsageMap := NodeUsageMap{}
for _, node := range nodes {
fmt.Printf("Node %#v usage: %#v\n", node.Name, NodeUtilization(client, node))
nodeUsageMap[node] = NodeUtilization(client, node)
fmt.Printf("Node %#v usage: %#v\n", node.Name, nodeUsageMap[node])
}
}
func FindNodesWithLowUtilization() {
}
func NodeUtilization(client clientset.Interface, node *v1.Node) api.ResourceThresholds {
pods, err := podutil.ListPodsOnANode(client, node)
if err != nil {