mirror of
https://github.com/kubernetes-sigs/descheduler.git
synced 2026-01-26 13:29:11 +01:00
Descheduler related modifications.
This commit is contained in:
2
Makefile
2
Makefile
@@ -14,7 +14,7 @@
|
||||
|
||||
|
||||
build:
|
||||
go build -o _output/bin/rescheduler github.com/aveshagarwal/rescheduler/cmd/rescheduler
|
||||
go build -o _output/bin/descheduler github.com/kubernetes-incubator/descheduler/cmd/descheduler
|
||||
|
||||
clean:
|
||||
rm -rf _output
|
||||
|
||||
28
README.md
28
README.md
@@ -1,4 +1,4 @@
|
||||
# Rescheduler for Kubernetes
|
||||
# Descheduler for Kubernetes
|
||||
|
||||
## Introduction
|
||||
|
||||
@@ -17,32 +17,32 @@ or removed from nodes, pod/node affinity requirements are not satisfied any more
|
||||
* New nodes are added to clusters.
|
||||
|
||||
Consequently, there might be several pods scheduled on less desired nodes in a cluster.
|
||||
Rescheduler, based on its policy, finds pods that can be moved and evicts them. Please
|
||||
note, in current implementation, rescheduler does not schedule replacement of evicted pods
|
||||
Descheduler, based on its policy, finds pods that can be moved and evicts them. Please
|
||||
note, in current implementation, descheduler does not schedule replacement of evicted pods
|
||||
but relies on the default scheduler for that.
|
||||
|
||||
## Build and Run
|
||||
|
||||
Build rescheduler:
|
||||
Build descheduler:
|
||||
|
||||
```sh
|
||||
$ make
|
||||
```
|
||||
|
||||
and run rescheduler:
|
||||
and run descheduler:
|
||||
|
||||
```sh
|
||||
$ ./_output/bin/rescheduler --kubeconfig <path to kubeconfig> --policy-config-file <path-to-policy-file>
|
||||
$ ./_output/bin/descheduler --kubeconfig <path to kubeconfig> --policy-config-file <path-to-policy-file>
|
||||
```
|
||||
|
||||
For more information about available options run:
|
||||
```
|
||||
$ ./_output/bin/rescheduler --help
|
||||
$ ./_output/bin/descheduler --help
|
||||
```
|
||||
|
||||
## Policy and Strategies
|
||||
|
||||
Rescheduler's policy is configurable and includes strategies to be enabled or disabled.
|
||||
Descheduler's policy is configurable and includes strategies to be enabled or disabled.
|
||||
Two strategies, `RemoveDuplicates` and `LowNodeUtilization` are currently implemented.
|
||||
As part of the policy, the parameters associated with the strategies can be configured too.
|
||||
By default, all strategies are enabled.
|
||||
@@ -58,8 +58,8 @@ are ready again, this strategy could be enabled to evict those duplicate pods. C
|
||||
parameters associated with this strategy. To disable this strategy, the policy would look like:
|
||||
|
||||
```
|
||||
apiVersion: "rescheduler/v1alpha1"
|
||||
kind: "ReschedulerPolicy"
|
||||
apiVersion: "descheduler/v1alpha1"
|
||||
kind: "DeschedulerPolicy"
|
||||
strategies:
|
||||
"RemoveDuplicates":
|
||||
enabled: false
|
||||
@@ -85,8 +85,8 @@ These thresholds, `thresholds` and `targetThresholds`, could be tuned as per you
|
||||
An example of the policy for this strategy would look like:
|
||||
|
||||
```
|
||||
apiVersion: "rescheduler/v1alpha1"
|
||||
kind: "ReschedulerPolicy"
|
||||
apiVersion: "descheduler/v1alpha1"
|
||||
kind: "DeschedulerPolicy"
|
||||
strategies:
|
||||
"LowNodeUtilization":
|
||||
enabled: true
|
||||
@@ -109,7 +109,7 @@ under utilized frequently or for a short period of time. By default, `numberOfNo
|
||||
|
||||
## Pod Evictions
|
||||
|
||||
When the rescheduler decides to evict pods from a node, it employs following general mechanism:
|
||||
When the descheduler decides to evict pods from a node, it employs following general mechanism:
|
||||
|
||||
* Critical pods (with annotations scheduler.alpha.kubernetes.io/critical-pod) are never evicted.
|
||||
* Pods (static or mirrored pods or stand alone pods) not part of an RC, RS, Deployment or Jobs are
|
||||
@@ -119,7 +119,7 @@ never evicted because these pods won't be recreated.
|
||||
* Best efforts pods are evicted before Burstable and Guaranteed pods.
|
||||
|
||||
### Pod disruption Budget (PDB)
|
||||
Pods subject to Pod Disruption Budget (PDB) are not evicted if rescheduling violates its pod
|
||||
Pods subject to Pod Disruption Budget (PDB) are not evicted if descheduling violates its pod
|
||||
disruption budget (PDB). The pods are evicted by using eviction subresource to handle PDB.
|
||||
|
||||
## Roadmap
|
||||
|
||||
55
cmd/descheduler/app/options/options.go
Normal file
55
cmd/descheduler/app/options/options.go
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package options provides the descheduler flags
|
||||
package options
|
||||
|
||||
import (
|
||||
"k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
|
||||
|
||||
// install the componentconfig api so we get its defaulting and conversion functions
|
||||
"github.com/kubernetes-incubator/descheduler/pkg/apis/componentconfig"
|
||||
_ "github.com/kubernetes-incubator/descheduler/pkg/apis/componentconfig/install"
|
||||
"github.com/kubernetes-incubator/descheduler/pkg/apis/componentconfig/v1alpha1"
|
||||
deschedulerscheme "github.com/kubernetes-incubator/descheduler/pkg/descheduler/scheme"
|
||||
|
||||
"github.com/spf13/pflag"
|
||||
)
|
||||
|
||||
// DeschedulerServer configuration
|
||||
type DeschedulerServer struct {
|
||||
componentconfig.DeschedulerConfiguration
|
||||
Client clientset.Interface
|
||||
}
|
||||
|
||||
// NewDeschedulerServer creates a new DeschedulerServer with default parameters
|
||||
func NewDeschedulerServer() *DeschedulerServer {
|
||||
versioned := v1alpha1.DeschedulerConfiguration{}
|
||||
deschedulerscheme.Scheme.Default(&versioned)
|
||||
cfg := componentconfig.DeschedulerConfiguration{}
|
||||
deschedulerscheme.Scheme.Convert(versioned, &cfg, nil)
|
||||
s := DeschedulerServer{
|
||||
DeschedulerConfiguration: cfg,
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
// AddFlags adds flags for a specific SchedulerServer to the specified FlagSet
|
||||
func (rs *DeschedulerServer) AddFlags(fs *pflag.FlagSet) {
|
||||
fs.DurationVar(&rs.DeschedulingInterval, "descheduling-interval", rs.DeschedulingInterval, "time interval between two consecutive descheduler executions")
|
||||
fs.StringVar(&rs.KubeconfigFile, "kubeconfig-file", rs.KubeconfigFile, "File with kube configuration.")
|
||||
fs.StringVar(&rs.PolicyConfigFile, "policy-config-file", rs.PolicyConfigFile, "File with descheduler policy configuration.")
|
||||
}
|
||||
@@ -14,27 +14,27 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package app implements a Server object for running the rescheduler.
|
||||
// Package app implements a Server object for running the descheduler.
|
||||
package app
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/aveshagarwal/rescheduler/cmd/rescheduler/app/options"
|
||||
"github.com/aveshagarwal/rescheduler/pkg/rescheduler"
|
||||
"github.com/kubernetes-incubator/descheduler/cmd/descheduler/app/options"
|
||||
"github.com/kubernetes-incubator/descheduler/pkg/descheduler"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
)
|
||||
|
||||
// NewReschedulerCommand creates a *cobra.Command object with default parameters
|
||||
func NewReschedulerCommand() *cobra.Command {
|
||||
s := options.NewReschedulerServer()
|
||||
// NewDeschedulerCommand creates a *cobra.Command object with default parameters
|
||||
func NewDeschedulerCommand() *cobra.Command {
|
||||
s := options.NewDeschedulerServer()
|
||||
s.AddFlags(pflag.CommandLine)
|
||||
cmd := &cobra.Command{
|
||||
Use: "rescheduler",
|
||||
Short: "reschdeduler",
|
||||
Long: `The rescheduler evicts pods which may be bound to less desired nodes`,
|
||||
Use: "descheduler",
|
||||
Short: "descheduler",
|
||||
Long: `The descheduler evicts pods which may be bound to less desired nodes`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
err := Run(s)
|
||||
if err != nil {
|
||||
@@ -47,6 +47,6 @@ func NewReschedulerCommand() *cobra.Command {
|
||||
return cmd
|
||||
}
|
||||
|
||||
func Run(rs *options.ReschedulerServer) error {
|
||||
return rescheduler.Run(rs)
|
||||
func Run(rs *options.DeschedulerServer) error {
|
||||
return descheduler.Run(rs)
|
||||
}
|
||||
@@ -20,11 +20,11 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/aveshagarwal/rescheduler/cmd/rescheduler/app"
|
||||
"github.com/kubernetes-incubator/descheduler/cmd/descheduler/app"
|
||||
)
|
||||
|
||||
func main() {
|
||||
cmd := app.NewReschedulerCommand()
|
||||
cmd := app.NewDeschedulerCommand()
|
||||
if err := cmd.Execute(); err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package options provides the rescheduler flags
|
||||
package options
|
||||
|
||||
import (
|
||||
"k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
|
||||
|
||||
// install the componentconfig api so we get its defaulting and conversion functions
|
||||
"github.com/aveshagarwal/rescheduler/pkg/apis/componentconfig"
|
||||
_ "github.com/aveshagarwal/rescheduler/pkg/apis/componentconfig/install"
|
||||
"github.com/aveshagarwal/rescheduler/pkg/apis/componentconfig/v1alpha1"
|
||||
reschedulerscheme "github.com/aveshagarwal/rescheduler/pkg/rescheduler/scheme"
|
||||
|
||||
"github.com/spf13/pflag"
|
||||
)
|
||||
|
||||
// ReschedulerServer configuration
|
||||
type ReschedulerServer struct {
|
||||
componentconfig.ReschedulerConfiguration
|
||||
Client clientset.Interface
|
||||
}
|
||||
|
||||
// NewReschedulerServer creates a new ReschedulerServer with default parameters
|
||||
func NewReschedulerServer() *ReschedulerServer {
|
||||
versioned := v1alpha1.ReschedulerConfiguration{}
|
||||
reschedulerscheme.Scheme.Default(&versioned)
|
||||
cfg := componentconfig.ReschedulerConfiguration{}
|
||||
reschedulerscheme.Scheme.Convert(versioned, &cfg, nil)
|
||||
s := ReschedulerServer{
|
||||
ReschedulerConfiguration: cfg,
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
// AddFlags adds flags for a specific SchedulerServer to the specified FlagSet
|
||||
func (rs *ReschedulerServer) AddFlags(fs *pflag.FlagSet) {
|
||||
fs.DurationVar(&rs.ReschedulingInterval, "rescheduling-interval", rs.ReschedulingInterval, "time interval between two consecutive rescheduler executions")
|
||||
fs.StringVar(&rs.KubeconfigFile, "kubeconfig-file", rs.KubeconfigFile, "File with kube configuration.")
|
||||
fs.StringVar(&rs.PolicyConfigFile, "policy-config-file", rs.PolicyConfigFile, "File with rescheduler policy configuration.")
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
apiVersion: "rescheduler/v1alpha1"
|
||||
kind: "ReschedulerPolicy"
|
||||
apiVersion: "descheduler/v1alpha1"
|
||||
kind: "DeschedulerPolicy"
|
||||
strategies:
|
||||
"RemoveDuplicates":
|
||||
enabled: true
|
||||
"LowNodeUtilization":
|
||||
enabled: true
|
||||
params:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package: github.com/aveshagarwal/rescheduler
|
||||
package: github.com/kubernetes-incubator/descheduler
|
||||
import:
|
||||
- package: k8s.io/client-go
|
||||
version: e356aa2e77ab4a5914c216c12ba14cce25a25ab0 # kube 1.7.0
|
||||
|
||||
@@ -43,5 +43,5 @@ OS_ROOT="$( os::util::absolute_path "${init_source}" )"
|
||||
export OS_ROOT
|
||||
cd "${OS_ROOT}"
|
||||
|
||||
PRJ_PREFIX="github.com/aveshagarwal/rescheduler"
|
||||
PRJ_PREFIX="github.com/kubernetes-incubator/descheduler"
|
||||
OS_OUTPUT_BINPATH="${OS_ROOT}/_output/bin"
|
||||
|
||||
@@ -40,7 +40,7 @@ generated_files=($(
|
||||
|
||||
# We only work for deps within this prefix.
|
||||
#my_prefix="k8s.io/kubernetes"
|
||||
my_prefix="github.com/aveshagarwal/rescheduler"
|
||||
my_prefix="github.com/kubernetes-incubator/descheduler"
|
||||
|
||||
# Register function to be called on EXIT to remove codecgen
|
||||
# binary and also to touch the files that should be regenerated
|
||||
|
||||
@@ -16,4 +16,4 @@ limitations under the License.
|
||||
|
||||
// +k8s:deepcopy-gen=package,register
|
||||
|
||||
package api // import "github.com/aveshagarwal/rescheduler/pkg/api"
|
||||
package api // import "github.com/kubernetes-incubator/descheduler/pkg/api"
|
||||
|
||||
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package install installs the rescheduler's policy API group.
|
||||
// Package install installs the descheduler's policy API group.
|
||||
package install
|
||||
|
||||
import (
|
||||
@@ -22,23 +22,23 @@ import (
|
||||
"k8s.io/apimachinery/pkg/apimachinery/registered"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
reschedulerapi "github.com/aveshagarwal/rescheduler/pkg/api"
|
||||
"github.com/aveshagarwal/rescheduler/pkg/api/v1alpha1"
|
||||
reschedulerscheme "github.com/aveshagarwal/rescheduler/pkg/rescheduler/scheme"
|
||||
deschedulerapi "github.com/kubernetes-incubator/descheduler/pkg/api"
|
||||
"github.com/kubernetes-incubator/descheduler/pkg/api/v1alpha1"
|
||||
deschedulerscheme "github.com/kubernetes-incubator/descheduler/pkg/descheduler/scheme"
|
||||
)
|
||||
|
||||
func init() {
|
||||
Install(reschedulerscheme.GroupFactoryRegistry, reschedulerscheme.Registry, reschedulerscheme.Scheme)
|
||||
Install(deschedulerscheme.GroupFactoryRegistry, deschedulerscheme.Registry, deschedulerscheme.Scheme)
|
||||
}
|
||||
|
||||
// Install registers the API group and adds types to a scheme
|
||||
func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
|
||||
if err := announced.NewGroupMetaFactory(
|
||||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: reschedulerapi.GroupName,
|
||||
GroupName: deschedulerapi.GroupName,
|
||||
VersionPreferenceOrder: []string{v1alpha1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "github.com/aveshagarwal/rescheduler/pkg/api",
|
||||
AddInternalObjectsToScheme: reschedulerapi.AddToScheme,
|
||||
ImportPrefix: "github.com/kubernetes-incubator/descheduler/pkg/api",
|
||||
AddInternalObjectsToScheme: deschedulerapi.AddToScheme,
|
||||
},
|
||||
announced.VersionToSchemeFunc{
|
||||
v1alpha1.SchemeGroupVersion.Version: v1alpha1.AddToScheme,
|
||||
|
||||
@@ -27,7 +27,7 @@ var (
|
||||
)
|
||||
|
||||
// GroupName is the group name use in this package
|
||||
const GroupName = "rescheduler"
|
||||
const GroupName = "descheduler"
|
||||
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}
|
||||
@@ -44,7 +44,7 @@ func Resource(resource string) schema.GroupResource {
|
||||
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&ReschedulerPolicy{},
|
||||
&DeschedulerPolicy{},
|
||||
)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ReschedulerPolicy) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
func (x *DeschedulerPolicy) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperEncoder(e)
|
||||
_, _, _ = h, z, r
|
||||
@@ -175,7 +175,7 @@ func (x *ReschedulerPolicy) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ReschedulerPolicy) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
func (x *DeschedulerPolicy) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@@ -205,7 +205,7 @@ func (x *ReschedulerPolicy) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ReschedulerPolicy) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
func (x *DeschedulerPolicy) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@@ -265,7 +265,7 @@ func (x *ReschedulerPolicy) codecDecodeSelfFromMap(l int, d *codec1978.Decoder)
|
||||
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
|
||||
}
|
||||
|
||||
func (x *ReschedulerPolicy) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
func (x *DeschedulerPolicy) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@@ -405,7 +405,7 @@ func (x *StrategyList) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ReschedulerStrategy) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
func (x *DeschedulerStrategy) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperEncoder(e)
|
||||
_, _, _ = h, z, r
|
||||
@@ -493,7 +493,7 @@ func (x *ReschedulerStrategy) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ReschedulerStrategy) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
func (x *DeschedulerStrategy) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@@ -523,7 +523,7 @@ func (x *ReschedulerStrategy) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ReschedulerStrategy) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
func (x *DeschedulerStrategy) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@@ -583,7 +583,7 @@ func (x *ReschedulerStrategy) codecDecodeSelfFromMap(l int, d *codec1978.Decoder
|
||||
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
|
||||
}
|
||||
|
||||
func (x *ReschedulerStrategy) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
func (x *DeschedulerStrategy) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@@ -1160,11 +1160,11 @@ func (x codecSelfer1234) decStrategyList(v *StrategyList, d *codec1978.Decoder)
|
||||
yybh1 := z.DecBasicHandle()
|
||||
if yyv1 == nil {
|
||||
yyrl1, _ := z.DecInferLen(yyl1, yybh1.MaxInitLen, 56)
|
||||
yyv1 = make(map[StrategyName]ReschedulerStrategy, yyrl1)
|
||||
yyv1 = make(map[StrategyName]DeschedulerStrategy, yyrl1)
|
||||
*v = yyv1
|
||||
}
|
||||
var yymk1 StrategyName
|
||||
var yymv1 ReschedulerStrategy
|
||||
var yymv1 DeschedulerStrategy
|
||||
var yymg1 bool
|
||||
if yybh1.MapValueReset {
|
||||
yymg1 = true
|
||||
@@ -1182,11 +1182,11 @@ func (x codecSelfer1234) decStrategyList(v *StrategyList, d *codec1978.Decoder)
|
||||
if yymg1 {
|
||||
yymv1 = yyv1[yymk1]
|
||||
} else {
|
||||
yymv1 = ReschedulerStrategy{}
|
||||
yymv1 = DeschedulerStrategy{}
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerMapValue1234)
|
||||
if r.TryDecodeAsNil() {
|
||||
yymv1 = ReschedulerStrategy{}
|
||||
yymv1 = DeschedulerStrategy{}
|
||||
} else {
|
||||
yyv3 := &yymv1
|
||||
yyv3.CodecDecodeSelf(d)
|
||||
@@ -1209,11 +1209,11 @@ func (x codecSelfer1234) decStrategyList(v *StrategyList, d *codec1978.Decoder)
|
||||
if yymg1 {
|
||||
yymv1 = yyv1[yymk1]
|
||||
} else {
|
||||
yymv1 = ReschedulerStrategy{}
|
||||
yymv1 = DeschedulerStrategy{}
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerMapValue1234)
|
||||
if r.TryDecodeAsNil() {
|
||||
yymv1 = ReschedulerStrategy{}
|
||||
yymv1 = DeschedulerStrategy{}
|
||||
} else {
|
||||
yyv5 := &yymv1
|
||||
yyv5.CodecDecodeSelf(d)
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/api/v1"
|
||||
)
|
||||
|
||||
type ReschedulerPolicy struct {
|
||||
type DeschedulerPolicy struct {
|
||||
metav1.TypeMeta
|
||||
|
||||
// Strategies
|
||||
@@ -29,9 +29,9 @@ type ReschedulerPolicy struct {
|
||||
}
|
||||
|
||||
type StrategyName string
|
||||
type StrategyList map[StrategyName]ReschedulerStrategy
|
||||
type StrategyList map[StrategyName]DeschedulerStrategy
|
||||
|
||||
type ReschedulerStrategy struct {
|
||||
type DeschedulerStrategy struct {
|
||||
// Enabled or disabled
|
||||
Enabled bool
|
||||
|
||||
|
||||
@@ -15,10 +15,10 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
// +k8s:deepcopy-gen=package,register
|
||||
// +k8s:conversion-gen=github.com/aveshagarwal/rescheduler/pkg/api
|
||||
// +k8s:conversion-gen=github.com/kubernetes-incubator/descheduler/pkg/api
|
||||
// +k8s:defaulter-gen=TypeMeta
|
||||
|
||||
// Package v1alpha1 is the v1alpha1 version of the rescheduler API
|
||||
// +groupName=rescheduler
|
||||
// Package v1alpha1 is the v1alpha1 version of the descheduler API
|
||||
// +groupName=descheduler
|
||||
|
||||
package v1alpha1 // import "github.com/aveshagarwal/rescheduler/pkg/api/v1alpha1"
|
||||
package v1alpha1 // import "github.com/kubernetes-incubator/descheduler/pkg/api/v1alpha1"
|
||||
|
||||
@@ -28,7 +28,7 @@ var (
|
||||
)
|
||||
|
||||
// GroupName is the group name used in this package
|
||||
const GroupName = "rescheduler"
|
||||
const GroupName = "descheduler"
|
||||
const GroupVersion = "v1alpha1"
|
||||
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
@@ -54,7 +54,7 @@ func init() {
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
// TODO this will get cleaned up with the scheme types are fixed
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&ReschedulerPolicy{},
|
||||
&DeschedulerPolicy{},
|
||||
)
|
||||
|
||||
return nil
|
||||
|
||||
@@ -67,7 +67,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ReschedulerPolicy) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
func (x *DeschedulerPolicy) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperEncoder(e)
|
||||
_, _, _ = h, z, r
|
||||
@@ -182,7 +182,7 @@ func (x *ReschedulerPolicy) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ReschedulerPolicy) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
func (x *DeschedulerPolicy) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@@ -212,7 +212,7 @@ func (x *ReschedulerPolicy) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ReschedulerPolicy) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
func (x *DeschedulerPolicy) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@@ -272,7 +272,7 @@ func (x *ReschedulerPolicy) codecDecodeSelfFromMap(l int, d *codec1978.Decoder)
|
||||
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
|
||||
}
|
||||
|
||||
func (x *ReschedulerPolicy) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
func (x *DeschedulerPolicy) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@@ -412,7 +412,7 @@ func (x *StrategyList) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ReschedulerStrategy) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
func (x *DeschedulerStrategy) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperEncoder(e)
|
||||
_, _, _ = h, z, r
|
||||
@@ -521,7 +521,7 @@ func (x *ReschedulerStrategy) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ReschedulerStrategy) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
func (x *DeschedulerStrategy) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@@ -551,7 +551,7 @@ func (x *ReschedulerStrategy) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ReschedulerStrategy) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
func (x *DeschedulerStrategy) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@@ -611,7 +611,7 @@ func (x *ReschedulerStrategy) codecDecodeSelfFromMap(l int, d *codec1978.Decoder
|
||||
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
|
||||
}
|
||||
|
||||
func (x *ReschedulerStrategy) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
func (x *DeschedulerStrategy) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@@ -1216,11 +1216,11 @@ func (x codecSelfer1234) decStrategyList(v *StrategyList, d *codec1978.Decoder)
|
||||
yybh1 := z.DecBasicHandle()
|
||||
if yyv1 == nil {
|
||||
yyrl1, _ := z.DecInferLen(yyl1, yybh1.MaxInitLen, 56)
|
||||
yyv1 = make(map[StrategyName]ReschedulerStrategy, yyrl1)
|
||||
yyv1 = make(map[StrategyName]DeschedulerStrategy, yyrl1)
|
||||
*v = yyv1
|
||||
}
|
||||
var yymk1 StrategyName
|
||||
var yymv1 ReschedulerStrategy
|
||||
var yymv1 DeschedulerStrategy
|
||||
var yymg1 bool
|
||||
if yybh1.MapValueReset {
|
||||
yymg1 = true
|
||||
@@ -1238,11 +1238,11 @@ func (x codecSelfer1234) decStrategyList(v *StrategyList, d *codec1978.Decoder)
|
||||
if yymg1 {
|
||||
yymv1 = yyv1[yymk1]
|
||||
} else {
|
||||
yymv1 = ReschedulerStrategy{}
|
||||
yymv1 = DeschedulerStrategy{}
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerMapValue1234)
|
||||
if r.TryDecodeAsNil() {
|
||||
yymv1 = ReschedulerStrategy{}
|
||||
yymv1 = DeschedulerStrategy{}
|
||||
} else {
|
||||
yyv3 := &yymv1
|
||||
yyv3.CodecDecodeSelf(d)
|
||||
@@ -1265,11 +1265,11 @@ func (x codecSelfer1234) decStrategyList(v *StrategyList, d *codec1978.Decoder)
|
||||
if yymg1 {
|
||||
yymv1 = yyv1[yymk1]
|
||||
} else {
|
||||
yymv1 = ReschedulerStrategy{}
|
||||
yymv1 = DeschedulerStrategy{}
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerMapValue1234)
|
||||
if r.TryDecodeAsNil() {
|
||||
yymv1 = ReschedulerStrategy{}
|
||||
yymv1 = DeschedulerStrategy{}
|
||||
} else {
|
||||
yyv5 := &yymv1
|
||||
yyv5.CodecDecodeSelf(d)
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/api/v1"
|
||||
)
|
||||
|
||||
type ReschedulerPolicy struct {
|
||||
type DeschedulerPolicy struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
|
||||
// Strategies
|
||||
@@ -29,9 +29,9 @@ type ReschedulerPolicy struct {
|
||||
}
|
||||
|
||||
type StrategyName string
|
||||
type StrategyList map[StrategyName]ReschedulerStrategy
|
||||
type StrategyList map[StrategyName]DeschedulerStrategy
|
||||
|
||||
type ReschedulerStrategy struct {
|
||||
type DeschedulerStrategy struct {
|
||||
// Enabled or disabled
|
||||
Enabled bool `json:"enabled,omitempty"`
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ limitations under the License.
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
api "github.com/aveshagarwal/rescheduler/pkg/api"
|
||||
api "github.com/kubernetes-incubator/descheduler/pkg/api"
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
unsafe "unsafe"
|
||||
@@ -35,17 +35,65 @@ func init() {
|
||||
// Public to allow building arbitrary schemes.
|
||||
func RegisterConversions(scheme *runtime.Scheme) error {
|
||||
return scheme.AddGeneratedConversionFuncs(
|
||||
Convert_v1alpha1_DeschedulerPolicy_To_api_DeschedulerPolicy,
|
||||
Convert_api_DeschedulerPolicy_To_v1alpha1_DeschedulerPolicy,
|
||||
Convert_v1alpha1_DeschedulerStrategy_To_api_DeschedulerStrategy,
|
||||
Convert_api_DeschedulerStrategy_To_v1alpha1_DeschedulerStrategy,
|
||||
Convert_v1alpha1_NodeResourceUtilizationThresholds_To_api_NodeResourceUtilizationThresholds,
|
||||
Convert_api_NodeResourceUtilizationThresholds_To_v1alpha1_NodeResourceUtilizationThresholds,
|
||||
Convert_v1alpha1_ReschedulerPolicy_To_api_ReschedulerPolicy,
|
||||
Convert_api_ReschedulerPolicy_To_v1alpha1_ReschedulerPolicy,
|
||||
Convert_v1alpha1_ReschedulerStrategy_To_api_ReschedulerStrategy,
|
||||
Convert_api_ReschedulerStrategy_To_v1alpha1_ReschedulerStrategy,
|
||||
Convert_v1alpha1_StrategyParameters_To_api_StrategyParameters,
|
||||
Convert_api_StrategyParameters_To_v1alpha1_StrategyParameters,
|
||||
)
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha1_DeschedulerPolicy_To_api_DeschedulerPolicy(in *DeschedulerPolicy, out *api.DeschedulerPolicy, s conversion.Scope) error {
|
||||
out.Strategies = *(*api.StrategyList)(unsafe.Pointer(&in.Strategies))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1alpha1_DeschedulerPolicy_To_api_DeschedulerPolicy is an autogenerated conversion function.
|
||||
func Convert_v1alpha1_DeschedulerPolicy_To_api_DeschedulerPolicy(in *DeschedulerPolicy, out *api.DeschedulerPolicy, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha1_DeschedulerPolicy_To_api_DeschedulerPolicy(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_api_DeschedulerPolicy_To_v1alpha1_DeschedulerPolicy(in *api.DeschedulerPolicy, out *DeschedulerPolicy, s conversion.Scope) error {
|
||||
out.Strategies = *(*StrategyList)(unsafe.Pointer(&in.Strategies))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_api_DeschedulerPolicy_To_v1alpha1_DeschedulerPolicy is an autogenerated conversion function.
|
||||
func Convert_api_DeschedulerPolicy_To_v1alpha1_DeschedulerPolicy(in *api.DeschedulerPolicy, out *DeschedulerPolicy, s conversion.Scope) error {
|
||||
return autoConvert_api_DeschedulerPolicy_To_v1alpha1_DeschedulerPolicy(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha1_DeschedulerStrategy_To_api_DeschedulerStrategy(in *DeschedulerStrategy, out *api.DeschedulerStrategy, s conversion.Scope) error {
|
||||
out.Enabled = in.Enabled
|
||||
out.Weight = in.Weight
|
||||
if err := Convert_v1alpha1_StrategyParameters_To_api_StrategyParameters(&in.Params, &out.Params, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1alpha1_DeschedulerStrategy_To_api_DeschedulerStrategy is an autogenerated conversion function.
|
||||
func Convert_v1alpha1_DeschedulerStrategy_To_api_DeschedulerStrategy(in *DeschedulerStrategy, out *api.DeschedulerStrategy, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha1_DeschedulerStrategy_To_api_DeschedulerStrategy(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_api_DeschedulerStrategy_To_v1alpha1_DeschedulerStrategy(in *api.DeschedulerStrategy, out *DeschedulerStrategy, s conversion.Scope) error {
|
||||
out.Enabled = in.Enabled
|
||||
out.Weight = in.Weight
|
||||
if err := Convert_api_StrategyParameters_To_v1alpha1_StrategyParameters(&in.Params, &out.Params, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_api_DeschedulerStrategy_To_v1alpha1_DeschedulerStrategy is an autogenerated conversion function.
|
||||
func Convert_api_DeschedulerStrategy_To_v1alpha1_DeschedulerStrategy(in *api.DeschedulerStrategy, out *DeschedulerStrategy, s conversion.Scope) error {
|
||||
return autoConvert_api_DeschedulerStrategy_To_v1alpha1_DeschedulerStrategy(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha1_NodeResourceUtilizationThresholds_To_api_NodeResourceUtilizationThresholds(in *NodeResourceUtilizationThresholds, out *api.NodeResourceUtilizationThresholds, s conversion.Scope) error {
|
||||
out.Thresholds = *(*api.ResourceThresholds)(unsafe.Pointer(&in.Thresholds))
|
||||
out.TargetThresholds = *(*api.ResourceThresholds)(unsafe.Pointer(&in.TargetThresholds))
|
||||
@@ -70,54 +118,6 @@ func Convert_api_NodeResourceUtilizationThresholds_To_v1alpha1_NodeResourceUtili
|
||||
return autoConvert_api_NodeResourceUtilizationThresholds_To_v1alpha1_NodeResourceUtilizationThresholds(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha1_ReschedulerPolicy_To_api_ReschedulerPolicy(in *ReschedulerPolicy, out *api.ReschedulerPolicy, s conversion.Scope) error {
|
||||
out.Strategies = *(*api.StrategyList)(unsafe.Pointer(&in.Strategies))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1alpha1_ReschedulerPolicy_To_api_ReschedulerPolicy is an autogenerated conversion function.
|
||||
func Convert_v1alpha1_ReschedulerPolicy_To_api_ReschedulerPolicy(in *ReschedulerPolicy, out *api.ReschedulerPolicy, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha1_ReschedulerPolicy_To_api_ReschedulerPolicy(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_api_ReschedulerPolicy_To_v1alpha1_ReschedulerPolicy(in *api.ReschedulerPolicy, out *ReschedulerPolicy, s conversion.Scope) error {
|
||||
out.Strategies = *(*StrategyList)(unsafe.Pointer(&in.Strategies))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_api_ReschedulerPolicy_To_v1alpha1_ReschedulerPolicy is an autogenerated conversion function.
|
||||
func Convert_api_ReschedulerPolicy_To_v1alpha1_ReschedulerPolicy(in *api.ReschedulerPolicy, out *ReschedulerPolicy, s conversion.Scope) error {
|
||||
return autoConvert_api_ReschedulerPolicy_To_v1alpha1_ReschedulerPolicy(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha1_ReschedulerStrategy_To_api_ReschedulerStrategy(in *ReschedulerStrategy, out *api.ReschedulerStrategy, s conversion.Scope) error {
|
||||
out.Enabled = in.Enabled
|
||||
out.Weight = in.Weight
|
||||
if err := Convert_v1alpha1_StrategyParameters_To_api_StrategyParameters(&in.Params, &out.Params, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1alpha1_ReschedulerStrategy_To_api_ReschedulerStrategy is an autogenerated conversion function.
|
||||
func Convert_v1alpha1_ReschedulerStrategy_To_api_ReschedulerStrategy(in *ReschedulerStrategy, out *api.ReschedulerStrategy, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha1_ReschedulerStrategy_To_api_ReschedulerStrategy(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_api_ReschedulerStrategy_To_v1alpha1_ReschedulerStrategy(in *api.ReschedulerStrategy, out *ReschedulerStrategy, s conversion.Scope) error {
|
||||
out.Enabled = in.Enabled
|
||||
out.Weight = in.Weight
|
||||
if err := Convert_api_StrategyParameters_To_v1alpha1_StrategyParameters(&in.Params, &out.Params, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_api_ReschedulerStrategy_To_v1alpha1_ReschedulerStrategy is an autogenerated conversion function.
|
||||
func Convert_api_ReschedulerStrategy_To_v1alpha1_ReschedulerStrategy(in *api.ReschedulerStrategy, out *ReschedulerStrategy, s conversion.Scope) error {
|
||||
return autoConvert_api_ReschedulerStrategy_To_v1alpha1_ReschedulerStrategy(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha1_StrategyParameters_To_api_StrategyParameters(in *StrategyParameters, out *api.StrategyParameters, s conversion.Scope) error {
|
||||
if err := Convert_v1alpha1_NodeResourceUtilizationThresholds_To_api_NodeResourceUtilizationThresholds(&in.NodeResourceUtilizationThresholds, &out.NodeResourceUtilizationThresholds, s); err != nil {
|
||||
return err
|
||||
|
||||
@@ -34,13 +34,47 @@ func init() {
|
||||
// to allow building arbitrary schemes.
|
||||
func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
||||
return scheme.AddGeneratedDeepCopyFuncs(
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_DeschedulerPolicy, InType: reflect.TypeOf(&DeschedulerPolicy{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_DeschedulerStrategy, InType: reflect.TypeOf(&DeschedulerStrategy{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_NodeResourceUtilizationThresholds, InType: reflect.TypeOf(&NodeResourceUtilizationThresholds{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_ReschedulerPolicy, InType: reflect.TypeOf(&ReschedulerPolicy{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_ReschedulerStrategy, InType: reflect.TypeOf(&ReschedulerStrategy{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_StrategyParameters, InType: reflect.TypeOf(&StrategyParameters{})},
|
||||
)
|
||||
}
|
||||
|
||||
// DeepCopy_v1alpha1_DeschedulerPolicy is an autogenerated deepcopy function.
|
||||
func DeepCopy_v1alpha1_DeschedulerPolicy(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*DeschedulerPolicy)
|
||||
out := out.(*DeschedulerPolicy)
|
||||
*out = *in
|
||||
if in.Strategies != nil {
|
||||
in, out := &in.Strategies, &out.Strategies
|
||||
*out = make(StrategyList)
|
||||
for key, val := range *in {
|
||||
newVal := new(DeschedulerStrategy)
|
||||
if err := DeepCopy_v1alpha1_DeschedulerStrategy(&val, newVal, c); err != nil {
|
||||
return err
|
||||
}
|
||||
(*out)[key] = *newVal
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy_v1alpha1_DeschedulerStrategy is an autogenerated deepcopy function.
|
||||
func DeepCopy_v1alpha1_DeschedulerStrategy(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*DeschedulerStrategy)
|
||||
out := out.(*DeschedulerStrategy)
|
||||
*out = *in
|
||||
if err := DeepCopy_v1alpha1_StrategyParameters(&in.Params, &out.Params, c); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy_v1alpha1_NodeResourceUtilizationThresholds is an autogenerated deepcopy function.
|
||||
func DeepCopy_v1alpha1_NodeResourceUtilizationThresholds(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
@@ -65,40 +99,6 @@ func DeepCopy_v1alpha1_NodeResourceUtilizationThresholds(in interface{}, out int
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy_v1alpha1_ReschedulerPolicy is an autogenerated deepcopy function.
|
||||
func DeepCopy_v1alpha1_ReschedulerPolicy(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*ReschedulerPolicy)
|
||||
out := out.(*ReschedulerPolicy)
|
||||
*out = *in
|
||||
if in.Strategies != nil {
|
||||
in, out := &in.Strategies, &out.Strategies
|
||||
*out = make(StrategyList)
|
||||
for key, val := range *in {
|
||||
newVal := new(ReschedulerStrategy)
|
||||
if err := DeepCopy_v1alpha1_ReschedulerStrategy(&val, newVal, c); err != nil {
|
||||
return err
|
||||
}
|
||||
(*out)[key] = *newVal
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy_v1alpha1_ReschedulerStrategy is an autogenerated deepcopy function.
|
||||
func DeepCopy_v1alpha1_ReschedulerStrategy(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*ReschedulerStrategy)
|
||||
out := out.(*ReschedulerStrategy)
|
||||
*out = *in
|
||||
if err := DeepCopy_v1alpha1_StrategyParameters(&in.Params, &out.Params, c); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy_v1alpha1_StrategyParameters is an autogenerated deepcopy function.
|
||||
func DeepCopy_v1alpha1_StrategyParameters(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
|
||||
@@ -34,13 +34,47 @@ func init() {
|
||||
// to allow building arbitrary schemes.
|
||||
func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
||||
return scheme.AddGeneratedDeepCopyFuncs(
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_DeschedulerPolicy, InType: reflect.TypeOf(&DeschedulerPolicy{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_DeschedulerStrategy, InType: reflect.TypeOf(&DeschedulerStrategy{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_NodeResourceUtilizationThresholds, InType: reflect.TypeOf(&NodeResourceUtilizationThresholds{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_ReschedulerPolicy, InType: reflect.TypeOf(&ReschedulerPolicy{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_ReschedulerStrategy, InType: reflect.TypeOf(&ReschedulerStrategy{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_StrategyParameters, InType: reflect.TypeOf(&StrategyParameters{})},
|
||||
)
|
||||
}
|
||||
|
||||
// DeepCopy_api_DeschedulerPolicy is an autogenerated deepcopy function.
|
||||
func DeepCopy_api_DeschedulerPolicy(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*DeschedulerPolicy)
|
||||
out := out.(*DeschedulerPolicy)
|
||||
*out = *in
|
||||
if in.Strategies != nil {
|
||||
in, out := &in.Strategies, &out.Strategies
|
||||
*out = make(StrategyList)
|
||||
for key, val := range *in {
|
||||
newVal := new(DeschedulerStrategy)
|
||||
if err := DeepCopy_api_DeschedulerStrategy(&val, newVal, c); err != nil {
|
||||
return err
|
||||
}
|
||||
(*out)[key] = *newVal
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy_api_DeschedulerStrategy is an autogenerated deepcopy function.
|
||||
func DeepCopy_api_DeschedulerStrategy(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*DeschedulerStrategy)
|
||||
out := out.(*DeschedulerStrategy)
|
||||
*out = *in
|
||||
if err := DeepCopy_api_StrategyParameters(&in.Params, &out.Params, c); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy_api_NodeResourceUtilizationThresholds is an autogenerated deepcopy function.
|
||||
func DeepCopy_api_NodeResourceUtilizationThresholds(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
@@ -65,40 +99,6 @@ func DeepCopy_api_NodeResourceUtilizationThresholds(in interface{}, out interfac
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy_api_ReschedulerPolicy is an autogenerated deepcopy function.
|
||||
func DeepCopy_api_ReschedulerPolicy(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*ReschedulerPolicy)
|
||||
out := out.(*ReschedulerPolicy)
|
||||
*out = *in
|
||||
if in.Strategies != nil {
|
||||
in, out := &in.Strategies, &out.Strategies
|
||||
*out = make(StrategyList)
|
||||
for key, val := range *in {
|
||||
newVal := new(ReschedulerStrategy)
|
||||
if err := DeepCopy_api_ReschedulerStrategy(&val, newVal, c); err != nil {
|
||||
return err
|
||||
}
|
||||
(*out)[key] = *newVal
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy_api_ReschedulerStrategy is an autogenerated deepcopy function.
|
||||
func DeepCopy_api_ReschedulerStrategy(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*ReschedulerStrategy)
|
||||
out := out.(*ReschedulerStrategy)
|
||||
*out = *in
|
||||
if err := DeepCopy_api_StrategyParameters(&in.Params, &out.Params, c); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy_api_StrategyParameters is an autogenerated deepcopy function.
|
||||
func DeepCopy_api_StrategyParameters(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
|
||||
@@ -16,4 +16,4 @@ limitations under the License.
|
||||
|
||||
// +k8s:deepcopy-gen=package,register
|
||||
|
||||
package componentconfig // import "github.com/aveshagarwal/rescheduler/pkg/apis/componentconfig"
|
||||
package componentconfig // import "github.com/kubernetes-incubator/descheduler/pkg/apis/componentconfig"
|
||||
|
||||
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package install installs the rescheduler's componentconfig API group.
|
||||
// Package install installs the descheduler's componentconfig API group.
|
||||
package install
|
||||
|
||||
import (
|
||||
@@ -22,13 +22,13 @@ import (
|
||||
"k8s.io/apimachinery/pkg/apimachinery/registered"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
"github.com/aveshagarwal/rescheduler/pkg/apis/componentconfig"
|
||||
"github.com/aveshagarwal/rescheduler/pkg/apis/componentconfig/v1alpha1"
|
||||
reschedulerscheme "github.com/aveshagarwal/rescheduler/pkg/rescheduler/scheme"
|
||||
"github.com/kubernetes-incubator/descheduler/pkg/apis/componentconfig"
|
||||
"github.com/kubernetes-incubator/descheduler/pkg/apis/componentconfig/v1alpha1"
|
||||
deschedulerscheme "github.com/kubernetes-incubator/descheduler/pkg/descheduler/scheme"
|
||||
)
|
||||
|
||||
func init() {
|
||||
Install(reschedulerscheme.GroupFactoryRegistry, reschedulerscheme.Registry, reschedulerscheme.Scheme)
|
||||
Install(deschedulerscheme.GroupFactoryRegistry, deschedulerscheme.Registry, deschedulerscheme.Scheme)
|
||||
}
|
||||
|
||||
// Install registers the API group and adds types to a scheme
|
||||
@@ -37,7 +37,7 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
|
||||
&announced.GroupMetaFactoryArgs{
|
||||
GroupName: componentconfig.GroupName,
|
||||
VersionPreferenceOrder: []string{v1alpha1.SchemeGroupVersion.Version},
|
||||
ImportPrefix: "github.com/aveshagarwal/rescheduler/pkg/apis/componentconfig",
|
||||
ImportPrefix: "github.com/kubernetes-incubator/descheduler/pkg/apis/componentconfig",
|
||||
AddInternalObjectsToScheme: componentconfig.AddToScheme,
|
||||
},
|
||||
announced.VersionToSchemeFunc{
|
||||
|
||||
@@ -27,7 +27,7 @@ var (
|
||||
)
|
||||
|
||||
// GroupName is the group name used in this package
|
||||
const GroupName = "reschedulercomponentconfig"
|
||||
const GroupName = "deschedulercomponentconfig"
|
||||
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}
|
||||
@@ -44,7 +44,7 @@ func Resource(resource string) schema.GroupResource {
|
||||
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&ReschedulerConfiguration{},
|
||||
&DeschedulerConfiguration{},
|
||||
)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ReschedulerConfiguration) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
func (x *DeschedulerConfiguration) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperEncoder(e)
|
||||
_, _, _ = h, z, r
|
||||
@@ -154,20 +154,20 @@ func (x *ReschedulerConfiguration) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
yym10 := z.EncBinary()
|
||||
_ = yym10
|
||||
if false {
|
||||
} else if z.HasExtensions() && z.EncExt(x.ReschedulingInterval) {
|
||||
} else if z.HasExtensions() && z.EncExt(x.DeschedulingInterval) {
|
||||
} else {
|
||||
r.EncodeInt(int64(x.ReschedulingInterval))
|
||||
r.EncodeInt(int64(x.DeschedulingInterval))
|
||||
}
|
||||
} else {
|
||||
z.EncSendContainerState(codecSelfer_containerMapKey1234)
|
||||
r.EncodeString(codecSelferC_UTF81234, string("ReschedulingInterval"))
|
||||
r.EncodeString(codecSelferC_UTF81234, string("DeschedulingInterval"))
|
||||
z.EncSendContainerState(codecSelfer_containerMapValue1234)
|
||||
yym11 := z.EncBinary()
|
||||
_ = yym11
|
||||
if false {
|
||||
} else if z.HasExtensions() && z.EncExt(x.ReschedulingInterval) {
|
||||
} else if z.HasExtensions() && z.EncExt(x.DeschedulingInterval) {
|
||||
} else {
|
||||
r.EncodeInt(int64(x.ReschedulingInterval))
|
||||
r.EncodeInt(int64(x.DeschedulingInterval))
|
||||
}
|
||||
}
|
||||
if yyr2 || yy2arr2 {
|
||||
@@ -217,7 +217,7 @@ func (x *ReschedulerConfiguration) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ReschedulerConfiguration) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
func (x *DeschedulerConfiguration) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@@ -247,7 +247,7 @@ func (x *ReschedulerConfiguration) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ReschedulerConfiguration) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
func (x *DeschedulerConfiguration) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@@ -293,11 +293,11 @@ func (x *ReschedulerConfiguration) codecDecodeSelfFromMap(l int, d *codec1978.De
|
||||
*((*string)(yyv6)) = r.DecodeString()
|
||||
}
|
||||
}
|
||||
case "ReschedulingInterval":
|
||||
case "DeschedulingInterval":
|
||||
if r.TryDecodeAsNil() {
|
||||
x.ReschedulingInterval = 0
|
||||
x.DeschedulingInterval = 0
|
||||
} else {
|
||||
yyv8 := &x.ReschedulingInterval
|
||||
yyv8 := &x.DeschedulingInterval
|
||||
yym9 := z.DecBinary()
|
||||
_ = yym9
|
||||
if false {
|
||||
@@ -337,7 +337,7 @@ func (x *ReschedulerConfiguration) codecDecodeSelfFromMap(l int, d *codec1978.De
|
||||
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
|
||||
}
|
||||
|
||||
func (x *ReschedulerConfiguration) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
func (x *DeschedulerConfiguration) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@@ -400,9 +400,9 @@ func (x *ReschedulerConfiguration) codecDecodeSelfFromArray(l int, d *codec1978.
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if r.TryDecodeAsNil() {
|
||||
x.ReschedulingInterval = 0
|
||||
x.DeschedulingInterval = 0
|
||||
} else {
|
||||
yyv19 := &x.ReschedulingInterval
|
||||
yyv19 := &x.DeschedulingInterval
|
||||
yym20 := z.DecBinary()
|
||||
_ = yym20
|
||||
if false {
|
||||
|
||||
@@ -22,16 +22,16 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
type ReschedulerConfiguration struct {
|
||||
type DeschedulerConfiguration struct {
|
||||
metav1.TypeMeta
|
||||
|
||||
// Time interval for rescheduler to run
|
||||
ReschedulingInterval time.Duration
|
||||
// Time interval for descheduler to run
|
||||
DeschedulingInterval time.Duration
|
||||
|
||||
// KubeconfigFile is path to kubeconfig file with authorization and master
|
||||
// location information.
|
||||
KubeconfigFile string
|
||||
|
||||
// PolicyConfigFile is the filepath to the rescheduler policy configuration.
|
||||
// PolicyConfigFile is the filepath to the descheduler policy configuration.
|
||||
PolicyConfigFile string
|
||||
}
|
||||
|
||||
@@ -15,10 +15,10 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
// +k8s:deepcopy-gen=package,register
|
||||
// +k8s:conversion-gen=github.com/aveshagarwal/rescheduler/pkg/apis/componentconfig
|
||||
// +k8s:conversion-gen=github.com/kubernetes-incubator/descheduler/pkg/apis/componentconfig
|
||||
// +k8s:defaulter-gen=TypeMeta
|
||||
|
||||
// Package v1alpha1 is the v1alpha1 version of the rescheduler's componentconfig API
|
||||
// +groupName=reschedulercomponentconfig
|
||||
// Package v1alpha1 is the v1alpha1 version of the descheduler's componentconfig API
|
||||
// +groupName=deschedulercomponentconfig
|
||||
|
||||
package v1alpha1 // import "github.com/aveshagarwal/rescheduler/pkg/apis/componentconfig/v1alpha1"
|
||||
package v1alpha1 // import "github.com/kubernetes-incubator/descheduler/pkg/apis/componentconfig/v1alpha1"
|
||||
|
||||
@@ -28,7 +28,7 @@ var (
|
||||
)
|
||||
|
||||
// GroupName is the group name use in this package
|
||||
const GroupName = "reschedulercomponentconfig"
|
||||
const GroupName = "deschedulercomponentconfig"
|
||||
const GroupVersion = "v1alpha1"
|
||||
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
@@ -54,7 +54,7 @@ func init() {
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
// TODO this will get cleaned up with the scheme types are fixed
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&ReschedulerConfiguration{},
|
||||
&DeschedulerConfiguration{},
|
||||
)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ReschedulerConfiguration) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
func (x *DeschedulerConfiguration) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperEncoder(e)
|
||||
_, _, _ = h, z, r
|
||||
@@ -86,7 +86,7 @@ func (x *ReschedulerConfiguration) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
const yyr2 bool = false
|
||||
yyq2[0] = x.Kind != ""
|
||||
yyq2[1] = x.APIVersion != ""
|
||||
yyq2[2] = x.ReschedulingInterval != 0
|
||||
yyq2[2] = x.DeschedulingInterval != 0
|
||||
yyq2[4] = x.PolicyConfigFile != ""
|
||||
var yynn2 int
|
||||
if yyr2 || yy2arr2 {
|
||||
@@ -157,9 +157,9 @@ func (x *ReschedulerConfiguration) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
yym10 := z.EncBinary()
|
||||
_ = yym10
|
||||
if false {
|
||||
} else if z.HasExtensions() && z.EncExt(x.ReschedulingInterval) {
|
||||
} else if z.HasExtensions() && z.EncExt(x.DeschedulingInterval) {
|
||||
} else {
|
||||
r.EncodeInt(int64(x.ReschedulingInterval))
|
||||
r.EncodeInt(int64(x.DeschedulingInterval))
|
||||
}
|
||||
} else {
|
||||
r.EncodeInt(0)
|
||||
@@ -167,14 +167,14 @@ func (x *ReschedulerConfiguration) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
} else {
|
||||
if yyq2[2] {
|
||||
z.EncSendContainerState(codecSelfer_containerMapKey1234)
|
||||
r.EncodeString(codecSelferC_UTF81234, string("reschedulingInterval"))
|
||||
r.EncodeString(codecSelferC_UTF81234, string("deschedulingInterval"))
|
||||
z.EncSendContainerState(codecSelfer_containerMapValue1234)
|
||||
yym11 := z.EncBinary()
|
||||
_ = yym11
|
||||
if false {
|
||||
} else if z.HasExtensions() && z.EncExt(x.ReschedulingInterval) {
|
||||
} else if z.HasExtensions() && z.EncExt(x.DeschedulingInterval) {
|
||||
} else {
|
||||
r.EncodeInt(int64(x.ReschedulingInterval))
|
||||
r.EncodeInt(int64(x.DeschedulingInterval))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -231,7 +231,7 @@ func (x *ReschedulerConfiguration) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ReschedulerConfiguration) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
func (x *DeschedulerConfiguration) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@@ -261,7 +261,7 @@ func (x *ReschedulerConfiguration) CodecDecodeSelf(d *codec1978.Decoder) {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ReschedulerConfiguration) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
func (x *DeschedulerConfiguration) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@@ -307,11 +307,11 @@ func (x *ReschedulerConfiguration) codecDecodeSelfFromMap(l int, d *codec1978.De
|
||||
*((*string)(yyv6)) = r.DecodeString()
|
||||
}
|
||||
}
|
||||
case "reschedulingInterval":
|
||||
case "deschedulingInterval":
|
||||
if r.TryDecodeAsNil() {
|
||||
x.ReschedulingInterval = 0
|
||||
x.DeschedulingInterval = 0
|
||||
} else {
|
||||
yyv8 := &x.ReschedulingInterval
|
||||
yyv8 := &x.DeschedulingInterval
|
||||
yym9 := z.DecBinary()
|
||||
_ = yym9
|
||||
if false {
|
||||
@@ -351,7 +351,7 @@ func (x *ReschedulerConfiguration) codecDecodeSelfFromMap(l int, d *codec1978.De
|
||||
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
|
||||
}
|
||||
|
||||
func (x *ReschedulerConfiguration) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
func (x *DeschedulerConfiguration) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
@@ -414,9 +414,9 @@ func (x *ReschedulerConfiguration) codecDecodeSelfFromArray(l int, d *codec1978.
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if r.TryDecodeAsNil() {
|
||||
x.ReschedulingInterval = 0
|
||||
x.DeschedulingInterval = 0
|
||||
} else {
|
||||
yyv19 := &x.ReschedulingInterval
|
||||
yyv19 := &x.DeschedulingInterval
|
||||
yym20 := z.DecBinary()
|
||||
_ = yym20
|
||||
if false {
|
||||
|
||||
@@ -22,16 +22,16 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
type ReschedulerConfiguration struct {
|
||||
type DeschedulerConfiguration struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
|
||||
// Time interval for rescheduler to run
|
||||
ReschedulingInterval time.Duration `json:"reschedulingInterval,omitempty"`
|
||||
// Time interval for descheduler to run
|
||||
DeschedulingInterval time.Duration `json:"deschedulingInterval,omitempty"`
|
||||
|
||||
// KubeconfigFile is path to kubeconfig file with authorization and master
|
||||
// location information.
|
||||
KubeconfigFile string `json:"kubeconfigFile"`
|
||||
|
||||
// PolicyConfigFile is the filepath to the rescheduler policy configuration.
|
||||
// PolicyConfigFile is the filepath to the descheduler policy configuration.
|
||||
PolicyConfigFile string `json:"policyConfigFile,,omitempty"`
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ limitations under the License.
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
componentconfig "github.com/aveshagarwal/rescheduler/pkg/apis/componentconfig"
|
||||
componentconfig "github.com/kubernetes-incubator/descheduler/pkg/apis/componentconfig"
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
time "time"
|
||||
@@ -35,31 +35,31 @@ func init() {
|
||||
// Public to allow building arbitrary schemes.
|
||||
func RegisterConversions(scheme *runtime.Scheme) error {
|
||||
return scheme.AddGeneratedConversionFuncs(
|
||||
Convert_v1alpha1_ReschedulerConfiguration_To_componentconfig_ReschedulerConfiguration,
|
||||
Convert_componentconfig_ReschedulerConfiguration_To_v1alpha1_ReschedulerConfiguration,
|
||||
Convert_v1alpha1_DeschedulerConfiguration_To_componentconfig_DeschedulerConfiguration,
|
||||
Convert_componentconfig_DeschedulerConfiguration_To_v1alpha1_DeschedulerConfiguration,
|
||||
)
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha1_ReschedulerConfiguration_To_componentconfig_ReschedulerConfiguration(in *ReschedulerConfiguration, out *componentconfig.ReschedulerConfiguration, s conversion.Scope) error {
|
||||
out.ReschedulingInterval = time.Duration(in.ReschedulingInterval)
|
||||
func autoConvert_v1alpha1_DeschedulerConfiguration_To_componentconfig_DeschedulerConfiguration(in *DeschedulerConfiguration, out *componentconfig.DeschedulerConfiguration, s conversion.Scope) error {
|
||||
out.DeschedulingInterval = time.Duration(in.DeschedulingInterval)
|
||||
out.KubeconfigFile = in.KubeconfigFile
|
||||
out.PolicyConfigFile = in.PolicyConfigFile
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1alpha1_ReschedulerConfiguration_To_componentconfig_ReschedulerConfiguration is an autogenerated conversion function.
|
||||
func Convert_v1alpha1_ReschedulerConfiguration_To_componentconfig_ReschedulerConfiguration(in *ReschedulerConfiguration, out *componentconfig.ReschedulerConfiguration, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha1_ReschedulerConfiguration_To_componentconfig_ReschedulerConfiguration(in, out, s)
|
||||
// Convert_v1alpha1_DeschedulerConfiguration_To_componentconfig_DeschedulerConfiguration is an autogenerated conversion function.
|
||||
func Convert_v1alpha1_DeschedulerConfiguration_To_componentconfig_DeschedulerConfiguration(in *DeschedulerConfiguration, out *componentconfig.DeschedulerConfiguration, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha1_DeschedulerConfiguration_To_componentconfig_DeschedulerConfiguration(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_componentconfig_ReschedulerConfiguration_To_v1alpha1_ReschedulerConfiguration(in *componentconfig.ReschedulerConfiguration, out *ReschedulerConfiguration, s conversion.Scope) error {
|
||||
out.ReschedulingInterval = time.Duration(in.ReschedulingInterval)
|
||||
func autoConvert_componentconfig_DeschedulerConfiguration_To_v1alpha1_DeschedulerConfiguration(in *componentconfig.DeschedulerConfiguration, out *DeschedulerConfiguration, s conversion.Scope) error {
|
||||
out.DeschedulingInterval = time.Duration(in.DeschedulingInterval)
|
||||
out.KubeconfigFile = in.KubeconfigFile
|
||||
out.PolicyConfigFile = in.PolicyConfigFile
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_componentconfig_ReschedulerConfiguration_To_v1alpha1_ReschedulerConfiguration is an autogenerated conversion function.
|
||||
func Convert_componentconfig_ReschedulerConfiguration_To_v1alpha1_ReschedulerConfiguration(in *componentconfig.ReschedulerConfiguration, out *ReschedulerConfiguration, s conversion.Scope) error {
|
||||
return autoConvert_componentconfig_ReschedulerConfiguration_To_v1alpha1_ReschedulerConfiguration(in, out, s)
|
||||
// Convert_componentconfig_DeschedulerConfiguration_To_v1alpha1_DeschedulerConfiguration is an autogenerated conversion function.
|
||||
func Convert_componentconfig_DeschedulerConfiguration_To_v1alpha1_DeschedulerConfiguration(in *componentconfig.DeschedulerConfiguration, out *DeschedulerConfiguration, s conversion.Scope) error {
|
||||
return autoConvert_componentconfig_DeschedulerConfiguration_To_v1alpha1_DeschedulerConfiguration(in, out, s)
|
||||
}
|
||||
|
||||
@@ -34,15 +34,15 @@ func init() {
|
||||
// to allow building arbitrary schemes.
|
||||
func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
||||
return scheme.AddGeneratedDeepCopyFuncs(
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_ReschedulerConfiguration, InType: reflect.TypeOf(&ReschedulerConfiguration{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1alpha1_DeschedulerConfiguration, InType: reflect.TypeOf(&DeschedulerConfiguration{})},
|
||||
)
|
||||
}
|
||||
|
||||
// DeepCopy_v1alpha1_ReschedulerConfiguration is an autogenerated deepcopy function.
|
||||
func DeepCopy_v1alpha1_ReschedulerConfiguration(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
// DeepCopy_v1alpha1_DeschedulerConfiguration is an autogenerated deepcopy function.
|
||||
func DeepCopy_v1alpha1_DeschedulerConfiguration(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*ReschedulerConfiguration)
|
||||
out := out.(*ReschedulerConfiguration)
|
||||
in := in.(*DeschedulerConfiguration)
|
||||
out := out.(*DeschedulerConfiguration)
|
||||
*out = *in
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -34,15 +34,15 @@ func init() {
|
||||
// to allow building arbitrary schemes.
|
||||
func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
||||
return scheme.AddGeneratedDeepCopyFuncs(
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_componentconfig_ReschedulerConfiguration, InType: reflect.TypeOf(&ReschedulerConfiguration{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_componentconfig_DeschedulerConfiguration, InType: reflect.TypeOf(&DeschedulerConfiguration{})},
|
||||
)
|
||||
}
|
||||
|
||||
// DeepCopy_componentconfig_ReschedulerConfiguration is an autogenerated deepcopy function.
|
||||
func DeepCopy_componentconfig_ReschedulerConfiguration(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
// DeepCopy_componentconfig_DeschedulerConfiguration is an autogenerated deepcopy function.
|
||||
func DeepCopy_componentconfig_DeschedulerConfiguration(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*ReschedulerConfiguration)
|
||||
out := out.(*ReschedulerConfiguration)
|
||||
in := in.(*DeschedulerConfiguration)
|
||||
out := out.(*DeschedulerConfiguration)
|
||||
*out = *in
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -14,19 +14,19 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package rescheduler
|
||||
package descheduler
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/aveshagarwal/rescheduler/cmd/rescheduler/app/options"
|
||||
"github.com/aveshagarwal/rescheduler/pkg/rescheduler/client"
|
||||
eutils "github.com/aveshagarwal/rescheduler/pkg/rescheduler/evictions/utils"
|
||||
nodeutil "github.com/aveshagarwal/rescheduler/pkg/rescheduler/node"
|
||||
"github.com/aveshagarwal/rescheduler/pkg/rescheduler/strategies"
|
||||
"github.com/kubernetes-incubator/descheduler/cmd/descheduler/app/options"
|
||||
"github.com/kubernetes-incubator/descheduler/pkg/descheduler/client"
|
||||
eutils "github.com/kubernetes-incubator/descheduler/pkg/descheduler/evictions/utils"
|
||||
nodeutil "github.com/kubernetes-incubator/descheduler/pkg/descheduler/node"
|
||||
"github.com/kubernetes-incubator/descheduler/pkg/descheduler/strategies"
|
||||
)
|
||||
|
||||
func Run(rs *options.ReschedulerServer) error {
|
||||
func Run(rs *options.DeschedulerServer) error {
|
||||
|
||||
rsclient, err := client.CreateClient(rs.KubeconfigFile)
|
||||
if err != nil {
|
||||
@@ -34,12 +34,12 @@ func Run(rs *options.ReschedulerServer) error {
|
||||
}
|
||||
rs.Client = rsclient
|
||||
|
||||
reschedulerPolicy, err := LoadPolicyConfig(rs.PolicyConfigFile)
|
||||
deschedulerPolicy, err := LoadPolicyConfig(rs.PolicyConfigFile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if reschedulerPolicy == nil {
|
||||
return fmt.Errorf("\nreschedulerPolicy is nil\n")
|
||||
if deschedulerPolicy == nil {
|
||||
return fmt.Errorf("\ndeschedulerPolicy is nil\n")
|
||||
|
||||
}
|
||||
evictionPolicyGroupVersion, err := eutils.SupportEviction(rs.Client)
|
||||
@@ -53,8 +53,8 @@ func Run(rs *options.ReschedulerServer) error {
|
||||
return err
|
||||
}
|
||||
|
||||
strategies.RemoveDuplicatePods(rs.Client, reschedulerPolicy.Strategies["RemoveDuplicates"], evictionPolicyGroupVersion, nodes)
|
||||
strategies.LowNodeUtilization(rs.Client, reschedulerPolicy.Strategies["LowNodeUtilization"], evictionPolicyGroupVersion, nodes)
|
||||
strategies.RemoveDuplicatePods(rs.Client, deschedulerPolicy.Strategies["RemoveDuplicates"], evictionPolicyGroupVersion, nodes)
|
||||
strategies.LowNodeUtilization(rs.Client, deschedulerPolicy.Strategies["LowNodeUtilization"], evictionPolicyGroupVersion, nodes)
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -25,7 +25,7 @@ import (
|
||||
policy "k8s.io/kubernetes/pkg/apis/policy/v1beta1"
|
||||
"k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
|
||||
|
||||
eutils "github.com/aveshagarwal/rescheduler/pkg/rescheduler/evictions/utils"
|
||||
eutils "github.com/kubernetes-incubator/descheduler/pkg/descheduler/evictions/utils"
|
||||
)
|
||||
|
||||
func EvictPod(client clientset.Interface, pod *v1.Pod, policyGroupVersion string) (bool, error) {
|
||||
@@ -17,7 +17,7 @@ limitations under the License.
|
||||
package evictions
|
||||
|
||||
import (
|
||||
"github.com/aveshagarwal/rescheduler/test"
|
||||
"github.com/kubernetes-incubator/descheduler/test"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
core "k8s.io/client-go/testing"
|
||||
"k8s.io/kubernetes/pkg/api/v1"
|
||||
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package rescheduler
|
||||
package descheduler
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@@ -22,13 +22,13 @@ import (
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
"github.com/aveshagarwal/rescheduler/pkg/api"
|
||||
_ "github.com/aveshagarwal/rescheduler/pkg/api/install"
|
||||
"github.com/aveshagarwal/rescheduler/pkg/api/v1alpha1"
|
||||
"github.com/aveshagarwal/rescheduler/pkg/rescheduler/scheme"
|
||||
"github.com/kubernetes-incubator/descheduler/pkg/api"
|
||||
_ "github.com/kubernetes-incubator/descheduler/pkg/api/install"
|
||||
"github.com/kubernetes-incubator/descheduler/pkg/api/v1alpha1"
|
||||
"github.com/kubernetes-incubator/descheduler/pkg/descheduler/scheme"
|
||||
)
|
||||
|
||||
func LoadPolicyConfig(policyConfigFile string) (*api.ReschedulerPolicy, error) {
|
||||
func LoadPolicyConfig(policyConfigFile string) (*api.DeschedulerPolicy, error) {
|
||||
if policyConfigFile == "" {
|
||||
fmt.Printf("policy config file not specified")
|
||||
return nil, nil
|
||||
@@ -39,14 +39,14 @@ func LoadPolicyConfig(policyConfigFile string) (*api.ReschedulerPolicy, error) {
|
||||
return nil, fmt.Errorf("failed to read policy config file %q: %+v", policyConfigFile, err)
|
||||
}
|
||||
|
||||
versionedPolicy := &v1alpha1.ReschedulerPolicy{}
|
||||
versionedPolicy := &v1alpha1.DeschedulerPolicy{}
|
||||
|
||||
decoder := scheme.Codecs.UniversalDecoder(v1alpha1.SchemeGroupVersion)
|
||||
if err := runtime.DecodeInto(decoder, policy, versionedPolicy); err != nil {
|
||||
return nil, fmt.Errorf("failed decoding rescheduler's policy config %q: %v", policyConfigFile, err)
|
||||
return nil, fmt.Errorf("failed decoding descheduler's policy config %q: %v", policyConfigFile, err)
|
||||
}
|
||||
|
||||
internalPolicy := &api.ReschedulerPolicy{}
|
||||
internalPolicy := &api.DeschedulerPolicy{}
|
||||
if err := scheme.Scheme.Convert(versionedPolicy, internalPolicy, nil); err != nil {
|
||||
return nil, fmt.Errorf("failed converting versioned policy to internal policy version: %v", err)
|
||||
}
|
||||
@@ -27,7 +27,7 @@ import (
|
||||
|
||||
var (
|
||||
GroupFactoryRegistry = make(announced.APIGroupFactoryRegistry)
|
||||
Registry = registered.NewOrDie(os.Getenv("RESCHEDULER_API_VERSIONS"))
|
||||
Registry = registered.NewOrDie(os.Getenv("DESCHEDULER_API_VERSIONS"))
|
||||
Scheme = runtime.NewScheme()
|
||||
Codecs = serializer.NewCodecFactory(Scheme)
|
||||
)
|
||||
@@ -24,9 +24,9 @@ import (
|
||||
//TODO: Change to client-go instead of generated clientset.
|
||||
"k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
|
||||
|
||||
"github.com/aveshagarwal/rescheduler/pkg/api"
|
||||
"github.com/aveshagarwal/rescheduler/pkg/rescheduler/evictions"
|
||||
podutil "github.com/aveshagarwal/rescheduler/pkg/rescheduler/pod"
|
||||
"github.com/kubernetes-incubator/descheduler/pkg/api"
|
||||
"github.com/kubernetes-incubator/descheduler/pkg/descheduler/evictions"
|
||||
podutil "github.com/kubernetes-incubator/descheduler/pkg/descheduler/pod"
|
||||
)
|
||||
|
||||
//type creator string
|
||||
@@ -35,7 +35,7 @@ type DuplicatePodsMap map[string][]*v1.Pod
|
||||
// RemoveDuplicatePods removes the duplicate pods on node. This strategy evicts all duplicate pods on node.
|
||||
// A pod is said to be a duplicate of other if both of them are from same creator, kind and are within the same
|
||||
// namespace. As of now, this strategy won't evict daemonsets, mirror pods, critical pods and pods with local storages.
|
||||
func RemoveDuplicatePods(client clientset.Interface, strategy api.ReschedulerStrategy, policyGroupVersion string, nodes []*v1.Node) {
|
||||
func RemoveDuplicatePods(client clientset.Interface, strategy api.DeschedulerStrategy, policyGroupVersion string, nodes []*v1.Node) {
|
||||
if !strategy.Enabled {
|
||||
return
|
||||
}
|
||||
@@ -25,9 +25,9 @@ import (
|
||||
helper "k8s.io/kubernetes/pkg/api/v1/resource"
|
||||
"k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
|
||||
|
||||
"github.com/aveshagarwal/rescheduler/pkg/api"
|
||||
"github.com/aveshagarwal/rescheduler/pkg/rescheduler/evictions"
|
||||
podutil "github.com/aveshagarwal/rescheduler/pkg/rescheduler/pod"
|
||||
"github.com/kubernetes-incubator/descheduler/pkg/api"
|
||||
"github.com/kubernetes-incubator/descheduler/pkg/descheduler/evictions"
|
||||
podutil "github.com/kubernetes-incubator/descheduler/pkg/descheduler/pod"
|
||||
)
|
||||
|
||||
type NodeUsageMap struct {
|
||||
@@ -39,7 +39,7 @@ type NodeUsageMap struct {
|
||||
}
|
||||
type NodePodsMap map[*v1.Node][]*v1.Pod
|
||||
|
||||
func LowNodeUtilization(client clientset.Interface, strategy api.ReschedulerStrategy, evictionPolicyGroupVersion string, nodes []*v1.Node) {
|
||||
func LowNodeUtilization(client clientset.Interface, strategy api.DeschedulerStrategy, evictionPolicyGroupVersion string, nodes []*v1.Node) {
|
||||
if !strategy.Enabled {
|
||||
return
|
||||
}
|
||||
@@ -18,15 +18,15 @@ package strategies
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
"github.com/aveshagarwal/rescheduler/test"
|
||||
"github.com/aveshagarwal/rescheduler/pkg/api"
|
||||
"github.com/kubernetes-incubator/descheduler/pkg/api"
|
||||
"github.com/kubernetes-incubator/descheduler/test"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
core "k8s.io/client-go/testing"
|
||||
"k8s.io/kubernetes/pkg/api/v1"
|
||||
"k8s.io/kubernetes/pkg/client/clientset_generated/clientset/fake"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TODO: Make this table driven.
|
||||
@@ -104,7 +104,7 @@ func TestLowNodeUtilization(t *testing.T) {
|
||||
npm := CreateNodePodsMap(fakeClient, []*v1.Node{n1, n2})
|
||||
lowNodes, targetNodes, _ := classifyNodes(npm, thresholds, targetThresholds)
|
||||
podsEvicted := evictPodsFromTargetNodes(fakeClient, "v1", targetNodes, lowNodes, targetThresholds)
|
||||
if expectedPodsEvicted != podsEvicted {
|
||||
if expectedPodsEvicted != podsEvicted {
|
||||
t.Errorf("Expected %#v pods to be evicted but %#v got evicted", expectedPodsEvicted)
|
||||
}
|
||||
|
||||
@@ -15,5 +15,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
# run unit tests
|
||||
go test $(go list github.com/aveshagarwal/rescheduler/... | grep -v github.com/aveshagarwal/rescheduler/vendor/)
|
||||
go test $(go list github.com/kubernetes-incubator/descheduler/... | grep -v github.com/kubernetes-incubator/descheduler/vendor/)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user