From 2517268b1f24d6d0e2ff2c8f0603abd59b99ce1e Mon Sep 17 00:00:00 2001 From: lixiang Date: Fri, 26 Feb 2021 15:49:00 +0800 Subject: [PATCH] API: Add a new parameter labelSelector to StrategyParameters. --- pkg/api/types.go | 1 + pkg/api/v1alpha1/types.go | 1 + pkg/api/v1alpha1/zz_generated.conversion.go | 3 +++ pkg/api/v1alpha1/zz_generated.deepcopy.go | 6 ++++++ pkg/api/zz_generated.deepcopy.go | 6 ++++++ 5 files changed, 17 insertions(+) diff --git a/pkg/api/types.go b/pkg/api/types.go index 819631983..e545d8861 100644 --- a/pkg/api/types.go +++ b/pkg/api/types.go @@ -76,6 +76,7 @@ type StrategyParameters struct { Namespaces *Namespaces ThresholdPriority *int32 ThresholdPriorityClassName string + LabelSelector *metav1.LabelSelector } type Percentage float64 diff --git a/pkg/api/v1alpha1/types.go b/pkg/api/v1alpha1/types.go index c486eab3f..3585addab 100644 --- a/pkg/api/v1alpha1/types.go +++ b/pkg/api/v1alpha1/types.go @@ -74,6 +74,7 @@ type StrategyParameters struct { Namespaces *Namespaces `json:"namespaces"` ThresholdPriority *int32 `json:"thresholdPriority"` ThresholdPriorityClassName string `json:"thresholdPriorityClassName"` + LabelSelector *metav1.LabelSelector `json:"labelSelector"` } type Percentage float64 diff --git a/pkg/api/v1alpha1/zz_generated.conversion.go b/pkg/api/v1alpha1/zz_generated.conversion.go index d39f1afa7..727b9c776 100644 --- a/pkg/api/v1alpha1/zz_generated.conversion.go +++ b/pkg/api/v1alpha1/zz_generated.conversion.go @@ -23,6 +23,7 @@ package v1alpha1 import ( unsafe "unsafe" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" conversion "k8s.io/apimachinery/pkg/conversion" runtime "k8s.io/apimachinery/pkg/runtime" api "sigs.k8s.io/descheduler/pkg/api" @@ -290,6 +291,7 @@ func autoConvert_v1alpha1_StrategyParameters_To_api_StrategyParameters(in *Strat out.Namespaces = (*api.Namespaces)(unsafe.Pointer(in.Namespaces)) out.ThresholdPriority = (*int32)(unsafe.Pointer(in.ThresholdPriority)) out.ThresholdPriorityClassName = in.ThresholdPriorityClassName + out.LabelSelector = (*v1.LabelSelector)(unsafe.Pointer(in.LabelSelector)) return nil } @@ -308,6 +310,7 @@ func autoConvert_api_StrategyParameters_To_v1alpha1_StrategyParameters(in *api.S out.Namespaces = (*Namespaces)(unsafe.Pointer(in.Namespaces)) out.ThresholdPriority = (*int32)(unsafe.Pointer(in.ThresholdPriority)) out.ThresholdPriorityClassName = in.ThresholdPriorityClassName + out.LabelSelector = (*v1.LabelSelector)(unsafe.Pointer(in.LabelSelector)) return nil } diff --git a/pkg/api/v1alpha1/zz_generated.deepcopy.go b/pkg/api/v1alpha1/zz_generated.deepcopy.go index 96f82b08a..c58be4588 100644 --- a/pkg/api/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/api/v1alpha1/zz_generated.deepcopy.go @@ -21,6 +21,7 @@ limitations under the License. package v1alpha1 import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -298,6 +299,11 @@ func (in *StrategyParameters) DeepCopyInto(out *StrategyParameters) { *out = new(int32) **out = **in } + if in.LabelSelector != nil { + in, out := &in.LabelSelector, &out.LabelSelector + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } return } diff --git a/pkg/api/zz_generated.deepcopy.go b/pkg/api/zz_generated.deepcopy.go index 4aeb27eec..ddce3a66b 100644 --- a/pkg/api/zz_generated.deepcopy.go +++ b/pkg/api/zz_generated.deepcopy.go @@ -21,6 +21,7 @@ limitations under the License. package api import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -298,6 +299,11 @@ func (in *StrategyParameters) DeepCopyInto(out *StrategyParameters) { *out = new(int32) **out = **in } + if in.LabelSelector != nil { + in, out := &in.LabelSelector, &out.LabelSelector + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } return }