mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 14:07:14 +00:00
Merge pull request #111169 from HecarimV/fix-22071511
Remove redundant variable definitions in apis/autoscaling
This commit is contained in:
commit
a156de9661
@ -24,6 +24,7 @@ import (
|
|||||||
runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||||
"k8s.io/kubernetes/pkg/apis/autoscaling"
|
"k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||||
api "k8s.io/kubernetes/pkg/apis/core"
|
api "k8s.io/kubernetes/pkg/apis/core"
|
||||||
|
"k8s.io/utils/pointer"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Funcs returns the fuzzer functions for the autoscaling api group.
|
// Funcs returns the fuzzer functions for the autoscaling api group.
|
||||||
@ -40,8 +41,7 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
|||||||
},
|
},
|
||||||
func(s *autoscaling.HorizontalPodAutoscalerSpec, c fuzz.Continue) {
|
func(s *autoscaling.HorizontalPodAutoscalerSpec, c fuzz.Continue) {
|
||||||
c.FuzzNoCustom(s) // fuzz self without calling this function again
|
c.FuzzNoCustom(s) // fuzz self without calling this function again
|
||||||
minReplicas := int32(c.Rand.Int31())
|
s.MinReplicas = pointer.Int32(c.Rand.Int31())
|
||||||
s.MinReplicas = &minReplicas
|
|
||||||
|
|
||||||
randomQuantity := func() resource.Quantity {
|
randomQuantity := func() resource.Quantity {
|
||||||
var q resource.Quantity
|
var q resource.Quantity
|
||||||
|
@ -19,6 +19,7 @@ package v1
|
|||||||
import (
|
import (
|
||||||
autoscalingv1 "k8s.io/api/autoscaling/v1"
|
autoscalingv1 "k8s.io/api/autoscaling/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/utils/pointer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func addDefaultingFuncs(scheme *runtime.Scheme) error {
|
func addDefaultingFuncs(scheme *runtime.Scheme) error {
|
||||||
@ -27,8 +28,7 @@ func addDefaultingFuncs(scheme *runtime.Scheme) error {
|
|||||||
|
|
||||||
func SetDefaults_HorizontalPodAutoscaler(obj *autoscalingv1.HorizontalPodAutoscaler) {
|
func SetDefaults_HorizontalPodAutoscaler(obj *autoscalingv1.HorizontalPodAutoscaler) {
|
||||||
if obj.Spec.MinReplicas == nil {
|
if obj.Spec.MinReplicas == nil {
|
||||||
minReplicas := int32(1)
|
obj.Spec.MinReplicas = pointer.Int32(1)
|
||||||
obj.Spec.MinReplicas = &minReplicas
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NB: we apply a default for CPU utilization in conversion because
|
// NB: we apply a default for CPU utilization in conversion because
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/kubernetes/pkg/apis/autoscaling"
|
"k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||||
|
"k8s.io/utils/pointer"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -69,8 +70,7 @@ func addDefaultingFuncs(scheme *runtime.Scheme) error {
|
|||||||
|
|
||||||
func SetDefaults_HorizontalPodAutoscaler(obj *autoscalingv2.HorizontalPodAutoscaler) {
|
func SetDefaults_HorizontalPodAutoscaler(obj *autoscalingv2.HorizontalPodAutoscaler) {
|
||||||
if obj.Spec.MinReplicas == nil {
|
if obj.Spec.MinReplicas == nil {
|
||||||
minReplicas := int32(1)
|
obj.Spec.MinReplicas = pointer.Int32(1)
|
||||||
obj.Spec.MinReplicas = &minReplicas
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(obj.Spec.Metrics) == 0 {
|
if len(obj.Spec.Metrics) == 0 {
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/kubernetes/pkg/apis/autoscaling"
|
"k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||||
|
"k8s.io/utils/pointer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func addDefaultingFuncs(scheme *runtime.Scheme) error {
|
func addDefaultingFuncs(scheme *runtime.Scheme) error {
|
||||||
@ -29,8 +30,7 @@ func addDefaultingFuncs(scheme *runtime.Scheme) error {
|
|||||||
|
|
||||||
func SetDefaults_HorizontalPodAutoscaler(obj *autoscalingv2beta1.HorizontalPodAutoscaler) {
|
func SetDefaults_HorizontalPodAutoscaler(obj *autoscalingv2beta1.HorizontalPodAutoscaler) {
|
||||||
if obj.Spec.MinReplicas == nil {
|
if obj.Spec.MinReplicas == nil {
|
||||||
minReplicas := int32(1)
|
obj.Spec.MinReplicas = pointer.Int32(1)
|
||||||
obj.Spec.MinReplicas = &minReplicas
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(obj.Spec.Metrics) == 0 {
|
if len(obj.Spec.Metrics) == 0 {
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/kubernetes/pkg/apis/autoscaling"
|
"k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||||
|
"k8s.io/utils/pointer"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -70,8 +71,7 @@ func addDefaultingFuncs(scheme *runtime.Scheme) error {
|
|||||||
|
|
||||||
func SetDefaults_HorizontalPodAutoscaler(obj *autoscalingv2beta2.HorizontalPodAutoscaler) {
|
func SetDefaults_HorizontalPodAutoscaler(obj *autoscalingv2beta2.HorizontalPodAutoscaler) {
|
||||||
if obj.Spec.MinReplicas == nil {
|
if obj.Spec.MinReplicas == nil {
|
||||||
minReplicas := int32(1)
|
obj.Spec.MinReplicas = pointer.Int32(1)
|
||||||
obj.Spec.MinReplicas = &minReplicas
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(obj.Spec.Metrics) == 0 {
|
if len(obj.Spec.Metrics) == 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user