mirror of
https://github.com/kubernetes-sigs/descheduler.git
synced 2026-01-28 14:41:10 +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"
|
import "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
|
||||||
func addDefaultingFuncs(scheme *runtime.Scheme) error {
|
func addDefaultingFuncs(scheme *runtime.Scheme) error {
|
||||||
return RegisterDefaults(scheme)
|
return nil //RegisterDefaults(scheme)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,9 +17,13 @@ limitations under the License.
|
|||||||
package rescheduler
|
package rescheduler
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"encoding/json"
|
||||||
|
//"fmt"
|
||||||
|
"io/ioutil"
|
||||||
|
//"os"
|
||||||
|
|
||||||
"github.com/aveshagarwal/rescheduler/cmd/rescheduler/app/options"
|
"github.com/aveshagarwal/rescheduler/cmd/rescheduler/app/options"
|
||||||
|
"github.com/aveshagarwal/rescheduler/pkg/api/v1alpha1"
|
||||||
"github.com/aveshagarwal/rescheduler/pkg/rescheduler/client"
|
"github.com/aveshagarwal/rescheduler/pkg/rescheduler/client"
|
||||||
eutils "github.com/aveshagarwal/rescheduler/pkg/rescheduler/evictions/utils"
|
eutils "github.com/aveshagarwal/rescheduler/pkg/rescheduler/evictions/utils"
|
||||||
"github.com/aveshagarwal/rescheduler/pkg/rescheduler/strategies"
|
"github.com/aveshagarwal/rescheduler/pkg/rescheduler/strategies"
|
||||||
@@ -32,6 +36,17 @@ func Run(rs *options.ReschedulerServer) error {
|
|||||||
}
|
}
|
||||||
rs.Client = rsclient
|
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)
|
policyGroupVersion, err := eutils.SupportEviction(rs.Client)
|
||||||
if err != nil || len(policyGroupVersion) == 0 {
|
if err != nil || len(policyGroupVersion) == 0 {
|
||||||
return err
|
return err
|
||||||
|
|||||||
Reference in New Issue
Block a user