From ec9b50df803fb70f1852cd5e1943f33aeff2010c Mon Sep 17 00:00:00 2001 From: Johnu George Date: Tue, 20 Dec 2022 03:25:17 +0530 Subject: [PATCH] Changing label selector type for HPA (#197) * Changing label selector type to string * go mod changes --- pkg/apis/common/v1/openapi_generated.go | 5 ++--- pkg/apis/common/v1/types.go | 4 ++-- pkg/apis/common/v1/zz_generated.deepcopy.go | 8 +------- .../client/clientset/versioned/fake/register.go | 14 +++++++------- .../client/clientset/versioned/scheme/register.go | 14 +++++++------- 5 files changed, 19 insertions(+), 26 deletions(-) diff --git a/pkg/apis/common/v1/openapi_generated.go b/pkg/apis/common/v1/openapi_generated.go index e4b31777..6476e5c3 100644 --- a/pkg/apis/common/v1/openapi_generated.go +++ b/pkg/apis/common/v1/openapi_generated.go @@ -226,14 +226,13 @@ func schema_pkg_apis_common_v1_ReplicaStatus(ref common.ReferenceCallback) commo "labelSelector": { SchemaProps: spec.SchemaProps{ Description: "A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.", - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), + Type: []string{"string"}, + Format: "", }, }, }, }, }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, } } diff --git a/pkg/apis/common/v1/types.go b/pkg/apis/common/v1/types.go index e4eb7eb2..064ea122 100644 --- a/pkg/apis/common/v1/types.go +++ b/pkg/apis/common/v1/types.go @@ -4,7 +4,7 @@ // 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 +// 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, @@ -65,7 +65,7 @@ type ReplicaStatus struct { // A label selector is a label query over a set of resources. The result of matchLabels and // matchExpressions are ANDed. An empty label selector matches all objects. A null // label selector matches no objects. - LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"` + LabelSelector string `json:"labelSelector,omitempty"` } // +k8s:openapi-gen=true diff --git a/pkg/apis/common/v1/zz_generated.deepcopy.go b/pkg/apis/common/v1/zz_generated.deepcopy.go index 19fc8699..51dff7da 100644 --- a/pkg/apis/common/v1/zz_generated.deepcopy.go +++ b/pkg/apis/common/v1/zz_generated.deepcopy.go @@ -22,7 +22,6 @@ package v1 import ( corev1 "k8s.io/api/core/v1" resource "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -63,7 +62,7 @@ func (in *JobStatus) DeepCopyInto(out *JobStatus) { } else { in, out := &val, &outVal *out = new(ReplicaStatus) - (*in).DeepCopyInto(*out) + **out = **in } (*out)[key] = outVal } @@ -118,11 +117,6 @@ func (in *ReplicaSpec) DeepCopy() *ReplicaSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ReplicaStatus) DeepCopyInto(out *ReplicaStatus) { *out = *in - if in.LabelSelector != nil { - in, out := &in.LabelSelector, &out.LabelSelector - *out = new(metav1.LabelSelector) - (*in).DeepCopyInto(*out) - } return } diff --git a/test_job/client/clientset/versioned/fake/register.go b/test_job/client/clientset/versioned/fake/register.go index 83ee94fd..3c15ec3f 100644 --- a/test_job/client/clientset/versioned/fake/register.go +++ b/test_job/client/clientset/versioned/fake/register.go @@ -35,14 +35,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{ // AddToScheme adds all types of this clientset into the given scheme. This allows composition // of clientsets, like in: // -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) // -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) // // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. diff --git a/test_job/client/clientset/versioned/scheme/register.go b/test_job/client/clientset/versioned/scheme/register.go index 072debef..a3f60e26 100644 --- a/test_job/client/clientset/versioned/scheme/register.go +++ b/test_job/client/clientset/versioned/scheme/register.go @@ -35,14 +35,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{ // AddToScheme adds all types of this clientset into the given scheme. This allows composition // of clientsets, like in: // -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) // -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) // // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly.