mirror of
https://github.com/kubernetes-sigs/descheduler.git
synced 2026-01-26 13:29:11 +01:00
Implment reading of rescheduler's policy.
This commit is contained in:
@@ -19,5 +19,5 @@ package v1alpha1
|
||||
import "k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
func addDefaultingFuncs(scheme *runtime.Scheme) error {
|
||||
return RegisterDefaults(scheme)
|
||||
return nil //RegisterDefaults(scheme)
|
||||
}
|
||||
|
||||
@@ -17,9 +17,13 @@ limitations under the License.
|
||||
package rescheduler
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"encoding/json"
|
||||
//"fmt"
|
||||
"io/ioutil"
|
||||
//"os"
|
||||
|
||||
"github.com/aveshagarwal/rescheduler/cmd/rescheduler/app/options"
|
||||
"github.com/aveshagarwal/rescheduler/pkg/api/v1alpha1"
|
||||
"github.com/aveshagarwal/rescheduler/pkg/rescheduler/client"
|
||||
eutils "github.com/aveshagarwal/rescheduler/pkg/rescheduler/evictions/utils"
|
||||
"github.com/aveshagarwal/rescheduler/pkg/rescheduler/strategies"
|
||||
@@ -32,6 +36,17 @@ func Run(rs *options.ReschedulerServer) error {
|
||||
}
|
||||
rs.Client = rsclient
|
||||
|
||||
reschedulerPolicy := v1alpha1.ReschedulerPolicy{}
|
||||
if len(rs.PolicyConfigFile) > 0 {
|
||||
data, err := ioutil.ReadFile(rs.PolicyConfigFile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := json.Unmarshal(data, &reschedulerPolicy); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
policyGroupVersion, err := eutils.SupportEviction(rs.Client)
|
||||
if err != nil || len(policyGroupVersion) == 0 {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user