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-04 11:55:20 -04:00
parent b9e60d8030
commit 79985395d5
3 changed files with 16 additions and 9 deletions

View File

@@ -49,7 +49,7 @@ type ReschedulerStrategy struct {
// Only one of its members may be specified
type StrategyParameters struct {
NodeResourceUtilizationThresholds *NodeResourceUtilizationThresholds
NodeResourceUtilizationThresholds NodeResourceUtilizationThresholds
}
type Percentage int

View File

@@ -49,7 +49,7 @@ type ReschedulerStrategy struct {
// Only one of its members may be specified
type StrategyParameters struct {
NodeResourceUtilizationThresholds *NodeResourceUtilizationThresholds `json:"nodeResourceUtilizationThresholds,omitempty"`
NodeResourceUtilizationThresholds NodeResourceUtilizationThresholds `json:"nodeResourceUtilizationThresholds,omitempty"`
}
type Percentage int

View File

@@ -17,10 +17,11 @@ limitations under the License.
package rescheduler
import (
"encoding/json"
//"fmt"
"io/ioutil"
//"os"
"fmt"
"os"
"path/filepath"
"k8s.io/apimachinery/pkg/util/yaml"
"github.com/aveshagarwal/rescheduler/cmd/rescheduler/app/options"
"github.com/aveshagarwal/rescheduler/pkg/api/v1alpha1"
@@ -38,15 +39,21 @@ func Run(rs *options.ReschedulerServer) error {
reschedulerPolicy := v1alpha1.ReschedulerPolicy{}
if len(rs.PolicyConfigFile) > 0 {
data, err := ioutil.ReadFile(rs.PolicyConfigFile)
filename, err := filepath.Abs(rs.PolicyConfigFile)
if err != nil {
return err
}
if err := json.Unmarshal(data, &reschedulerPolicy); err != nil {
fd, err := os.Open(filename)
if err != nil {
return err
}
}
if err := yaml.NewYAMLOrJSONDecoder(fd, 4096).Decode(&reschedulerPolicy); err != nil {
return err
}
}
fmt.Printf("\nreschedulerPolicy: %#v\n", reschedulerPolicy)
policyGroupVersion, err := eutils.SupportEviction(rs.Client)
if err != nil || len(policyGroupVersion) == 0 {
return err