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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user