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