From a79916fa8443b1920a8c6ca3de502b757ef11878 Mon Sep 17 00:00:00 2001 From: Mike Dame Date: Thu, 28 Jun 2018 14:25:58 -0400 Subject: [PATCH] Update autoscaling conversion and validation for v2beta2 inclusion --- pkg/apis/autoscaling/BUILD | 1 + pkg/apis/autoscaling/fuzzer/fuzzer.go | 29 +- pkg/apis/autoscaling/install/BUILD | 10 +- pkg/apis/autoscaling/install/install.go | 4 +- pkg/apis/autoscaling/types.go | 18 +- pkg/apis/autoscaling/v1/BUILD | 11 +- pkg/apis/autoscaling/v1/conversion.go | 274 +++++++++- .../autoscaling/v1/zz_generated.conversion.go | 339 ++++++++----- pkg/apis/autoscaling/v2beta1/BUILD | 38 +- pkg/apis/autoscaling/v2beta1/conversion.go | 410 +++++++++++++++ pkg/apis/autoscaling/v2beta1/register.go | 2 +- .../v2beta1/zz_generated.conversion.go | 433 ++++++++++------ pkg/apis/autoscaling/validation/validation.go | 110 ++-- .../autoscaling/validation/validation_test.go | 393 +++++++++++---- pkg/apis/autoscaling/zz_generated.deepcopy.go | 143 ++++-- .../k8s.io/api/autoscaling/v1/generated.pb.go | 473 +++++++++++++++++- .../k8s.io/api/autoscaling/v1/generated.proto | 38 ++ .../v1/types_swagger_doc_generated.go | 16 +- .../autoscaling/v1/zz_generated.deepcopy.go | 20 + .../api/autoscaling/v2beta1/generated.pb.go | 458 ++++++++++++++++- .../api/autoscaling/v2beta1/generated.proto | 39 ++ .../k8s.io/api/autoscaling/v2beta1/types.go | 1 + .../v2beta1/types_swagger_doc_generated.go | 16 +- .../v2beta1/zz_generated.deepcopy.go | 20 + 24 files changed, 2721 insertions(+), 575 deletions(-) create mode 100644 pkg/apis/autoscaling/v2beta1/conversion.go diff --git a/pkg/apis/autoscaling/BUILD b/pkg/apis/autoscaling/BUILD index ad9b54b402f..5fed7730d8a 100644 --- a/pkg/apis/autoscaling/BUILD +++ b/pkg/apis/autoscaling/BUILD @@ -39,6 +39,7 @@ filegroup( "//pkg/apis/autoscaling/install:all-srcs", "//pkg/apis/autoscaling/v1:all-srcs", "//pkg/apis/autoscaling/v2beta1:all-srcs", + "//pkg/apis/autoscaling/v2beta2:all-srcs", "//pkg/apis/autoscaling/validation:all-srcs", ], tags = ["automanaged"], diff --git a/pkg/apis/autoscaling/fuzzer/fuzzer.go b/pkg/apis/autoscaling/fuzzer/fuzzer.go index 2c1ea0608ca..8322057d288 100644 --- a/pkg/apis/autoscaling/fuzzer/fuzzer.go +++ b/pkg/apis/autoscaling/fuzzer/fuzzer.go @@ -52,19 +52,28 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} { } targetUtilization := int32(c.RandUint64()) + averageValue := randomQuantity() s.Metrics = []autoscaling.MetricSpec{ { Type: autoscaling.PodsMetricSourceType, Pods: &autoscaling.PodsMetricSource{ - MetricName: c.RandString(), - TargetAverageValue: randomQuantity(), + Metric: autoscaling.MetricIdentifier{ + Name: c.RandString(), + }, + Target: autoscaling.MetricTarget{ + Type: autoscaling.AverageValueMetricType, + AverageValue: &averageValue, + }, }, }, { Type: autoscaling.ResourceMetricSourceType, Resource: &autoscaling.ResourceMetricSource{ Name: api.ResourceCPU, - TargetAverageUtilization: &targetUtilization, + Target: autoscaling.MetricTarget{ + Type: autoscaling.UtilizationMetricType, + AverageUtilization: &targetUtilization, + }, }, }, } @@ -78,20 +87,28 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} { _ = q.String() return q } + averageValue := randomQuantity() currentUtilization := int32(c.RandUint64()) s.CurrentMetrics = []autoscaling.MetricStatus{ { Type: autoscaling.PodsMetricSourceType, Pods: &autoscaling.PodsMetricStatus{ - MetricName: c.RandString(), - CurrentAverageValue: randomQuantity(), + Metric: autoscaling.MetricIdentifier{ + Name: c.RandString(), + }, + Current: autoscaling.MetricValueStatus{ + AverageValue: &averageValue, + }, }, }, { Type: autoscaling.ResourceMetricSourceType, Resource: &autoscaling.ResourceMetricStatus{ Name: api.ResourceCPU, - CurrentAverageUtilization: ¤tUtilization, + Current: autoscaling.MetricValueStatus{ + AverageUtilization: ¤tUtilization, + AverageValue: &averageValue, + }, }, }, } diff --git a/pkg/apis/autoscaling/install/BUILD b/pkg/apis/autoscaling/install/BUILD index 74b65a14697..31b1a56184f 100644 --- a/pkg/apis/autoscaling/install/BUILD +++ b/pkg/apis/autoscaling/install/BUILD @@ -1,19 +1,16 @@ -package(default_visibility = ["//visibility:public"]) - -load( - "@io_bazel_rules_go//go:def.bzl", - "go_library", -) +load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "go_default_library", srcs = ["install.go"], importpath = "k8s.io/kubernetes/pkg/apis/autoscaling/install", + visibility = ["//visibility:public"], deps = [ "//pkg/api/legacyscheme:go_default_library", "//pkg/apis/autoscaling:go_default_library", "//pkg/apis/autoscaling/v1:go_default_library", "//pkg/apis/autoscaling/v2beta1:go_default_library", + "//pkg/apis/autoscaling/v2beta2:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/runtime:go_default_library", ], @@ -30,4 +27,5 @@ filegroup( name = "all-srcs", srcs = [":package-srcs"], tags = ["automanaged"], + visibility = ["//visibility:public"], ) diff --git a/pkg/apis/autoscaling/install/install.go b/pkg/apis/autoscaling/install/install.go index 62236a0c779..b2c52ed7cc0 100644 --- a/pkg/apis/autoscaling/install/install.go +++ b/pkg/apis/autoscaling/install/install.go @@ -25,6 +25,7 @@ import ( "k8s.io/kubernetes/pkg/apis/autoscaling" "k8s.io/kubernetes/pkg/apis/autoscaling/v1" "k8s.io/kubernetes/pkg/apis/autoscaling/v2beta1" + "k8s.io/kubernetes/pkg/apis/autoscaling/v2beta2" ) func init() { @@ -34,7 +35,8 @@ func init() { // Install registers the API group and adds types to a scheme func Install(scheme *runtime.Scheme) { utilruntime.Must(autoscaling.AddToScheme(scheme)) + utilruntime.Must(v2beta2.AddToScheme(scheme)) utilruntime.Must(v2beta1.AddToScheme(scheme)) utilruntime.Must(v1.AddToScheme(scheme)) - utilruntime.Must(scheme.SetVersionPriority(v1.SchemeGroupVersion, v2beta1.SchemeGroupVersion)) + utilruntime.Must(scheme.SetVersionPriority(v1.SchemeGroupVersion, v2beta1.SchemeGroupVersion, v2beta2.SchemeGroupVersion)) } diff --git a/pkg/apis/autoscaling/types.go b/pkg/apis/autoscaling/types.go index 319d67159ed..4ab6f8aff55 100644 --- a/pkg/apis/autoscaling/types.go +++ b/pkg/apis/autoscaling/types.go @@ -251,6 +251,7 @@ type HorizontalPodAutoscalerStatus struct { DesiredReplicas int32 // CurrentMetrics is the last read state of the metrics used by this autoscaler. + // +optional CurrentMetrics []MetricStatus // Conditions is the set of conditions required for this autoscaler to scale its target, @@ -343,6 +344,8 @@ type MetricStatus struct { type ObjectMetricStatus struct { Metric MetricIdentifier Current MetricValueStatus + + DescribedObject CrossVersionObjectReference } // PodsMetricStatus indicates the current value of a metric describing each pod in @@ -359,19 +362,8 @@ type PodsMetricStatus struct { // normal per-pod metrics using the "pods" source. type ResourceMetricStatus struct { // Name is the name of the resource in question. - Name api.ResourceName - // CurrentAverageUtilization is the current value of the average of the - // resource metric across all relevant pods, represented as a percentage of - // the requested value of the resource for the pods. It will only be - // present if `targetAverageValue` was set in the corresponding metric - // specification. - // +optional - CurrentAverageUtilization *int32 - // CurrentAverageValue is the current value of the average of the - // resource metric across all relevant pods, as a raw value (instead of as - // a percentage of the request), similar to the "pods" metric source type. - // It will always be set, regardless of the corresponding metric specification. - CurrentAverageValue resource.Quantity + Name api.ResourceName + Current MetricValueStatus } // ExternalMetricStatus indicates the current value of a global metric diff --git a/pkg/apis/autoscaling/v1/BUILD b/pkg/apis/autoscaling/v1/BUILD index bfd9fb1087b..0360cbfa5f5 100644 --- a/pkg/apis/autoscaling/v1/BUILD +++ b/pkg/apis/autoscaling/v1/BUILD @@ -1,10 +1,4 @@ -package(default_visibility = ["//visibility:public"]) - -load( - "@io_bazel_rules_go//go:def.bzl", - "go_library", - "go_test", -) +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") go_library( name = "go_default_library", @@ -17,12 +11,12 @@ go_library( "zz_generated.defaults.go", ], importpath = "k8s.io/kubernetes/pkg/apis/autoscaling/v1", + visibility = ["//visibility:public"], deps = [ "//pkg/apis/autoscaling:go_default_library", "//pkg/apis/core:go_default_library", "//staging/src/k8s.io/api/autoscaling/v1:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/api/resource:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", @@ -55,4 +49,5 @@ filegroup( name = "all-srcs", srcs = [":package-srcs"], tags = ["automanaged"], + visibility = ["//visibility:public"], ) diff --git a/pkg/apis/autoscaling/v1/conversion.go b/pkg/apis/autoscaling/v1/conversion.go index 599fa7622d5..1fb3c343cb7 100644 --- a/pkg/apis/autoscaling/v1/conversion.go +++ b/pkg/apis/autoscaling/v1/conversion.go @@ -21,10 +21,12 @@ import ( autoscalingv1 "k8s.io/api/autoscaling/v1" + v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/conversion" "k8s.io/apimachinery/pkg/runtime" "k8s.io/kubernetes/pkg/apis/autoscaling" api "k8s.io/kubernetes/pkg/apis/core" + core "k8s.io/kubernetes/pkg/apis/core" ) func addConversionFuncs(scheme *runtime.Scheme) error { @@ -36,6 +38,22 @@ func addConversionFuncs(scheme *runtime.Scheme) error { Convert_v1_HorizontalPodAutoscalerSpec_To_autoscaling_HorizontalPodAutoscalerSpec, Convert_autoscaling_HorizontalPodAutoscalerStatus_To_v1_HorizontalPodAutoscalerStatus, Convert_v1_HorizontalPodAutoscalerStatus_To_autoscaling_HorizontalPodAutoscalerStatus, + Convert_autoscaling_ExternalMetricSource_To_v1_ExternalMetricSource, + Convert_v1_ExternalMetricSource_To_autoscaling_ExternalMetricSource, + Convert_autoscaling_ObjectMetricSource_To_v1_ObjectMetricSource, + Convert_v1_ObjectMetricSource_To_autoscaling_ObjectMetricSource, + Convert_autoscaling_PodsMetricSource_To_v1_PodsMetricSource, + Convert_v1_PodsMetricSource_To_autoscaling_PodsMetricSource, + Convert_autoscaling_ExternalMetricStatus_To_v1_ExternalMetricStatus, + Convert_v1_ExternalMetricStatus_To_autoscaling_ExternalMetricStatus, + Convert_autoscaling_ObjectMetricStatus_To_v1_ObjectMetricStatus, + Convert_v1_ObjectMetricStatus_To_autoscaling_ObjectMetricStatus, + Convert_autoscaling_PodsMetricStatus_To_v1_PodsMetricStatus, + Convert_v1_PodsMetricStatus_To_autoscaling_PodsMetricStatus, + Convert_autoscaling_MetricTarget_To_v1_CrossVersionObjectReference, + Convert_v1_CrossVersionObjectReference_To_autoscaling_MetricTarget, + Convert_autoscaling_ResourceMetricStatus_To_v1_ResourceMetricStatus, + Convert_v1_ResourceMetricStatus_To_autoscaling_ResourceMetricStatus, ) if err != nil { return err @@ -44,6 +62,234 @@ func addConversionFuncs(scheme *runtime.Scheme) error { return nil } +func Convert_autoscaling_MetricTarget_To_v1_CrossVersionObjectReference(in *autoscaling.MetricTarget, out *autoscalingv1.CrossVersionObjectReference, s conversion.Scope) error { + return nil +} + +func Convert_v1_CrossVersionObjectReference_To_autoscaling_MetricTarget(in *autoscalingv1.CrossVersionObjectReference, out *autoscaling.MetricTarget, s conversion.Scope) error { + return nil +} + +func Convert_autoscaling_ExternalMetricSource_To_v1_ExternalMetricSource(in *autoscaling.ExternalMetricSource, out *autoscalingv1.ExternalMetricSource, s conversion.Scope) error { + out.MetricName = in.Metric.Name + out.TargetValue = in.Target.Value + out.TargetAverageValue = in.Target.AverageValue + out.MetricSelector = in.Metric.Selector + return nil +} + +func Convert_v1_ExternalMetricSource_To_autoscaling_ExternalMetricSource(in *autoscalingv1.ExternalMetricSource, out *autoscaling.ExternalMetricSource, s conversion.Scope) error { + value := in.TargetValue + averageValue := in.TargetAverageValue + var metricType autoscaling.MetricTargetType + if value == nil { + metricType = autoscaling.AverageValueMetricType + } else { + metricType = autoscaling.ValueMetricType + } + out.Target = autoscaling.MetricTarget{ + Type: metricType, + Value: value, + AverageValue: averageValue, + } + + out.Metric = autoscaling.MetricIdentifier{ + Name: in.MetricName, + Selector: in.MetricSelector, + } + return nil +} + +func Convert_autoscaling_ObjectMetricSource_To_v1_ObjectMetricSource(in *autoscaling.ObjectMetricSource, out *autoscalingv1.ObjectMetricSource, s conversion.Scope) error { + if in.Target.Value != nil { + out.TargetValue = *in.Target.Value + } + out.AverageValue = in.Target.AverageValue + out.Target = autoscalingv1.CrossVersionObjectReference{ + Kind: in.DescribedObject.Kind, + Name: in.DescribedObject.Name, + APIVersion: in.DescribedObject.APIVersion, + } + out.MetricName = in.Metric.Name + return nil +} + +func Convert_v1_ObjectMetricSource_To_autoscaling_ObjectMetricSource(in *autoscalingv1.ObjectMetricSource, out *autoscaling.ObjectMetricSource, s conversion.Scope) error { + var metricType autoscaling.MetricTargetType + if in.AverageValue == nil { + metricType = autoscaling.ValueMetricType + } else { + metricType = autoscaling.AverageValueMetricType + } + + out.Target = autoscaling.MetricTarget{ + Type: metricType, + Value: &in.TargetValue, + AverageValue: in.AverageValue, + } + out.DescribedObject = autoscaling.CrossVersionObjectReference{ + Kind: in.Target.Kind, + Name: in.Target.Name, + APIVersion: in.Target.APIVersion, + } + out.Metric = autoscaling.MetricIdentifier{ + Name: in.MetricName, + Selector: in.Selector, + } + return nil +} + +func Convert_autoscaling_PodsMetricSource_To_v1_PodsMetricSource(in *autoscaling.PodsMetricSource, out *autoscalingv1.PodsMetricSource, s conversion.Scope) error { + if in.Target.AverageValue != nil { + out.TargetAverageValue = *in.Target.AverageValue + } + + out.MetricName = in.Metric.Name + out.Selector = in.Metric.Selector + return nil +} + +func Convert_v1_PodsMetricSource_To_autoscaling_PodsMetricSource(in *autoscalingv1.PodsMetricSource, out *autoscaling.PodsMetricSource, s conversion.Scope) error { + var metricType autoscaling.MetricTargetType + metricType = autoscaling.AverageValueMetricType + + out.Target = autoscaling.MetricTarget{ + Type: metricType, + AverageValue: &in.TargetAverageValue, + } + out.Metric = autoscaling.MetricIdentifier{ + Name: in.MetricName, + Selector: in.Selector, + } + return nil +} + +func Convert_autoscaling_ExternalMetricStatus_To_v1_ExternalMetricStatus(in *autoscaling.ExternalMetricStatus, out *autoscalingv1.ExternalMetricStatus, s conversion.Scope) error { + out.MetricName = in.Metric.Name + if in.Current.Value != nil { + out.CurrentValue = *in.Current.Value + } + if in.Current.AverageValue != nil { + out.CurrentAverageValue = in.Current.AverageValue + } + out.MetricSelector = in.Metric.Selector + return nil +} + +func Convert_v1_ExternalMetricStatus_To_autoscaling_ExternalMetricStatus(in *autoscalingv1.ExternalMetricStatus, out *autoscaling.ExternalMetricStatus, s conversion.Scope) error { + value := in.CurrentValue + averageValue := in.CurrentAverageValue + out.Current = autoscaling.MetricValueStatus{ + Value: &value, + AverageValue: averageValue, + } + out.Metric = autoscaling.MetricIdentifier{ + Name: in.MetricName, + Selector: in.MetricSelector, + } + return nil +} + +func Convert_autoscaling_ObjectMetricStatus_To_v1_ObjectMetricStatus(in *autoscaling.ObjectMetricStatus, out *autoscalingv1.ObjectMetricStatus, s conversion.Scope) error { + if in.Current.Value != nil { + out.CurrentValue = *in.Current.Value + } + if in.Current.AverageValue != nil { + currentAverageValue := *in.Current.AverageValue + out.AverageValue = ¤tAverageValue + } + out.Target = autoscalingv1.CrossVersionObjectReference{ + Kind: in.DescribedObject.Kind, + Name: in.DescribedObject.Name, + APIVersion: in.DescribedObject.APIVersion, + } + out.MetricName = in.Metric.Name + out.Selector = in.Metric.Selector + return nil +} + +func Convert_v1_ObjectMetricStatus_To_autoscaling_ObjectMetricStatus(in *autoscalingv1.ObjectMetricStatus, out *autoscaling.ObjectMetricStatus, s conversion.Scope) error { + out.Current = autoscaling.MetricValueStatus{ + Value: &in.CurrentValue, + AverageValue: in.AverageValue, + } + out.DescribedObject = autoscaling.CrossVersionObjectReference{ + Kind: in.Target.Kind, + Name: in.Target.Name, + APIVersion: in.Target.APIVersion, + } + out.Metric = autoscaling.MetricIdentifier{ + Name: in.MetricName, + Selector: in.Selector, + } + return nil +} + +func Convert_autoscaling_PodsMetricStatus_To_v1_PodsMetricStatus(in *autoscaling.PodsMetricStatus, out *autoscalingv1.PodsMetricStatus, s conversion.Scope) error { + if in.Current.AverageValue != nil { + out.CurrentAverageValue = *in.Current.AverageValue + } + out.MetricName = in.Metric.Name + out.Selector = in.Metric.Selector + return nil +} + +func Convert_v1_PodsMetricStatus_To_autoscaling_PodsMetricStatus(in *autoscalingv1.PodsMetricStatus, out *autoscaling.PodsMetricStatus, s conversion.Scope) error { + out.Current = autoscaling.MetricValueStatus{ + AverageValue: &in.CurrentAverageValue, + } + out.Metric = autoscaling.MetricIdentifier{ + Name: in.MetricName, + Selector: in.Selector, + } + return nil +} + +func Convert_v1_ResourceMetricSource_To_autoscaling_ResourceMetricSource(in *autoscalingv1.ResourceMetricSource, out *autoscaling.ResourceMetricSource, s conversion.Scope) error { + out.Name = core.ResourceName(in.Name) + utilization := in.TargetAverageUtilization + averageValue := in.TargetAverageValue + var metricType autoscaling.MetricTargetType + if utilization == nil { + metricType = autoscaling.AverageValueMetricType + } else { + metricType = autoscaling.UtilizationMetricType + } + out.Target = autoscaling.MetricTarget{ + Type: metricType, + AverageValue: averageValue, + AverageUtilization: utilization, + } + return nil +} + +func Convert_autoscaling_ResourceMetricSource_To_v1_ResourceMetricSource(in *autoscaling.ResourceMetricSource, out *autoscalingv1.ResourceMetricSource, s conversion.Scope) error { + out.Name = v1.ResourceName(in.Name) + out.TargetAverageUtilization = in.Target.AverageUtilization + out.TargetAverageValue = in.Target.AverageValue + return nil +} + +func Convert_v1_ResourceMetricStatus_To_autoscaling_ResourceMetricStatus(in *autoscalingv1.ResourceMetricStatus, out *autoscaling.ResourceMetricStatus, s conversion.Scope) error { + out.Name = core.ResourceName(in.Name) + utilization := in.CurrentAverageUtilization + averageValue := &in.CurrentAverageValue + out.Current = autoscaling.MetricValueStatus{ + AverageValue: averageValue, + AverageUtilization: utilization, + } + return nil +} + +func Convert_autoscaling_ResourceMetricStatus_To_v1_ResourceMetricStatus(in *autoscaling.ResourceMetricStatus, out *autoscalingv1.ResourceMetricStatus, s conversion.Scope) error { + out.Name = v1.ResourceName(in.Name) + out.CurrentAverageUtilization = in.Current.AverageUtilization + if in.Current.AverageValue != nil { + out.CurrentAverageValue = *in.Current.AverageValue + } + return nil +} + func Convert_autoscaling_HorizontalPodAutoscaler_To_v1_HorizontalPodAutoscaler(in *autoscaling.HorizontalPodAutoscaler, out *autoscalingv1.HorizontalPodAutoscaler, s conversion.Scope) error { if err := autoConvert_autoscaling_HorizontalPodAutoscaler_To_v1_HorizontalPodAutoscaler(in, out, s); err != nil { return err @@ -51,7 +297,7 @@ func Convert_autoscaling_HorizontalPodAutoscaler_To_v1_HorizontalPodAutoscaler(i otherMetrics := make([]autoscalingv1.MetricSpec, 0, len(in.Spec.Metrics)) for _, metric := range in.Spec.Metrics { - if metric.Type == autoscaling.ResourceMetricSourceType && metric.Resource != nil && metric.Resource.Name == api.ResourceCPU && metric.Resource.TargetAverageUtilization != nil { + if metric.Type == autoscaling.ResourceMetricSourceType && metric.Resource != nil && metric.Resource.Name == api.ResourceCPU && metric.Resource.Target.AverageUtilization != nil { continue } @@ -165,11 +411,14 @@ func Convert_v1_HorizontalPodAutoscaler_To_autoscaling_HorizontalPodAutoscaler(i Type: autoscaling.ResourceMetricSourceType, Resource: &autoscaling.ResourceMetricSource{ Name: api.ResourceCPU, + Target: autoscaling.MetricTarget{ + Type: autoscaling.UtilizationMetricType, + }, }, }, } - out.Spec.Metrics[0].Resource.TargetAverageUtilization = new(int32) - *out.Spec.Metrics[0].Resource.TargetAverageUtilization = autoscaling.DefaultCPUUtilization + out.Spec.Metrics[0].Resource.Target.AverageUtilization = new(int32) + *out.Spec.Metrics[0].Resource.Target.AverageUtilization = autoscaling.DefaultCPUUtilization } if currentConditionsEnc, hasCurrentConditions := out.Annotations[autoscaling.HorizontalPodAutoscalerConditionsAnnotation]; hasCurrentConditions { @@ -200,9 +449,9 @@ func Convert_autoscaling_HorizontalPodAutoscalerSpec_To_v1_HorizontalPodAutoscal for _, metric := range in.Metrics { if metric.Type == autoscaling.ResourceMetricSourceType && metric.Resource != nil && metric.Resource.Name == api.ResourceCPU { - if metric.Resource.TargetAverageUtilization != nil { + if metric.Resource.Target.AverageUtilization != nil { out.TargetCPUUtilizationPercentage = new(int32) - *out.TargetCPUUtilizationPercentage = *metric.Resource.TargetAverageUtilization + *out.TargetCPUUtilizationPercentage = *metric.Resource.Target.AverageUtilization } break } @@ -225,11 +474,14 @@ func Convert_v1_HorizontalPodAutoscalerSpec_To_autoscaling_HorizontalPodAutoscal Type: autoscaling.ResourceMetricSourceType, Resource: &autoscaling.ResourceMetricSource{ Name: api.ResourceCPU, + Target: autoscaling.MetricTarget{ + Type: autoscaling.UtilizationMetricType, + }, }, }, } - out.Metrics[0].Resource.TargetAverageUtilization = new(int32) - *out.Metrics[0].Resource.TargetAverageUtilization = *in.TargetCPUUtilizationPercentage + out.Metrics[0].Resource.Target.AverageUtilization = new(int32) + *out.Metrics[0].Resource.Target.AverageUtilization = *in.TargetCPUUtilizationPercentage } return nil @@ -244,10 +496,10 @@ func Convert_autoscaling_HorizontalPodAutoscalerStatus_To_v1_HorizontalPodAutosc for _, metric := range in.CurrentMetrics { if metric.Type == autoscaling.ResourceMetricSourceType && metric.Resource != nil && metric.Resource.Name == api.ResourceCPU { - if metric.Resource.CurrentAverageUtilization != nil { + if metric.Resource.Current.AverageUtilization != nil { out.CurrentCPUUtilizationPercentage = new(int32) - *out.CurrentCPUUtilizationPercentage = *metric.Resource.CurrentAverageUtilization + *out.CurrentCPUUtilizationPercentage = *metric.Resource.Current.AverageUtilization } } } @@ -270,8 +522,8 @@ func Convert_v1_HorizontalPodAutoscalerStatus_To_autoscaling_HorizontalPodAutosc }, }, } - out.CurrentMetrics[0].Resource.CurrentAverageUtilization = new(int32) - *out.CurrentMetrics[0].Resource.CurrentAverageUtilization = *in.CurrentCPUUtilizationPercentage + out.CurrentMetrics[0].Resource.Current.AverageUtilization = new(int32) + *out.CurrentMetrics[0].Resource.Current.AverageUtilization = *in.CurrentCPUUtilizationPercentage } return nil } diff --git a/pkg/apis/autoscaling/v1/zz_generated.conversion.go b/pkg/apis/autoscaling/v1/zz_generated.conversion.go index 9109ca51b54..4e9194dd795 100644 --- a/pkg/apis/autoscaling/v1/zz_generated.conversion.go +++ b/pkg/apis/autoscaling/v1/zz_generated.conversion.go @@ -24,9 +24,14 @@ import ( unsafe "unsafe" v1 "k8s.io/api/autoscaling/v1" +<<<<<<< HEAD corev1 "k8s.io/api/core/v1" resource "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +======= + core_v1 "k8s.io/api/core/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +>>>>>>> Update autoscaling conversion and validation for v2beta2 inclusion conversion "k8s.io/apimachinery/pkg/conversion" runtime "k8s.io/apimachinery/pkg/runtime" autoscaling "k8s.io/kubernetes/pkg/apis/autoscaling" @@ -288,57 +293,61 @@ func Convert_autoscaling_CrossVersionObjectReference_To_v1_CrossVersionObjectRef } func autoConvert_v1_ExternalMetricSource_To_autoscaling_ExternalMetricSource(in *v1.ExternalMetricSource, out *autoscaling.ExternalMetricSource, s conversion.Scope) error { +<<<<<<< HEAD out.MetricName = in.MetricName out.MetricSelector = (*metav1.LabelSelector)(unsafe.Pointer(in.MetricSelector)) out.TargetValue = (*resource.Quantity)(unsafe.Pointer(in.TargetValue)) out.TargetAverageValue = (*resource.Quantity)(unsafe.Pointer(in.TargetAverageValue)) +======= + // WARNING: in.MetricName requires manual conversion: does not exist in peer-type + // WARNING: in.MetricSelector requires manual conversion: does not exist in peer-type + // WARNING: in.TargetValue requires manual conversion: does not exist in peer-type + // WARNING: in.TargetAverageValue requires manual conversion: does not exist in peer-type +>>>>>>> Update autoscaling conversion and validation for v2beta2 inclusion return nil } -// Convert_v1_ExternalMetricSource_To_autoscaling_ExternalMetricSource is an autogenerated conversion function. -func Convert_v1_ExternalMetricSource_To_autoscaling_ExternalMetricSource(in *v1.ExternalMetricSource, out *autoscaling.ExternalMetricSource, s conversion.Scope) error { - return autoConvert_v1_ExternalMetricSource_To_autoscaling_ExternalMetricSource(in, out, s) -} - func autoConvert_autoscaling_ExternalMetricSource_To_v1_ExternalMetricSource(in *autoscaling.ExternalMetricSource, out *v1.ExternalMetricSource, s conversion.Scope) error { +<<<<<<< HEAD out.MetricName = in.MetricName out.MetricSelector = (*metav1.LabelSelector)(unsafe.Pointer(in.MetricSelector)) out.TargetValue = (*resource.Quantity)(unsafe.Pointer(in.TargetValue)) out.TargetAverageValue = (*resource.Quantity)(unsafe.Pointer(in.TargetAverageValue)) +======= + // WARNING: in.Metric requires manual conversion: does not exist in peer-type + // WARNING: in.Target requires manual conversion: does not exist in peer-type +>>>>>>> Update autoscaling conversion and validation for v2beta2 inclusion return nil } -// Convert_autoscaling_ExternalMetricSource_To_v1_ExternalMetricSource is an autogenerated conversion function. -func Convert_autoscaling_ExternalMetricSource_To_v1_ExternalMetricSource(in *autoscaling.ExternalMetricSource, out *v1.ExternalMetricSource, s conversion.Scope) error { - return autoConvert_autoscaling_ExternalMetricSource_To_v1_ExternalMetricSource(in, out, s) -} - func autoConvert_v1_ExternalMetricStatus_To_autoscaling_ExternalMetricStatus(in *v1.ExternalMetricStatus, out *autoscaling.ExternalMetricStatus, s conversion.Scope) error { +<<<<<<< HEAD out.MetricName = in.MetricName out.MetricSelector = (*metav1.LabelSelector)(unsafe.Pointer(in.MetricSelector)) out.CurrentValue = in.CurrentValue out.CurrentAverageValue = (*resource.Quantity)(unsafe.Pointer(in.CurrentAverageValue)) +======= + // WARNING: in.MetricName requires manual conversion: does not exist in peer-type + // WARNING: in.MetricSelector requires manual conversion: does not exist in peer-type + // WARNING: in.CurrentValue requires manual conversion: does not exist in peer-type + // WARNING: in.CurrentAverageValue requires manual conversion: does not exist in peer-type +>>>>>>> Update autoscaling conversion and validation for v2beta2 inclusion return nil } -// Convert_v1_ExternalMetricStatus_To_autoscaling_ExternalMetricStatus is an autogenerated conversion function. -func Convert_v1_ExternalMetricStatus_To_autoscaling_ExternalMetricStatus(in *v1.ExternalMetricStatus, out *autoscaling.ExternalMetricStatus, s conversion.Scope) error { - return autoConvert_v1_ExternalMetricStatus_To_autoscaling_ExternalMetricStatus(in, out, s) -} - func autoConvert_autoscaling_ExternalMetricStatus_To_v1_ExternalMetricStatus(in *autoscaling.ExternalMetricStatus, out *v1.ExternalMetricStatus, s conversion.Scope) error { +<<<<<<< HEAD out.MetricName = in.MetricName out.MetricSelector = (*metav1.LabelSelector)(unsafe.Pointer(in.MetricSelector)) out.CurrentValue = in.CurrentValue out.CurrentAverageValue = (*resource.Quantity)(unsafe.Pointer(in.CurrentAverageValue)) +======= + // WARNING: in.Metric requires manual conversion: does not exist in peer-type + // WARNING: in.Current requires manual conversion: does not exist in peer-type +>>>>>>> Update autoscaling conversion and validation for v2beta2 inclusion return nil } -// Convert_autoscaling_ExternalMetricStatus_To_v1_ExternalMetricStatus is an autogenerated conversion function. -func Convert_autoscaling_ExternalMetricStatus_To_v1_ExternalMetricStatus(in *autoscaling.ExternalMetricStatus, out *v1.ExternalMetricStatus, s conversion.Scope) error { - return autoConvert_autoscaling_ExternalMetricStatus_To_v1_ExternalMetricStatus(in, out, s) -} - func autoConvert_v1_HorizontalPodAutoscaler_To_autoscaling_HorizontalPodAutoscaler(in *v1.HorizontalPodAutoscaler, out *autoscaling.HorizontalPodAutoscaler, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta if err := Convert_v1_HorizontalPodAutoscalerSpec_To_autoscaling_HorizontalPodAutoscalerSpec(&in.Spec, &out.Spec, s); err != nil { @@ -472,10 +481,42 @@ func autoConvert_autoscaling_HorizontalPodAutoscalerStatus_To_v1_HorizontalPodAu func autoConvert_v1_MetricSpec_To_autoscaling_MetricSpec(in *v1.MetricSpec, out *autoscaling.MetricSpec, s conversion.Scope) error { out.Type = autoscaling.MetricSourceType(in.Type) - out.Object = (*autoscaling.ObjectMetricSource)(unsafe.Pointer(in.Object)) - out.Pods = (*autoscaling.PodsMetricSource)(unsafe.Pointer(in.Pods)) - out.Resource = (*autoscaling.ResourceMetricSource)(unsafe.Pointer(in.Resource)) - out.External = (*autoscaling.ExternalMetricSource)(unsafe.Pointer(in.External)) + if in.Object != nil { + in, out := &in.Object, &out.Object + *out = new(autoscaling.ObjectMetricSource) + if err := Convert_v1_ObjectMetricSource_To_autoscaling_ObjectMetricSource(*in, *out, s); err != nil { + return err + } + } else { + out.Object = nil + } + if in.Pods != nil { + in, out := &in.Pods, &out.Pods + *out = new(autoscaling.PodsMetricSource) + if err := Convert_v1_PodsMetricSource_To_autoscaling_PodsMetricSource(*in, *out, s); err != nil { + return err + } + } else { + out.Pods = nil + } + if in.Resource != nil { + in, out := &in.Resource, &out.Resource + *out = new(autoscaling.ResourceMetricSource) + if err := Convert_v1_ResourceMetricSource_To_autoscaling_ResourceMetricSource(*in, *out, s); err != nil { + return err + } + } else { + out.Resource = nil + } + if in.External != nil { + in, out := &in.External, &out.External + *out = new(autoscaling.ExternalMetricSource) + if err := Convert_v1_ExternalMetricSource_To_autoscaling_ExternalMetricSource(*in, *out, s); err != nil { + return err + } + } else { + out.External = nil + } return nil } @@ -486,10 +527,42 @@ func Convert_v1_MetricSpec_To_autoscaling_MetricSpec(in *v1.MetricSpec, out *aut func autoConvert_autoscaling_MetricSpec_To_v1_MetricSpec(in *autoscaling.MetricSpec, out *v1.MetricSpec, s conversion.Scope) error { out.Type = v1.MetricSourceType(in.Type) - out.Object = (*v1.ObjectMetricSource)(unsafe.Pointer(in.Object)) - out.Pods = (*v1.PodsMetricSource)(unsafe.Pointer(in.Pods)) - out.Resource = (*v1.ResourceMetricSource)(unsafe.Pointer(in.Resource)) - out.External = (*v1.ExternalMetricSource)(unsafe.Pointer(in.External)) + if in.Object != nil { + in, out := &in.Object, &out.Object + *out = new(v1.ObjectMetricSource) + if err := Convert_autoscaling_ObjectMetricSource_To_v1_ObjectMetricSource(*in, *out, s); err != nil { + return err + } + } else { + out.Object = nil + } + if in.Pods != nil { + in, out := &in.Pods, &out.Pods + *out = new(v1.PodsMetricSource) + if err := Convert_autoscaling_PodsMetricSource_To_v1_PodsMetricSource(*in, *out, s); err != nil { + return err + } + } else { + out.Pods = nil + } + if in.Resource != nil { + in, out := &in.Resource, &out.Resource + *out = new(v1.ResourceMetricSource) + if err := Convert_autoscaling_ResourceMetricSource_To_v1_ResourceMetricSource(*in, *out, s); err != nil { + return err + } + } else { + out.Resource = nil + } + if in.External != nil { + in, out := &in.External, &out.External + *out = new(v1.ExternalMetricSource) + if err := Convert_autoscaling_ExternalMetricSource_To_v1_ExternalMetricSource(*in, *out, s); err != nil { + return err + } + } else { + out.External = nil + } return nil } @@ -500,10 +573,42 @@ func Convert_autoscaling_MetricSpec_To_v1_MetricSpec(in *autoscaling.MetricSpec, func autoConvert_v1_MetricStatus_To_autoscaling_MetricStatus(in *v1.MetricStatus, out *autoscaling.MetricStatus, s conversion.Scope) error { out.Type = autoscaling.MetricSourceType(in.Type) - out.Object = (*autoscaling.ObjectMetricStatus)(unsafe.Pointer(in.Object)) - out.Pods = (*autoscaling.PodsMetricStatus)(unsafe.Pointer(in.Pods)) - out.Resource = (*autoscaling.ResourceMetricStatus)(unsafe.Pointer(in.Resource)) - out.External = (*autoscaling.ExternalMetricStatus)(unsafe.Pointer(in.External)) + if in.Object != nil { + in, out := &in.Object, &out.Object + *out = new(autoscaling.ObjectMetricStatus) + if err := Convert_v1_ObjectMetricStatus_To_autoscaling_ObjectMetricStatus(*in, *out, s); err != nil { + return err + } + } else { + out.Object = nil + } + if in.Pods != nil { + in, out := &in.Pods, &out.Pods + *out = new(autoscaling.PodsMetricStatus) + if err := Convert_v1_PodsMetricStatus_To_autoscaling_PodsMetricStatus(*in, *out, s); err != nil { + return err + } + } else { + out.Pods = nil + } + if in.Resource != nil { + in, out := &in.Resource, &out.Resource + *out = new(autoscaling.ResourceMetricStatus) + if err := Convert_v1_ResourceMetricStatus_To_autoscaling_ResourceMetricStatus(*in, *out, s); err != nil { + return err + } + } else { + out.Resource = nil + } + if in.External != nil { + in, out := &in.External, &out.External + *out = new(autoscaling.ExternalMetricStatus) + if err := Convert_v1_ExternalMetricStatus_To_autoscaling_ExternalMetricStatus(*in, *out, s); err != nil { + return err + } + } else { + out.External = nil + } return nil } @@ -514,10 +619,42 @@ func Convert_v1_MetricStatus_To_autoscaling_MetricStatus(in *v1.MetricStatus, ou func autoConvert_autoscaling_MetricStatus_To_v1_MetricStatus(in *autoscaling.MetricStatus, out *v1.MetricStatus, s conversion.Scope) error { out.Type = v1.MetricSourceType(in.Type) - out.Object = (*v1.ObjectMetricStatus)(unsafe.Pointer(in.Object)) - out.Pods = (*v1.PodsMetricStatus)(unsafe.Pointer(in.Pods)) - out.Resource = (*v1.ResourceMetricStatus)(unsafe.Pointer(in.Resource)) - out.External = (*v1.ExternalMetricStatus)(unsafe.Pointer(in.External)) + if in.Object != nil { + in, out := &in.Object, &out.Object + *out = new(v1.ObjectMetricStatus) + if err := Convert_autoscaling_ObjectMetricStatus_To_v1_ObjectMetricStatus(*in, *out, s); err != nil { + return err + } + } else { + out.Object = nil + } + if in.Pods != nil { + in, out := &in.Pods, &out.Pods + *out = new(v1.PodsMetricStatus) + if err := Convert_autoscaling_PodsMetricStatus_To_v1_PodsMetricStatus(*in, *out, s); err != nil { + return err + } + } else { + out.Pods = nil + } + if in.Resource != nil { + in, out := &in.Resource, &out.Resource + *out = new(v1.ResourceMetricStatus) + if err := Convert_autoscaling_ResourceMetricStatus_To_v1_ResourceMetricStatus(*in, *out, s); err != nil { + return err + } + } else { + out.Resource = nil + } + if in.External != nil { + in, out := &in.External, &out.External + *out = new(v1.ExternalMetricStatus) + if err := Convert_autoscaling_ExternalMetricStatus_To_v1_ExternalMetricStatus(*in, *out, s); err != nil { + return err + } + } else { + out.External = nil + } return nil } @@ -527,153 +664,107 @@ func Convert_autoscaling_MetricStatus_To_v1_MetricStatus(in *autoscaling.MetricS } func autoConvert_v1_ObjectMetricSource_To_autoscaling_ObjectMetricSource(in *v1.ObjectMetricSource, out *autoscaling.ObjectMetricSource, s conversion.Scope) error { - if err := Convert_v1_CrossVersionObjectReference_To_autoscaling_CrossVersionObjectReference(&in.Target, &out.Target, s); err != nil { + if err := Convert_v1_CrossVersionObjectReference_To_autoscaling_MetricTarget(&in.Target, &out.Target, s); err != nil { return err } - out.MetricName = in.MetricName - out.TargetValue = in.TargetValue + // WARNING: in.MetricName requires manual conversion: does not exist in peer-type + // WARNING: in.TargetValue requires manual conversion: does not exist in peer-type + // WARNING: in.Selector requires manual conversion: does not exist in peer-type + // WARNING: in.AverageValue requires manual conversion: does not exist in peer-type return nil } -// Convert_v1_ObjectMetricSource_To_autoscaling_ObjectMetricSource is an autogenerated conversion function. -func Convert_v1_ObjectMetricSource_To_autoscaling_ObjectMetricSource(in *v1.ObjectMetricSource, out *autoscaling.ObjectMetricSource, s conversion.Scope) error { - return autoConvert_v1_ObjectMetricSource_To_autoscaling_ObjectMetricSource(in, out, s) -} - func autoConvert_autoscaling_ObjectMetricSource_To_v1_ObjectMetricSource(in *autoscaling.ObjectMetricSource, out *v1.ObjectMetricSource, s conversion.Scope) error { - if err := Convert_autoscaling_CrossVersionObjectReference_To_v1_CrossVersionObjectReference(&in.Target, &out.Target, s); err != nil { + // WARNING: in.DescribedObject requires manual conversion: does not exist in peer-type + if err := Convert_autoscaling_MetricTarget_To_v1_CrossVersionObjectReference(&in.Target, &out.Target, s); err != nil { return err } - out.MetricName = in.MetricName - out.TargetValue = in.TargetValue + // WARNING: in.Metric requires manual conversion: does not exist in peer-type return nil } -// Convert_autoscaling_ObjectMetricSource_To_v1_ObjectMetricSource is an autogenerated conversion function. -func Convert_autoscaling_ObjectMetricSource_To_v1_ObjectMetricSource(in *autoscaling.ObjectMetricSource, out *v1.ObjectMetricSource, s conversion.Scope) error { - return autoConvert_autoscaling_ObjectMetricSource_To_v1_ObjectMetricSource(in, out, s) -} - func autoConvert_v1_ObjectMetricStatus_To_autoscaling_ObjectMetricStatus(in *v1.ObjectMetricStatus, out *autoscaling.ObjectMetricStatus, s conversion.Scope) error { - if err := Convert_v1_CrossVersionObjectReference_To_autoscaling_CrossVersionObjectReference(&in.Target, &out.Target, s); err != nil { - return err - } - out.MetricName = in.MetricName - out.CurrentValue = in.CurrentValue + // WARNING: in.Target requires manual conversion: does not exist in peer-type + // WARNING: in.MetricName requires manual conversion: does not exist in peer-type + // WARNING: in.CurrentValue requires manual conversion: does not exist in peer-type + // WARNING: in.Selector requires manual conversion: does not exist in peer-type + // WARNING: in.AverageValue requires manual conversion: does not exist in peer-type return nil } -// Convert_v1_ObjectMetricStatus_To_autoscaling_ObjectMetricStatus is an autogenerated conversion function. -func Convert_v1_ObjectMetricStatus_To_autoscaling_ObjectMetricStatus(in *v1.ObjectMetricStatus, out *autoscaling.ObjectMetricStatus, s conversion.Scope) error { - return autoConvert_v1_ObjectMetricStatus_To_autoscaling_ObjectMetricStatus(in, out, s) -} - func autoConvert_autoscaling_ObjectMetricStatus_To_v1_ObjectMetricStatus(in *autoscaling.ObjectMetricStatus, out *v1.ObjectMetricStatus, s conversion.Scope) error { - if err := Convert_autoscaling_CrossVersionObjectReference_To_v1_CrossVersionObjectReference(&in.Target, &out.Target, s); err != nil { - return err - } - out.MetricName = in.MetricName - out.CurrentValue = in.CurrentValue + // WARNING: in.Metric requires manual conversion: does not exist in peer-type + // WARNING: in.Current requires manual conversion: does not exist in peer-type + // WARNING: in.DescribedObject requires manual conversion: does not exist in peer-type return nil } -// Convert_autoscaling_ObjectMetricStatus_To_v1_ObjectMetricStatus is an autogenerated conversion function. -func Convert_autoscaling_ObjectMetricStatus_To_v1_ObjectMetricStatus(in *autoscaling.ObjectMetricStatus, out *v1.ObjectMetricStatus, s conversion.Scope) error { - return autoConvert_autoscaling_ObjectMetricStatus_To_v1_ObjectMetricStatus(in, out, s) -} - func autoConvert_v1_PodsMetricSource_To_autoscaling_PodsMetricSource(in *v1.PodsMetricSource, out *autoscaling.PodsMetricSource, s conversion.Scope) error { - out.MetricName = in.MetricName - out.TargetAverageValue = in.TargetAverageValue + // WARNING: in.MetricName requires manual conversion: does not exist in peer-type + // WARNING: in.TargetAverageValue requires manual conversion: does not exist in peer-type + // WARNING: in.Selector requires manual conversion: does not exist in peer-type + // WARNING: in.Value requires manual conversion: does not exist in peer-type return nil } -// Convert_v1_PodsMetricSource_To_autoscaling_PodsMetricSource is an autogenerated conversion function. -func Convert_v1_PodsMetricSource_To_autoscaling_PodsMetricSource(in *v1.PodsMetricSource, out *autoscaling.PodsMetricSource, s conversion.Scope) error { - return autoConvert_v1_PodsMetricSource_To_autoscaling_PodsMetricSource(in, out, s) -} - func autoConvert_autoscaling_PodsMetricSource_To_v1_PodsMetricSource(in *autoscaling.PodsMetricSource, out *v1.PodsMetricSource, s conversion.Scope) error { - out.MetricName = in.MetricName - out.TargetAverageValue = in.TargetAverageValue + // WARNING: in.Metric requires manual conversion: does not exist in peer-type + // WARNING: in.Target requires manual conversion: does not exist in peer-type return nil } -// Convert_autoscaling_PodsMetricSource_To_v1_PodsMetricSource is an autogenerated conversion function. -func Convert_autoscaling_PodsMetricSource_To_v1_PodsMetricSource(in *autoscaling.PodsMetricSource, out *v1.PodsMetricSource, s conversion.Scope) error { - return autoConvert_autoscaling_PodsMetricSource_To_v1_PodsMetricSource(in, out, s) -} - func autoConvert_v1_PodsMetricStatus_To_autoscaling_PodsMetricStatus(in *v1.PodsMetricStatus, out *autoscaling.PodsMetricStatus, s conversion.Scope) error { - out.MetricName = in.MetricName - out.CurrentAverageValue = in.CurrentAverageValue + // WARNING: in.MetricName requires manual conversion: does not exist in peer-type + // WARNING: in.CurrentAverageValue requires manual conversion: does not exist in peer-type + // WARNING: in.Selector requires manual conversion: does not exist in peer-type + // WARNING: in.Value requires manual conversion: does not exist in peer-type return nil } -// Convert_v1_PodsMetricStatus_To_autoscaling_PodsMetricStatus is an autogenerated conversion function. -func Convert_v1_PodsMetricStatus_To_autoscaling_PodsMetricStatus(in *v1.PodsMetricStatus, out *autoscaling.PodsMetricStatus, s conversion.Scope) error { - return autoConvert_v1_PodsMetricStatus_To_autoscaling_PodsMetricStatus(in, out, s) -} - func autoConvert_autoscaling_PodsMetricStatus_To_v1_PodsMetricStatus(in *autoscaling.PodsMetricStatus, out *v1.PodsMetricStatus, s conversion.Scope) error { - out.MetricName = in.MetricName - out.CurrentAverageValue = in.CurrentAverageValue + // WARNING: in.Metric requires manual conversion: does not exist in peer-type + // WARNING: in.Current requires manual conversion: does not exist in peer-type return nil } -// Convert_autoscaling_PodsMetricStatus_To_v1_PodsMetricStatus is an autogenerated conversion function. -func Convert_autoscaling_PodsMetricStatus_To_v1_PodsMetricStatus(in *autoscaling.PodsMetricStatus, out *v1.PodsMetricStatus, s conversion.Scope) error { - return autoConvert_autoscaling_PodsMetricStatus_To_v1_PodsMetricStatus(in, out, s) -} - func autoConvert_v1_ResourceMetricSource_To_autoscaling_ResourceMetricSource(in *v1.ResourceMetricSource, out *autoscaling.ResourceMetricSource, s conversion.Scope) error { out.Name = core.ResourceName(in.Name) - out.TargetAverageUtilization = (*int32)(unsafe.Pointer(in.TargetAverageUtilization)) - out.TargetAverageValue = (*resource.Quantity)(unsafe.Pointer(in.TargetAverageValue)) + // WARNING: in.TargetAverageUtilization requires manual conversion: does not exist in peer-type + // WARNING: in.TargetAverageValue requires manual conversion: does not exist in peer-type return nil } -// Convert_v1_ResourceMetricSource_To_autoscaling_ResourceMetricSource is an autogenerated conversion function. -func Convert_v1_ResourceMetricSource_To_autoscaling_ResourceMetricSource(in *v1.ResourceMetricSource, out *autoscaling.ResourceMetricSource, s conversion.Scope) error { - return autoConvert_v1_ResourceMetricSource_To_autoscaling_ResourceMetricSource(in, out, s) -} - func autoConvert_autoscaling_ResourceMetricSource_To_v1_ResourceMetricSource(in *autoscaling.ResourceMetricSource, out *v1.ResourceMetricSource, s conversion.Scope) error { +<<<<<<< HEAD out.Name = corev1.ResourceName(in.Name) out.TargetAverageUtilization = (*int32)(unsafe.Pointer(in.TargetAverageUtilization)) out.TargetAverageValue = (*resource.Quantity)(unsafe.Pointer(in.TargetAverageValue)) +======= + out.Name = core_v1.ResourceName(in.Name) + // WARNING: in.Target requires manual conversion: does not exist in peer-type +>>>>>>> Update autoscaling conversion and validation for v2beta2 inclusion return nil } -// Convert_autoscaling_ResourceMetricSource_To_v1_ResourceMetricSource is an autogenerated conversion function. -func Convert_autoscaling_ResourceMetricSource_To_v1_ResourceMetricSource(in *autoscaling.ResourceMetricSource, out *v1.ResourceMetricSource, s conversion.Scope) error { - return autoConvert_autoscaling_ResourceMetricSource_To_v1_ResourceMetricSource(in, out, s) -} - func autoConvert_v1_ResourceMetricStatus_To_autoscaling_ResourceMetricStatus(in *v1.ResourceMetricStatus, out *autoscaling.ResourceMetricStatus, s conversion.Scope) error { out.Name = core.ResourceName(in.Name) - out.CurrentAverageUtilization = (*int32)(unsafe.Pointer(in.CurrentAverageUtilization)) - out.CurrentAverageValue = in.CurrentAverageValue + // WARNING: in.CurrentAverageUtilization requires manual conversion: does not exist in peer-type + // WARNING: in.CurrentAverageValue requires manual conversion: does not exist in peer-type return nil } -// Convert_v1_ResourceMetricStatus_To_autoscaling_ResourceMetricStatus is an autogenerated conversion function. -func Convert_v1_ResourceMetricStatus_To_autoscaling_ResourceMetricStatus(in *v1.ResourceMetricStatus, out *autoscaling.ResourceMetricStatus, s conversion.Scope) error { - return autoConvert_v1_ResourceMetricStatus_To_autoscaling_ResourceMetricStatus(in, out, s) -} - func autoConvert_autoscaling_ResourceMetricStatus_To_v1_ResourceMetricStatus(in *autoscaling.ResourceMetricStatus, out *v1.ResourceMetricStatus, s conversion.Scope) error { +<<<<<<< HEAD out.Name = corev1.ResourceName(in.Name) out.CurrentAverageUtilization = (*int32)(unsafe.Pointer(in.CurrentAverageUtilization)) out.CurrentAverageValue = in.CurrentAverageValue +======= + out.Name = core_v1.ResourceName(in.Name) + // WARNING: in.Current requires manual conversion: does not exist in peer-type +>>>>>>> Update autoscaling conversion and validation for v2beta2 inclusion return nil } -// Convert_autoscaling_ResourceMetricStatus_To_v1_ResourceMetricStatus is an autogenerated conversion function. -func Convert_autoscaling_ResourceMetricStatus_To_v1_ResourceMetricStatus(in *autoscaling.ResourceMetricStatus, out *v1.ResourceMetricStatus, s conversion.Scope) error { - return autoConvert_autoscaling_ResourceMetricStatus_To_v1_ResourceMetricStatus(in, out, s) -} - func autoConvert_v1_Scale_To_autoscaling_Scale(in *v1.Scale, out *autoscaling.Scale, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta if err := Convert_v1_ScaleSpec_To_autoscaling_ScaleSpec(&in.Spec, &out.Spec, s); err != nil { diff --git a/pkg/apis/autoscaling/v2beta1/BUILD b/pkg/apis/autoscaling/v2beta1/BUILD index c7c346918ed..47d21ddb94e 100644 --- a/pkg/apis/autoscaling/v2beta1/BUILD +++ b/pkg/apis/autoscaling/v2beta1/BUILD @@ -1,14 +1,9 @@ -package(default_visibility = ["//visibility:public"]) - -load( - "@io_bazel_rules_go//go:def.bzl", - "go_library", - "go_test", -) +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") go_library( name = "go_default_library", srcs = [ + "conversion.go", "defaults.go", "doc.go", "register.go", @@ -16,12 +11,12 @@ go_library( "zz_generated.defaults.go", ], importpath = "k8s.io/kubernetes/pkg/apis/autoscaling/v2beta1", + visibility = ["//visibility:public"], deps = [ "//pkg/apis/autoscaling:go_default_library", "//pkg/apis/core:go_default_library", "//staging/src/k8s.io/api/autoscaling/v2beta1:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/api/resource:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", @@ -29,19 +24,6 @@ go_library( ], ) -filegroup( - name = "package-srcs", - srcs = glob(["**"]), - tags = ["automanaged"], - visibility = ["//visibility:private"], -) - -filegroup( - name = "all-srcs", - srcs = [":package-srcs"], - tags = ["automanaged"], -) - go_test( name = "go_default_test", srcs = ["defaults_test.go"], @@ -58,3 +40,17 @@ go_test( "//vendor/k8s.io/utils/pointer:go_default_library", ], ) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/pkg/apis/autoscaling/v2beta1/conversion.go b/pkg/apis/autoscaling/v2beta1/conversion.go new file mode 100644 index 00000000000..289aab878d8 --- /dev/null +++ b/pkg/apis/autoscaling/v2beta1/conversion.go @@ -0,0 +1,410 @@ +/* +Copyright 2018 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 v2beta1 + +import ( + "encoding/json" + + autoscalingv2beta1 "k8s.io/api/autoscaling/v2beta1" + + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/conversion" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/kubernetes/pkg/apis/autoscaling" + core "k8s.io/kubernetes/pkg/apis/core" +) + +func addConversionFuncs(scheme *runtime.Scheme) error { + // Add non-generated conversion functions + err := scheme.AddConversionFuncs( + Convert_autoscaling_ExternalMetricSource_To_v2beta1_ExternalMetricSource, + Convert_v2beta1_ExternalMetricSource_To_autoscaling_ExternalMetricSource, + Convert_autoscaling_ObjectMetricSource_To_v2beta1_ObjectMetricSource, + Convert_v2beta1_ObjectMetricSource_To_autoscaling_ObjectMetricSource, + Convert_autoscaling_PodsMetricSource_To_v2beta1_PodsMetricSource, + Convert_v2beta1_PodsMetricSource_To_autoscaling_PodsMetricSource, + Convert_autoscaling_ExternalMetricStatus_To_v2beta1_ExternalMetricStatus, + Convert_v2beta1_ExternalMetricStatus_To_autoscaling_ExternalMetricStatus, + Convert_autoscaling_ObjectMetricStatus_To_v2beta1_ObjectMetricStatus, + Convert_v2beta1_ObjectMetricStatus_To_autoscaling_ObjectMetricStatus, + Convert_autoscaling_PodsMetricStatus_To_v2beta1_PodsMetricStatus, + Convert_v2beta1_PodsMetricStatus_To_autoscaling_PodsMetricStatus, + Convert_autoscaling_ResourceMetricSource_To_v2beta1_ResourceMetricSource, + Convert_v2beta1_ResourceMetricSource_To_autoscaling_ResourceMetricSource, + Convert_autoscaling_MetricTarget_To_v2beta1_CrossVersionObjectReference, + Convert_v2beta1_CrossVersionObjectReference_To_autoscaling_MetricTarget, + Convert_autoscaling_ResourceMetricStatus_To_v2beta1_ResourceMetricStatus, + Convert_v2beta1_ResourceMetricStatus_To_autoscaling_ResourceMetricStatus, + Convert_autoscaling_HorizontalPodAutoscaler_To_v2beta1_HorizontalPodAutoscaler, + Convert_v2beta1_HorizontalPodAutoscaler_To_autoscaling_HorizontalPodAutoscaler, + ) + if err != nil { + return err + } + + return nil +} + +func Convert_autoscaling_MetricTarget_To_v2beta1_CrossVersionObjectReference(in *autoscaling.MetricTarget, out *autoscalingv2beta1.CrossVersionObjectReference, s conversion.Scope) error { + return nil +} + +func Convert_v2beta1_CrossVersionObjectReference_To_autoscaling_MetricTarget(in *autoscalingv2beta1.CrossVersionObjectReference, out *autoscaling.MetricTarget, s conversion.Scope) error { + return nil +} + +func Convert_v2beta1_ResourceMetricStatus_To_autoscaling_ResourceMetricStatus(in *autoscalingv2beta1.ResourceMetricStatus, out *autoscaling.ResourceMetricStatus, s conversion.Scope) error { + out.Name = core.ResourceName(in.Name) + utilization := in.CurrentAverageUtilization + averageValue := in.CurrentAverageValue + out.Current = autoscaling.MetricValueStatus{ + AverageValue: &averageValue, + AverageUtilization: utilization, + } + return nil +} + +func Convert_autoscaling_ResourceMetricStatus_To_v2beta1_ResourceMetricStatus(in *autoscaling.ResourceMetricStatus, out *autoscalingv2beta1.ResourceMetricStatus, s conversion.Scope) error { + out.Name = v1.ResourceName(in.Name) + out.CurrentAverageUtilization = in.Current.AverageUtilization + if in.Current.AverageValue != nil { + out.CurrentAverageValue = *in.Current.AverageValue + } + return nil +} + +func Convert_v2beta1_ResourceMetricSource_To_autoscaling_ResourceMetricSource(in *autoscalingv2beta1.ResourceMetricSource, out *autoscaling.ResourceMetricSource, s conversion.Scope) error { + out.Name = core.ResourceName(in.Name) + utilization := in.TargetAverageUtilization + averageValue := in.TargetAverageValue + + var metricType autoscaling.MetricTargetType + if utilization == nil { + metricType = autoscaling.AverageValueMetricType + } else { + metricType = autoscaling.UtilizationMetricType + } + out.Target = autoscaling.MetricTarget{ + Type: metricType, + AverageValue: averageValue, + AverageUtilization: utilization, + } + return nil +} + +func Convert_autoscaling_ResourceMetricSource_To_v2beta1_ResourceMetricSource(in *autoscaling.ResourceMetricSource, out *autoscalingv2beta1.ResourceMetricSource, s conversion.Scope) error { + out.Name = v1.ResourceName(in.Name) + out.TargetAverageUtilization = in.Target.AverageUtilization + out.TargetAverageValue = in.Target.AverageValue + return nil +} + +func Convert_autoscaling_ExternalMetricSource_To_v2beta1_ExternalMetricSource(in *autoscaling.ExternalMetricSource, out *autoscalingv2beta1.ExternalMetricSource, s conversion.Scope) error { + out.MetricName = in.Metric.Name + out.TargetValue = in.Target.Value + out.TargetAverageValue = in.Target.AverageValue + out.MetricSelector = in.Metric.Selector + return nil +} + +func Convert_v2beta1_ExternalMetricSource_To_autoscaling_ExternalMetricSource(in *autoscalingv2beta1.ExternalMetricSource, out *autoscaling.ExternalMetricSource, s conversion.Scope) error { + value := in.TargetValue + averageValue := in.TargetAverageValue + + var metricType autoscaling.MetricTargetType + if value == nil { + metricType = autoscaling.AverageValueMetricType + } else { + metricType = autoscaling.ValueMetricType + } + + out.Target = autoscaling.MetricTarget{ + Type: metricType, + Value: value, + AverageValue: averageValue, + } + + out.Metric = autoscaling.MetricIdentifier{ + Name: in.MetricName, + Selector: in.MetricSelector, + } + return nil +} + +func Convert_autoscaling_ObjectMetricSource_To_v2beta1_ObjectMetricSource(in *autoscaling.ObjectMetricSource, out *autoscalingv2beta1.ObjectMetricSource, s conversion.Scope) error { + if in.Target.Value != nil { + out.TargetValue = *in.Target.Value + } + out.AverageValue = in.Target.AverageValue + + out.Target = autoscalingv2beta1.CrossVersionObjectReference{ + Kind: in.DescribedObject.Kind, + Name: in.DescribedObject.Name, + APIVersion: in.DescribedObject.APIVersion, + } + out.MetricName = in.Metric.Name + out.Selector = in.Metric.Selector + + return nil +} + +func Convert_v2beta1_ObjectMetricSource_To_autoscaling_ObjectMetricSource(in *autoscalingv2beta1.ObjectMetricSource, out *autoscaling.ObjectMetricSource, s conversion.Scope) error { + var metricType autoscaling.MetricTargetType + if in.AverageValue == nil { + metricType = autoscaling.ValueMetricType + } else { + metricType = autoscaling.AverageValueMetricType + } + out.Target = autoscaling.MetricTarget{ + Type: metricType, + Value: &in.TargetValue, + AverageValue: in.AverageValue, + } + out.DescribedObject = autoscaling.CrossVersionObjectReference{ + Kind: in.Target.Kind, + Name: in.Target.Name, + APIVersion: in.Target.APIVersion, + } + out.Metric = autoscaling.MetricIdentifier{ + Name: in.MetricName, + Selector: in.Selector, + } + return nil +} + +func Convert_autoscaling_PodsMetricSource_To_v2beta1_PodsMetricSource(in *autoscaling.PodsMetricSource, out *autoscalingv2beta1.PodsMetricSource, s conversion.Scope) error { + targetAverageValue := *in.Target.AverageValue + out.TargetAverageValue = targetAverageValue + + out.MetricName = in.Metric.Name + out.Selector = in.Metric.Selector + + return nil +} + +func Convert_v2beta1_PodsMetricSource_To_autoscaling_PodsMetricSource(in *autoscalingv2beta1.PodsMetricSource, out *autoscaling.PodsMetricSource, s conversion.Scope) error { + targetAverageValue := &in.TargetAverageValue + var metricType autoscaling.MetricTargetType + metricType = autoscaling.AverageValueMetricType + + out.Target = autoscaling.MetricTarget{ + Type: metricType, + AverageValue: targetAverageValue, + } + out.Metric = autoscaling.MetricIdentifier{ + Name: in.MetricName, + Selector: in.Selector, + } + return nil +} + +func Convert_autoscaling_ExternalMetricStatus_To_v2beta1_ExternalMetricStatus(in *autoscaling.ExternalMetricStatus, out *autoscalingv2beta1.ExternalMetricStatus, s conversion.Scope) error { + if &in.Current.AverageValue != nil { + out.CurrentAverageValue = in.Current.AverageValue + } + out.MetricName = in.Metric.Name + if in.Current.Value != nil { + out.CurrentValue = *in.Current.Value + } + out.MetricSelector = in.Metric.Selector + return nil +} + +func Convert_v2beta1_ExternalMetricStatus_To_autoscaling_ExternalMetricStatus(in *autoscalingv2beta1.ExternalMetricStatus, out *autoscaling.ExternalMetricStatus, s conversion.Scope) error { + value := in.CurrentValue + averageValue := in.CurrentAverageValue + out.Current = autoscaling.MetricValueStatus{ + Value: &value, + AverageValue: averageValue, + } + out.Metric = autoscaling.MetricIdentifier{ + Name: in.MetricName, + Selector: in.MetricSelector, + } + return nil +} + +func Convert_autoscaling_ObjectMetricStatus_To_v2beta1_ObjectMetricStatus(in *autoscaling.ObjectMetricStatus, out *autoscalingv2beta1.ObjectMetricStatus, s conversion.Scope) error { + if in.Current.Value != nil { + out.CurrentValue = *in.Current.Value + } + out.Target = autoscalingv2beta1.CrossVersionObjectReference{ + Kind: in.DescribedObject.Kind, + Name: in.DescribedObject.Name, + APIVersion: in.DescribedObject.APIVersion, + } + out.MetricName = in.Metric.Name + out.Selector = in.Metric.Selector + currentAverageValue := *in.Current.AverageValue + out.AverageValue = ¤tAverageValue + return nil +} + +func Convert_v2beta1_ObjectMetricStatus_To_autoscaling_ObjectMetricStatus(in *autoscalingv2beta1.ObjectMetricStatus, out *autoscaling.ObjectMetricStatus, s conversion.Scope) error { + out.Current = autoscaling.MetricValueStatus{ + Value: &in.CurrentValue, + AverageValue: in.AverageValue, + } + out.DescribedObject = autoscaling.CrossVersionObjectReference{ + Kind: in.Target.Kind, + Name: in.Target.Name, + APIVersion: in.Target.APIVersion, + } + out.Metric = autoscaling.MetricIdentifier{ + Name: in.MetricName, + Selector: in.Selector, + } + return nil +} + +func Convert_autoscaling_PodsMetricStatus_To_v2beta1_PodsMetricStatus(in *autoscaling.PodsMetricStatus, out *autoscalingv2beta1.PodsMetricStatus, s conversion.Scope) error { + if in.Current.AverageValue != nil { + out.CurrentAverageValue = *in.Current.AverageValue + } + out.MetricName = in.Metric.Name + out.Selector = in.Metric.Selector + return nil +} + +func Convert_v2beta1_PodsMetricStatus_To_autoscaling_PodsMetricStatus(in *autoscalingv2beta1.PodsMetricStatus, out *autoscaling.PodsMetricStatus, s conversion.Scope) error { + out.Current = autoscaling.MetricValueStatus{ + AverageValue: &in.CurrentAverageValue, + } + out.Metric = autoscaling.MetricIdentifier{ + Name: in.MetricName, + Selector: in.Selector, + } + return nil +} + +func Convert_v2beta1_HorizontalPodAutoscaler_To_autoscaling_HorizontalPodAutoscaler(in *autoscalingv2beta1.HorizontalPodAutoscaler, out *autoscaling.HorizontalPodAutoscaler, s conversion.Scope) error { + if err := autoConvert_v2beta1_HorizontalPodAutoscaler_To_autoscaling_HorizontalPodAutoscaler(in, out, s); err != nil { + return err + } + if selectorMetricsEnc, hasOtherMetrics := out.Annotations[autoscaling.MetricSpecsAnnotation]; hasOtherMetrics { + var selectorMetrics []autoscalingv2beta1.MetricSpec + if err := json.Unmarshal([]byte(selectorMetricsEnc), &selectorMetrics); err != nil { + return err + } + + convMetrics := make([]autoscaling.MetricSpec, len(selectorMetrics)) + for i, metric := range selectorMetrics { + if err := Convert_v2beta1_MetricSpec_To_autoscaling_MetricSpec(&metric, &convMetrics[i], s); err != nil { + return err + } + } + + outMetrics := make([]autoscaling.MetricSpec, 0, len(selectorMetrics)+len(out.Spec.Metrics)) + for _, convMetric := range convMetrics { + outMetrics = append(outMetrics, convMetric) + } + + for _, metric := range out.Spec.Metrics { + outMetrics = append(outMetrics, metric) + } + + out.Spec.Metrics = outMetrics + delete(out.Annotations, autoscaling.MetricSpecsAnnotation) + } + + if currentMetricsEnc, hasCurrentMetrics := out.Annotations[autoscaling.MetricStatusesAnnotation]; hasCurrentMetrics { + var currentMetrics []autoscalingv2beta1.MetricStatus + if err := json.Unmarshal([]byte(currentMetricsEnc), ¤tMetrics); err != nil { + return err + } + + outCurrentMetrics := make([]autoscaling.MetricStatus, 0, len(currentMetrics)+len(out.Status.CurrentMetrics)) + for i, currentMetric := range currentMetrics { + if err := Convert_v2beta1_MetricStatus_To_autoscaling_MetricStatus(¤tMetric, &out.Status.CurrentMetrics[i], s); err != nil { + return err + } + } + + for _, currentMetric := range out.Status.CurrentMetrics { + outCurrentMetrics = append(outCurrentMetrics, currentMetric) + } + + out.Status.CurrentMetrics = outCurrentMetrics + delete(out.Annotations, autoscaling.MetricStatusesAnnotation) + } + return nil +} + +func Convert_autoscaling_HorizontalPodAutoscaler_To_v2beta1_HorizontalPodAutoscaler(in *autoscaling.HorizontalPodAutoscaler, out *autoscalingv2beta1.HorizontalPodAutoscaler, s conversion.Scope) error { + if err := autoConvert_autoscaling_HorizontalPodAutoscaler_To_v2beta1_HorizontalPodAutoscaler(in, out, s); err != nil { + return err + } + + selectorMetrics := make([]autoscalingv2beta1.MetricSpec, 0, len(in.Spec.Metrics)) + for _, metric := range in.Spec.Metrics { + if (metric.Object != nil && metric.Object.Metric.Selector == nil) || + (metric.Pods != nil && metric.Pods.Metric.Selector == nil) || + (metric.External != nil && metric.External.Metric.Selector == nil) || + (metric.Resource != nil) { + continue + } + + convMetric := autoscalingv2beta1.MetricSpec{} + if err := Convert_autoscaling_MetricSpec_To_v2beta1_MetricSpec(&metric, &convMetric, s); err != nil { + return err + } + selectorMetrics = append(selectorMetrics, convMetric) + } + + currentMetrics := make([]autoscalingv2beta1.MetricStatus, 0, len(in.Status.CurrentMetrics)) + for _, currentMetric := range in.Status.CurrentMetrics { + if (currentMetric.Object != nil && currentMetric.Object.Metric.Selector == nil) || + (currentMetric.Pods != nil && currentMetric.Pods.Metric.Selector == nil) || + (currentMetric.External != nil && currentMetric.External.Metric.Selector == nil) || + (currentMetric.Resource != nil) { + continue + } + convMetric := autoscalingv2beta1.MetricStatus{} + if err := Convert_autoscaling_MetricStatus_To_v2beta1_MetricStatus(¤tMetric, &convMetric, s); err != nil { + return err + } + currentMetrics = append(currentMetrics, convMetric) + } + + if len(selectorMetrics) > 0 || len(currentMetrics) > 0 { + old := out.Annotations + out.Annotations = make(map[string]string, len(old)+2) + if old != nil { + for k, v := range old { + out.Annotations[k] = v + } + } + } + + if len(selectorMetrics) > 0 { + selectorMetricsEnc, err := json.Marshal(selectorMetrics) + if err != nil { + return err + } + out.Annotations[autoscaling.MetricSpecsAnnotation] = string(selectorMetricsEnc) + } + + if len(currentMetrics) > 0 { + currentMetricsEnc, err := json.Marshal(currentMetrics) + if err != nil { + return err + } + out.Annotations[autoscaling.MetricSpecsAnnotation] = string(currentMetricsEnc) + } + + return nil +} diff --git a/pkg/apis/autoscaling/v2beta1/register.go b/pkg/apis/autoscaling/v2beta1/register.go index b2433d34cf8..da80b2bef79 100644 --- a/pkg/apis/autoscaling/v2beta1/register.go +++ b/pkg/apis/autoscaling/v2beta1/register.go @@ -41,5 +41,5 @@ func init() { // We only register manually written functions here. The registration of the // generated functions takes place in the generated files. The separation // makes the code compile even when the generated files are missing. - localSchemeBuilder.Register(addDefaultingFuncs) + localSchemeBuilder.Register(addDefaultingFuncs, addConversionFuncs) } diff --git a/pkg/apis/autoscaling/v2beta1/zz_generated.conversion.go b/pkg/apis/autoscaling/v2beta1/zz_generated.conversion.go index 3714e264b9c..602e99e4e9c 100644 --- a/pkg/apis/autoscaling/v2beta1/zz_generated.conversion.go +++ b/pkg/apis/autoscaling/v2beta1/zz_generated.conversion.go @@ -24,9 +24,14 @@ import ( unsafe "unsafe" v2beta1 "k8s.io/api/autoscaling/v2beta1" +<<<<<<< HEAD corev1 "k8s.io/api/core/v1" resource "k8s.io/apimachinery/pkg/api/resource" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +======= + v1 "k8s.io/api/core/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +>>>>>>> Update autoscaling conversion and validation for v2beta2 inclusion conversion "k8s.io/apimachinery/pkg/conversion" runtime "k8s.io/apimachinery/pkg/runtime" autoscaling "k8s.io/kubernetes/pkg/apis/autoscaling" @@ -228,57 +233,33 @@ func Convert_autoscaling_CrossVersionObjectReference_To_v2beta1_CrossVersionObje } func autoConvert_v2beta1_ExternalMetricSource_To_autoscaling_ExternalMetricSource(in *v2beta1.ExternalMetricSource, out *autoscaling.ExternalMetricSource, s conversion.Scope) error { - out.MetricName = in.MetricName - out.MetricSelector = (*v1.LabelSelector)(unsafe.Pointer(in.MetricSelector)) - out.TargetValue = (*resource.Quantity)(unsafe.Pointer(in.TargetValue)) - out.TargetAverageValue = (*resource.Quantity)(unsafe.Pointer(in.TargetAverageValue)) + // WARNING: in.MetricName requires manual conversion: does not exist in peer-type + // WARNING: in.MetricSelector requires manual conversion: does not exist in peer-type + // WARNING: in.TargetValue requires manual conversion: does not exist in peer-type + // WARNING: in.TargetAverageValue requires manual conversion: does not exist in peer-type return nil } -// Convert_v2beta1_ExternalMetricSource_To_autoscaling_ExternalMetricSource is an autogenerated conversion function. -func Convert_v2beta1_ExternalMetricSource_To_autoscaling_ExternalMetricSource(in *v2beta1.ExternalMetricSource, out *autoscaling.ExternalMetricSource, s conversion.Scope) error { - return autoConvert_v2beta1_ExternalMetricSource_To_autoscaling_ExternalMetricSource(in, out, s) -} - func autoConvert_autoscaling_ExternalMetricSource_To_v2beta1_ExternalMetricSource(in *autoscaling.ExternalMetricSource, out *v2beta1.ExternalMetricSource, s conversion.Scope) error { - out.MetricName = in.MetricName - out.MetricSelector = (*v1.LabelSelector)(unsafe.Pointer(in.MetricSelector)) - out.TargetValue = (*resource.Quantity)(unsafe.Pointer(in.TargetValue)) - out.TargetAverageValue = (*resource.Quantity)(unsafe.Pointer(in.TargetAverageValue)) + // WARNING: in.Metric requires manual conversion: does not exist in peer-type + // WARNING: in.Target requires manual conversion: does not exist in peer-type return nil } -// Convert_autoscaling_ExternalMetricSource_To_v2beta1_ExternalMetricSource is an autogenerated conversion function. -func Convert_autoscaling_ExternalMetricSource_To_v2beta1_ExternalMetricSource(in *autoscaling.ExternalMetricSource, out *v2beta1.ExternalMetricSource, s conversion.Scope) error { - return autoConvert_autoscaling_ExternalMetricSource_To_v2beta1_ExternalMetricSource(in, out, s) -} - func autoConvert_v2beta1_ExternalMetricStatus_To_autoscaling_ExternalMetricStatus(in *v2beta1.ExternalMetricStatus, out *autoscaling.ExternalMetricStatus, s conversion.Scope) error { - out.MetricName = in.MetricName - out.MetricSelector = (*v1.LabelSelector)(unsafe.Pointer(in.MetricSelector)) - out.CurrentValue = in.CurrentValue - out.CurrentAverageValue = (*resource.Quantity)(unsafe.Pointer(in.CurrentAverageValue)) + // WARNING: in.MetricName requires manual conversion: does not exist in peer-type + // WARNING: in.MetricSelector requires manual conversion: does not exist in peer-type + // WARNING: in.CurrentValue requires manual conversion: does not exist in peer-type + // WARNING: in.CurrentAverageValue requires manual conversion: does not exist in peer-type return nil } -// Convert_v2beta1_ExternalMetricStatus_To_autoscaling_ExternalMetricStatus is an autogenerated conversion function. -func Convert_v2beta1_ExternalMetricStatus_To_autoscaling_ExternalMetricStatus(in *v2beta1.ExternalMetricStatus, out *autoscaling.ExternalMetricStatus, s conversion.Scope) error { - return autoConvert_v2beta1_ExternalMetricStatus_To_autoscaling_ExternalMetricStatus(in, out, s) -} - func autoConvert_autoscaling_ExternalMetricStatus_To_v2beta1_ExternalMetricStatus(in *autoscaling.ExternalMetricStatus, out *v2beta1.ExternalMetricStatus, s conversion.Scope) error { - out.MetricName = in.MetricName - out.MetricSelector = (*v1.LabelSelector)(unsafe.Pointer(in.MetricSelector)) - out.CurrentValue = in.CurrentValue - out.CurrentAverageValue = (*resource.Quantity)(unsafe.Pointer(in.CurrentAverageValue)) + // WARNING: in.Metric requires manual conversion: does not exist in peer-type + // WARNING: in.Current requires manual conversion: does not exist in peer-type return nil } -// Convert_autoscaling_ExternalMetricStatus_To_v2beta1_ExternalMetricStatus is an autogenerated conversion function. -func Convert_autoscaling_ExternalMetricStatus_To_v2beta1_ExternalMetricStatus(in *autoscaling.ExternalMetricStatus, out *v2beta1.ExternalMetricStatus, s conversion.Scope) error { - return autoConvert_autoscaling_ExternalMetricStatus_To_v2beta1_ExternalMetricStatus(in, out, s) -} - func autoConvert_v2beta1_HorizontalPodAutoscaler_To_autoscaling_HorizontalPodAutoscaler(in *v2beta1.HorizontalPodAutoscaler, out *autoscaling.HorizontalPodAutoscaler, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta if err := Convert_v2beta1_HorizontalPodAutoscalerSpec_To_autoscaling_HorizontalPodAutoscalerSpec(&in.Spec, &out.Spec, s); err != nil { @@ -290,11 +271,6 @@ func autoConvert_v2beta1_HorizontalPodAutoscaler_To_autoscaling_HorizontalPodAut return nil } -// Convert_v2beta1_HorizontalPodAutoscaler_To_autoscaling_HorizontalPodAutoscaler is an autogenerated conversion function. -func Convert_v2beta1_HorizontalPodAutoscaler_To_autoscaling_HorizontalPodAutoscaler(in *v2beta1.HorizontalPodAutoscaler, out *autoscaling.HorizontalPodAutoscaler, s conversion.Scope) error { - return autoConvert_v2beta1_HorizontalPodAutoscaler_To_autoscaling_HorizontalPodAutoscaler(in, out, s) -} - func autoConvert_autoscaling_HorizontalPodAutoscaler_To_v2beta1_HorizontalPodAutoscaler(in *autoscaling.HorizontalPodAutoscaler, out *v2beta1.HorizontalPodAutoscaler, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta if err := Convert_autoscaling_HorizontalPodAutoscalerSpec_To_v2beta1_HorizontalPodAutoscalerSpec(&in.Spec, &out.Spec, s); err != nil { @@ -306,11 +282,6 @@ func autoConvert_autoscaling_HorizontalPodAutoscaler_To_v2beta1_HorizontalPodAut return nil } -// Convert_autoscaling_HorizontalPodAutoscaler_To_v2beta1_HorizontalPodAutoscaler is an autogenerated conversion function. -func Convert_autoscaling_HorizontalPodAutoscaler_To_v2beta1_HorizontalPodAutoscaler(in *autoscaling.HorizontalPodAutoscaler, out *v2beta1.HorizontalPodAutoscaler, s conversion.Scope) error { - return autoConvert_autoscaling_HorizontalPodAutoscaler_To_v2beta1_HorizontalPodAutoscaler(in, out, s) -} - func autoConvert_v2beta1_HorizontalPodAutoscalerCondition_To_autoscaling_HorizontalPodAutoscalerCondition(in *v2beta1.HorizontalPodAutoscalerCondition, out *autoscaling.HorizontalPodAutoscalerCondition, s conversion.Scope) error { out.Type = autoscaling.HorizontalPodAutoscalerConditionType(in.Type) out.Status = autoscaling.ConditionStatus(in.Status) @@ -327,7 +298,11 @@ func Convert_v2beta1_HorizontalPodAutoscalerCondition_To_autoscaling_HorizontalP func autoConvert_autoscaling_HorizontalPodAutoscalerCondition_To_v2beta1_HorizontalPodAutoscalerCondition(in *autoscaling.HorizontalPodAutoscalerCondition, out *v2beta1.HorizontalPodAutoscalerCondition, s conversion.Scope) error { out.Type = v2beta1.HorizontalPodAutoscalerConditionType(in.Type) +<<<<<<< HEAD out.Status = corev1.ConditionStatus(in.Status) +======= + out.Status = v1.ConditionStatus(in.Status) +>>>>>>> Update autoscaling conversion and validation for v2beta2 inclusion out.LastTransitionTime = in.LastTransitionTime out.Reason = in.Reason out.Message = in.Message @@ -341,7 +316,17 @@ func Convert_autoscaling_HorizontalPodAutoscalerCondition_To_v2beta1_HorizontalP func autoConvert_v2beta1_HorizontalPodAutoscalerList_To_autoscaling_HorizontalPodAutoscalerList(in *v2beta1.HorizontalPodAutoscalerList, out *autoscaling.HorizontalPodAutoscalerList, s conversion.Scope) error { out.ListMeta = in.ListMeta - out.Items = *(*[]autoscaling.HorizontalPodAutoscaler)(unsafe.Pointer(&in.Items)) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]autoscaling.HorizontalPodAutoscaler, len(*in)) + for i := range *in { + if err := Convert_v2beta1_HorizontalPodAutoscaler_To_autoscaling_HorizontalPodAutoscaler(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } return nil } @@ -352,7 +337,17 @@ func Convert_v2beta1_HorizontalPodAutoscalerList_To_autoscaling_HorizontalPodAut func autoConvert_autoscaling_HorizontalPodAutoscalerList_To_v2beta1_HorizontalPodAutoscalerList(in *autoscaling.HorizontalPodAutoscalerList, out *v2beta1.HorizontalPodAutoscalerList, s conversion.Scope) error { out.ListMeta = in.ListMeta - out.Items = *(*[]v2beta1.HorizontalPodAutoscaler)(unsafe.Pointer(&in.Items)) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v2beta1.HorizontalPodAutoscaler, len(*in)) + for i := range *in { + if err := Convert_autoscaling_HorizontalPodAutoscaler_To_v2beta1_HorizontalPodAutoscaler(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } return nil } @@ -367,7 +362,17 @@ func autoConvert_v2beta1_HorizontalPodAutoscalerSpec_To_autoscaling_HorizontalPo } out.MinReplicas = (*int32)(unsafe.Pointer(in.MinReplicas)) out.MaxReplicas = in.MaxReplicas - out.Metrics = *(*[]autoscaling.MetricSpec)(unsafe.Pointer(&in.Metrics)) + if in.Metrics != nil { + in, out := &in.Metrics, &out.Metrics + *out = make([]autoscaling.MetricSpec, len(*in)) + for i := range *in { + if err := Convert_v2beta1_MetricSpec_To_autoscaling_MetricSpec(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Metrics = nil + } return nil } @@ -382,7 +387,17 @@ func autoConvert_autoscaling_HorizontalPodAutoscalerSpec_To_v2beta1_HorizontalPo } out.MinReplicas = (*int32)(unsafe.Pointer(in.MinReplicas)) out.MaxReplicas = in.MaxReplicas - out.Metrics = *(*[]v2beta1.MetricSpec)(unsafe.Pointer(&in.Metrics)) + if in.Metrics != nil { + in, out := &in.Metrics, &out.Metrics + *out = make([]v2beta1.MetricSpec, len(*in)) + for i := range *in { + if err := Convert_autoscaling_MetricSpec_To_v2beta1_MetricSpec(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Metrics = nil + } return nil } @@ -393,10 +408,20 @@ func Convert_autoscaling_HorizontalPodAutoscalerSpec_To_v2beta1_HorizontalPodAut func autoConvert_v2beta1_HorizontalPodAutoscalerStatus_To_autoscaling_HorizontalPodAutoscalerStatus(in *v2beta1.HorizontalPodAutoscalerStatus, out *autoscaling.HorizontalPodAutoscalerStatus, s conversion.Scope) error { out.ObservedGeneration = (*int64)(unsafe.Pointer(in.ObservedGeneration)) - out.LastScaleTime = (*v1.Time)(unsafe.Pointer(in.LastScaleTime)) + out.LastScaleTime = (*meta_v1.Time)(unsafe.Pointer(in.LastScaleTime)) out.CurrentReplicas = in.CurrentReplicas out.DesiredReplicas = in.DesiredReplicas - out.CurrentMetrics = *(*[]autoscaling.MetricStatus)(unsafe.Pointer(&in.CurrentMetrics)) + if in.CurrentMetrics != nil { + in, out := &in.CurrentMetrics, &out.CurrentMetrics + *out = make([]autoscaling.MetricStatus, len(*in)) + for i := range *in { + if err := Convert_v2beta1_MetricStatus_To_autoscaling_MetricStatus(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.CurrentMetrics = nil + } out.Conditions = *(*[]autoscaling.HorizontalPodAutoscalerCondition)(unsafe.Pointer(&in.Conditions)) return nil } @@ -408,10 +433,20 @@ func Convert_v2beta1_HorizontalPodAutoscalerStatus_To_autoscaling_HorizontalPodA func autoConvert_autoscaling_HorizontalPodAutoscalerStatus_To_v2beta1_HorizontalPodAutoscalerStatus(in *autoscaling.HorizontalPodAutoscalerStatus, out *v2beta1.HorizontalPodAutoscalerStatus, s conversion.Scope) error { out.ObservedGeneration = (*int64)(unsafe.Pointer(in.ObservedGeneration)) - out.LastScaleTime = (*v1.Time)(unsafe.Pointer(in.LastScaleTime)) + out.LastScaleTime = (*meta_v1.Time)(unsafe.Pointer(in.LastScaleTime)) out.CurrentReplicas = in.CurrentReplicas out.DesiredReplicas = in.DesiredReplicas - out.CurrentMetrics = *(*[]v2beta1.MetricStatus)(unsafe.Pointer(&in.CurrentMetrics)) + if in.CurrentMetrics != nil { + in, out := &in.CurrentMetrics, &out.CurrentMetrics + *out = make([]v2beta1.MetricStatus, len(*in)) + for i := range *in { + if err := Convert_autoscaling_MetricStatus_To_v2beta1_MetricStatus(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.CurrentMetrics = nil + } out.Conditions = *(*[]v2beta1.HorizontalPodAutoscalerCondition)(unsafe.Pointer(&in.Conditions)) return nil } @@ -423,10 +458,42 @@ func Convert_autoscaling_HorizontalPodAutoscalerStatus_To_v2beta1_HorizontalPodA func autoConvert_v2beta1_MetricSpec_To_autoscaling_MetricSpec(in *v2beta1.MetricSpec, out *autoscaling.MetricSpec, s conversion.Scope) error { out.Type = autoscaling.MetricSourceType(in.Type) - out.Object = (*autoscaling.ObjectMetricSource)(unsafe.Pointer(in.Object)) - out.Pods = (*autoscaling.PodsMetricSource)(unsafe.Pointer(in.Pods)) - out.Resource = (*autoscaling.ResourceMetricSource)(unsafe.Pointer(in.Resource)) - out.External = (*autoscaling.ExternalMetricSource)(unsafe.Pointer(in.External)) + if in.Object != nil { + in, out := &in.Object, &out.Object + *out = new(autoscaling.ObjectMetricSource) + if err := Convert_v2beta1_ObjectMetricSource_To_autoscaling_ObjectMetricSource(*in, *out, s); err != nil { + return err + } + } else { + out.Object = nil + } + if in.Pods != nil { + in, out := &in.Pods, &out.Pods + *out = new(autoscaling.PodsMetricSource) + if err := Convert_v2beta1_PodsMetricSource_To_autoscaling_PodsMetricSource(*in, *out, s); err != nil { + return err + } + } else { + out.Pods = nil + } + if in.Resource != nil { + in, out := &in.Resource, &out.Resource + *out = new(autoscaling.ResourceMetricSource) + if err := Convert_v2beta1_ResourceMetricSource_To_autoscaling_ResourceMetricSource(*in, *out, s); err != nil { + return err + } + } else { + out.Resource = nil + } + if in.External != nil { + in, out := &in.External, &out.External + *out = new(autoscaling.ExternalMetricSource) + if err := Convert_v2beta1_ExternalMetricSource_To_autoscaling_ExternalMetricSource(*in, *out, s); err != nil { + return err + } + } else { + out.External = nil + } return nil } @@ -437,10 +504,42 @@ func Convert_v2beta1_MetricSpec_To_autoscaling_MetricSpec(in *v2beta1.MetricSpec func autoConvert_autoscaling_MetricSpec_To_v2beta1_MetricSpec(in *autoscaling.MetricSpec, out *v2beta1.MetricSpec, s conversion.Scope) error { out.Type = v2beta1.MetricSourceType(in.Type) - out.Object = (*v2beta1.ObjectMetricSource)(unsafe.Pointer(in.Object)) - out.Pods = (*v2beta1.PodsMetricSource)(unsafe.Pointer(in.Pods)) - out.Resource = (*v2beta1.ResourceMetricSource)(unsafe.Pointer(in.Resource)) - out.External = (*v2beta1.ExternalMetricSource)(unsafe.Pointer(in.External)) + if in.Object != nil { + in, out := &in.Object, &out.Object + *out = new(v2beta1.ObjectMetricSource) + if err := Convert_autoscaling_ObjectMetricSource_To_v2beta1_ObjectMetricSource(*in, *out, s); err != nil { + return err + } + } else { + out.Object = nil + } + if in.Pods != nil { + in, out := &in.Pods, &out.Pods + *out = new(v2beta1.PodsMetricSource) + if err := Convert_autoscaling_PodsMetricSource_To_v2beta1_PodsMetricSource(*in, *out, s); err != nil { + return err + } + } else { + out.Pods = nil + } + if in.Resource != nil { + in, out := &in.Resource, &out.Resource + *out = new(v2beta1.ResourceMetricSource) + if err := Convert_autoscaling_ResourceMetricSource_To_v2beta1_ResourceMetricSource(*in, *out, s); err != nil { + return err + } + } else { + out.Resource = nil + } + if in.External != nil { + in, out := &in.External, &out.External + *out = new(v2beta1.ExternalMetricSource) + if err := Convert_autoscaling_ExternalMetricSource_To_v2beta1_ExternalMetricSource(*in, *out, s); err != nil { + return err + } + } else { + out.External = nil + } return nil } @@ -451,10 +550,42 @@ func Convert_autoscaling_MetricSpec_To_v2beta1_MetricSpec(in *autoscaling.Metric func autoConvert_v2beta1_MetricStatus_To_autoscaling_MetricStatus(in *v2beta1.MetricStatus, out *autoscaling.MetricStatus, s conversion.Scope) error { out.Type = autoscaling.MetricSourceType(in.Type) - out.Object = (*autoscaling.ObjectMetricStatus)(unsafe.Pointer(in.Object)) - out.Pods = (*autoscaling.PodsMetricStatus)(unsafe.Pointer(in.Pods)) - out.Resource = (*autoscaling.ResourceMetricStatus)(unsafe.Pointer(in.Resource)) - out.External = (*autoscaling.ExternalMetricStatus)(unsafe.Pointer(in.External)) + if in.Object != nil { + in, out := &in.Object, &out.Object + *out = new(autoscaling.ObjectMetricStatus) + if err := Convert_v2beta1_ObjectMetricStatus_To_autoscaling_ObjectMetricStatus(*in, *out, s); err != nil { + return err + } + } else { + out.Object = nil + } + if in.Pods != nil { + in, out := &in.Pods, &out.Pods + *out = new(autoscaling.PodsMetricStatus) + if err := Convert_v2beta1_PodsMetricStatus_To_autoscaling_PodsMetricStatus(*in, *out, s); err != nil { + return err + } + } else { + out.Pods = nil + } + if in.Resource != nil { + in, out := &in.Resource, &out.Resource + *out = new(autoscaling.ResourceMetricStatus) + if err := Convert_v2beta1_ResourceMetricStatus_To_autoscaling_ResourceMetricStatus(*in, *out, s); err != nil { + return err + } + } else { + out.Resource = nil + } + if in.External != nil { + in, out := &in.External, &out.External + *out = new(autoscaling.ExternalMetricStatus) + if err := Convert_v2beta1_ExternalMetricStatus_To_autoscaling_ExternalMetricStatus(*in, *out, s); err != nil { + return err + } + } else { + out.External = nil + } return nil } @@ -465,10 +596,42 @@ func Convert_v2beta1_MetricStatus_To_autoscaling_MetricStatus(in *v2beta1.Metric func autoConvert_autoscaling_MetricStatus_To_v2beta1_MetricStatus(in *autoscaling.MetricStatus, out *v2beta1.MetricStatus, s conversion.Scope) error { out.Type = v2beta1.MetricSourceType(in.Type) - out.Object = (*v2beta1.ObjectMetricStatus)(unsafe.Pointer(in.Object)) - out.Pods = (*v2beta1.PodsMetricStatus)(unsafe.Pointer(in.Pods)) - out.Resource = (*v2beta1.ResourceMetricStatus)(unsafe.Pointer(in.Resource)) - out.External = (*v2beta1.ExternalMetricStatus)(unsafe.Pointer(in.External)) + if in.Object != nil { + in, out := &in.Object, &out.Object + *out = new(v2beta1.ObjectMetricStatus) + if err := Convert_autoscaling_ObjectMetricStatus_To_v2beta1_ObjectMetricStatus(*in, *out, s); err != nil { + return err + } + } else { + out.Object = nil + } + if in.Pods != nil { + in, out := &in.Pods, &out.Pods + *out = new(v2beta1.PodsMetricStatus) + if err := Convert_autoscaling_PodsMetricStatus_To_v2beta1_PodsMetricStatus(*in, *out, s); err != nil { + return err + } + } else { + out.Pods = nil + } + if in.Resource != nil { + in, out := &in.Resource, &out.Resource + *out = new(v2beta1.ResourceMetricStatus) + if err := Convert_autoscaling_ResourceMetricStatus_To_v2beta1_ResourceMetricStatus(*in, *out, s); err != nil { + return err + } + } else { + out.Resource = nil + } + if in.External != nil { + in, out := &in.External, &out.External + *out = new(v2beta1.ExternalMetricStatus) + if err := Convert_autoscaling_ExternalMetricStatus_To_v2beta1_ExternalMetricStatus(*in, *out, s); err != nil { + return err + } + } else { + out.External = nil + } return nil } @@ -478,149 +641,103 @@ func Convert_autoscaling_MetricStatus_To_v2beta1_MetricStatus(in *autoscaling.Me } func autoConvert_v2beta1_ObjectMetricSource_To_autoscaling_ObjectMetricSource(in *v2beta1.ObjectMetricSource, out *autoscaling.ObjectMetricSource, s conversion.Scope) error { - if err := Convert_v2beta1_CrossVersionObjectReference_To_autoscaling_CrossVersionObjectReference(&in.Target, &out.Target, s); err != nil { + if err := Convert_v2beta1_CrossVersionObjectReference_To_autoscaling_MetricTarget(&in.Target, &out.Target, s); err != nil { return err } - out.MetricName = in.MetricName - out.TargetValue = in.TargetValue + // WARNING: in.MetricName requires manual conversion: does not exist in peer-type + // WARNING: in.TargetValue requires manual conversion: does not exist in peer-type + // WARNING: in.Selector requires manual conversion: does not exist in peer-type + // WARNING: in.AverageValue requires manual conversion: does not exist in peer-type return nil } -// Convert_v2beta1_ObjectMetricSource_To_autoscaling_ObjectMetricSource is an autogenerated conversion function. -func Convert_v2beta1_ObjectMetricSource_To_autoscaling_ObjectMetricSource(in *v2beta1.ObjectMetricSource, out *autoscaling.ObjectMetricSource, s conversion.Scope) error { - return autoConvert_v2beta1_ObjectMetricSource_To_autoscaling_ObjectMetricSource(in, out, s) -} - func autoConvert_autoscaling_ObjectMetricSource_To_v2beta1_ObjectMetricSource(in *autoscaling.ObjectMetricSource, out *v2beta1.ObjectMetricSource, s conversion.Scope) error { - if err := Convert_autoscaling_CrossVersionObjectReference_To_v2beta1_CrossVersionObjectReference(&in.Target, &out.Target, s); err != nil { + // WARNING: in.DescribedObject requires manual conversion: does not exist in peer-type + if err := Convert_autoscaling_MetricTarget_To_v2beta1_CrossVersionObjectReference(&in.Target, &out.Target, s); err != nil { return err } - out.MetricName = in.MetricName - out.TargetValue = in.TargetValue + // WARNING: in.Metric requires manual conversion: does not exist in peer-type return nil } -// Convert_autoscaling_ObjectMetricSource_To_v2beta1_ObjectMetricSource is an autogenerated conversion function. -func Convert_autoscaling_ObjectMetricSource_To_v2beta1_ObjectMetricSource(in *autoscaling.ObjectMetricSource, out *v2beta1.ObjectMetricSource, s conversion.Scope) error { - return autoConvert_autoscaling_ObjectMetricSource_To_v2beta1_ObjectMetricSource(in, out, s) -} - func autoConvert_v2beta1_ObjectMetricStatus_To_autoscaling_ObjectMetricStatus(in *v2beta1.ObjectMetricStatus, out *autoscaling.ObjectMetricStatus, s conversion.Scope) error { - if err := Convert_v2beta1_CrossVersionObjectReference_To_autoscaling_CrossVersionObjectReference(&in.Target, &out.Target, s); err != nil { - return err - } - out.MetricName = in.MetricName - out.CurrentValue = in.CurrentValue + // WARNING: in.Target requires manual conversion: does not exist in peer-type + // WARNING: in.MetricName requires manual conversion: does not exist in peer-type + // WARNING: in.CurrentValue requires manual conversion: does not exist in peer-type + // WARNING: in.Selector requires manual conversion: does not exist in peer-type + // WARNING: in.AverageValue requires manual conversion: does not exist in peer-type return nil } -// Convert_v2beta1_ObjectMetricStatus_To_autoscaling_ObjectMetricStatus is an autogenerated conversion function. -func Convert_v2beta1_ObjectMetricStatus_To_autoscaling_ObjectMetricStatus(in *v2beta1.ObjectMetricStatus, out *autoscaling.ObjectMetricStatus, s conversion.Scope) error { - return autoConvert_v2beta1_ObjectMetricStatus_To_autoscaling_ObjectMetricStatus(in, out, s) -} - func autoConvert_autoscaling_ObjectMetricStatus_To_v2beta1_ObjectMetricStatus(in *autoscaling.ObjectMetricStatus, out *v2beta1.ObjectMetricStatus, s conversion.Scope) error { - if err := Convert_autoscaling_CrossVersionObjectReference_To_v2beta1_CrossVersionObjectReference(&in.Target, &out.Target, s); err != nil { - return err - } - out.MetricName = in.MetricName - out.CurrentValue = in.CurrentValue + // WARNING: in.Metric requires manual conversion: does not exist in peer-type + // WARNING: in.Current requires manual conversion: does not exist in peer-type + // WARNING: in.DescribedObject requires manual conversion: does not exist in peer-type return nil } -// Convert_autoscaling_ObjectMetricStatus_To_v2beta1_ObjectMetricStatus is an autogenerated conversion function. -func Convert_autoscaling_ObjectMetricStatus_To_v2beta1_ObjectMetricStatus(in *autoscaling.ObjectMetricStatus, out *v2beta1.ObjectMetricStatus, s conversion.Scope) error { - return autoConvert_autoscaling_ObjectMetricStatus_To_v2beta1_ObjectMetricStatus(in, out, s) -} - func autoConvert_v2beta1_PodsMetricSource_To_autoscaling_PodsMetricSource(in *v2beta1.PodsMetricSource, out *autoscaling.PodsMetricSource, s conversion.Scope) error { - out.MetricName = in.MetricName - out.TargetAverageValue = in.TargetAverageValue + // WARNING: in.MetricName requires manual conversion: does not exist in peer-type + // WARNING: in.TargetAverageValue requires manual conversion: does not exist in peer-type + // WARNING: in.Selector requires manual conversion: does not exist in peer-type + // WARNING: in.Value requires manual conversion: does not exist in peer-type return nil } -// Convert_v2beta1_PodsMetricSource_To_autoscaling_PodsMetricSource is an autogenerated conversion function. -func Convert_v2beta1_PodsMetricSource_To_autoscaling_PodsMetricSource(in *v2beta1.PodsMetricSource, out *autoscaling.PodsMetricSource, s conversion.Scope) error { - return autoConvert_v2beta1_PodsMetricSource_To_autoscaling_PodsMetricSource(in, out, s) -} - func autoConvert_autoscaling_PodsMetricSource_To_v2beta1_PodsMetricSource(in *autoscaling.PodsMetricSource, out *v2beta1.PodsMetricSource, s conversion.Scope) error { - out.MetricName = in.MetricName - out.TargetAverageValue = in.TargetAverageValue + // WARNING: in.Metric requires manual conversion: does not exist in peer-type + // WARNING: in.Target requires manual conversion: does not exist in peer-type return nil } -// Convert_autoscaling_PodsMetricSource_To_v2beta1_PodsMetricSource is an autogenerated conversion function. -func Convert_autoscaling_PodsMetricSource_To_v2beta1_PodsMetricSource(in *autoscaling.PodsMetricSource, out *v2beta1.PodsMetricSource, s conversion.Scope) error { - return autoConvert_autoscaling_PodsMetricSource_To_v2beta1_PodsMetricSource(in, out, s) -} - func autoConvert_v2beta1_PodsMetricStatus_To_autoscaling_PodsMetricStatus(in *v2beta1.PodsMetricStatus, out *autoscaling.PodsMetricStatus, s conversion.Scope) error { - out.MetricName = in.MetricName - out.CurrentAverageValue = in.CurrentAverageValue + // WARNING: in.MetricName requires manual conversion: does not exist in peer-type + // WARNING: in.CurrentAverageValue requires manual conversion: does not exist in peer-type + // WARNING: in.Selector requires manual conversion: does not exist in peer-type + // WARNING: in.Value requires manual conversion: does not exist in peer-type return nil } -// Convert_v2beta1_PodsMetricStatus_To_autoscaling_PodsMetricStatus is an autogenerated conversion function. -func Convert_v2beta1_PodsMetricStatus_To_autoscaling_PodsMetricStatus(in *v2beta1.PodsMetricStatus, out *autoscaling.PodsMetricStatus, s conversion.Scope) error { - return autoConvert_v2beta1_PodsMetricStatus_To_autoscaling_PodsMetricStatus(in, out, s) -} - func autoConvert_autoscaling_PodsMetricStatus_To_v2beta1_PodsMetricStatus(in *autoscaling.PodsMetricStatus, out *v2beta1.PodsMetricStatus, s conversion.Scope) error { - out.MetricName = in.MetricName - out.CurrentAverageValue = in.CurrentAverageValue + // WARNING: in.Metric requires manual conversion: does not exist in peer-type + // WARNING: in.Current requires manual conversion: does not exist in peer-type return nil } -// Convert_autoscaling_PodsMetricStatus_To_v2beta1_PodsMetricStatus is an autogenerated conversion function. -func Convert_autoscaling_PodsMetricStatus_To_v2beta1_PodsMetricStatus(in *autoscaling.PodsMetricStatus, out *v2beta1.PodsMetricStatus, s conversion.Scope) error { - return autoConvert_autoscaling_PodsMetricStatus_To_v2beta1_PodsMetricStatus(in, out, s) -} - func autoConvert_v2beta1_ResourceMetricSource_To_autoscaling_ResourceMetricSource(in *v2beta1.ResourceMetricSource, out *autoscaling.ResourceMetricSource, s conversion.Scope) error { out.Name = core.ResourceName(in.Name) - out.TargetAverageUtilization = (*int32)(unsafe.Pointer(in.TargetAverageUtilization)) - out.TargetAverageValue = (*resource.Quantity)(unsafe.Pointer(in.TargetAverageValue)) + // WARNING: in.TargetAverageUtilization requires manual conversion: does not exist in peer-type + // WARNING: in.TargetAverageValue requires manual conversion: does not exist in peer-type return nil } -// Convert_v2beta1_ResourceMetricSource_To_autoscaling_ResourceMetricSource is an autogenerated conversion function. -func Convert_v2beta1_ResourceMetricSource_To_autoscaling_ResourceMetricSource(in *v2beta1.ResourceMetricSource, out *autoscaling.ResourceMetricSource, s conversion.Scope) error { - return autoConvert_v2beta1_ResourceMetricSource_To_autoscaling_ResourceMetricSource(in, out, s) -} - func autoConvert_autoscaling_ResourceMetricSource_To_v2beta1_ResourceMetricSource(in *autoscaling.ResourceMetricSource, out *v2beta1.ResourceMetricSource, s conversion.Scope) error { +<<<<<<< HEAD out.Name = corev1.ResourceName(in.Name) out.TargetAverageUtilization = (*int32)(unsafe.Pointer(in.TargetAverageUtilization)) out.TargetAverageValue = (*resource.Quantity)(unsafe.Pointer(in.TargetAverageValue)) +======= + out.Name = v1.ResourceName(in.Name) + // WARNING: in.Target requires manual conversion: does not exist in peer-type +>>>>>>> Update autoscaling conversion and validation for v2beta2 inclusion return nil } -// Convert_autoscaling_ResourceMetricSource_To_v2beta1_ResourceMetricSource is an autogenerated conversion function. -func Convert_autoscaling_ResourceMetricSource_To_v2beta1_ResourceMetricSource(in *autoscaling.ResourceMetricSource, out *v2beta1.ResourceMetricSource, s conversion.Scope) error { - return autoConvert_autoscaling_ResourceMetricSource_To_v2beta1_ResourceMetricSource(in, out, s) -} - func autoConvert_v2beta1_ResourceMetricStatus_To_autoscaling_ResourceMetricStatus(in *v2beta1.ResourceMetricStatus, out *autoscaling.ResourceMetricStatus, s conversion.Scope) error { out.Name = core.ResourceName(in.Name) - out.CurrentAverageUtilization = (*int32)(unsafe.Pointer(in.CurrentAverageUtilization)) - out.CurrentAverageValue = in.CurrentAverageValue + // WARNING: in.CurrentAverageUtilization requires manual conversion: does not exist in peer-type + // WARNING: in.CurrentAverageValue requires manual conversion: does not exist in peer-type return nil } -// Convert_v2beta1_ResourceMetricStatus_To_autoscaling_ResourceMetricStatus is an autogenerated conversion function. -func Convert_v2beta1_ResourceMetricStatus_To_autoscaling_ResourceMetricStatus(in *v2beta1.ResourceMetricStatus, out *autoscaling.ResourceMetricStatus, s conversion.Scope) error { - return autoConvert_v2beta1_ResourceMetricStatus_To_autoscaling_ResourceMetricStatus(in, out, s) -} - func autoConvert_autoscaling_ResourceMetricStatus_To_v2beta1_ResourceMetricStatus(in *autoscaling.ResourceMetricStatus, out *v2beta1.ResourceMetricStatus, s conversion.Scope) error { +<<<<<<< HEAD out.Name = corev1.ResourceName(in.Name) out.CurrentAverageUtilization = (*int32)(unsafe.Pointer(in.CurrentAverageUtilization)) out.CurrentAverageValue = in.CurrentAverageValue +======= + out.Name = v1.ResourceName(in.Name) + // WARNING: in.Current requires manual conversion: does not exist in peer-type +>>>>>>> Update autoscaling conversion and validation for v2beta2 inclusion return nil } - -// Convert_autoscaling_ResourceMetricStatus_To_v2beta1_ResourceMetricStatus is an autogenerated conversion function. -func Convert_autoscaling_ResourceMetricStatus_To_v2beta1_ResourceMetricStatus(in *autoscaling.ResourceMetricStatus, out *v2beta1.ResourceMetricStatus, s conversion.Scope) error { - return autoConvert_autoscaling_ResourceMetricStatus_To_v2beta1_ResourceMetricStatus(in, out, s) -} diff --git a/pkg/apis/autoscaling/validation/validation.go b/pkg/apis/autoscaling/validation/validation.go index 2257800faf0..09e8f2b7174 100644 --- a/pkg/apis/autoscaling/validation/validation.go +++ b/pkg/apis/autoscaling/validation/validation.go @@ -178,14 +178,16 @@ func validateMetricSpec(spec autoscaling.MetricSpec, fldPath *field.Path) field. func validateObjectSource(src *autoscaling.ObjectMetricSource, fldPath *field.Path) field.ErrorList { allErrs := field.ErrorList{} - allErrs = append(allErrs, ValidateCrossVersionObjectReference(src.Target, fldPath.Child("target"))...) - - if len(src.MetricName) == 0 { - allErrs = append(allErrs, field.Required(fldPath.Child("metricName"), "must specify a metric name")) + allErrs = append(allErrs, ValidateCrossVersionObjectReference(src.DescribedObject, fldPath.Child("describedObject"))...) + allErrs = append(allErrs, validateMetricIdentifier(src.Metric, fldPath.Child("metric"))...) + if &src.Target == nil { + allErrs = append(allErrs, field.Required(fldPath.Child("target"), "must specify a metric target")) + } else { + allErrs = append(allErrs, validateMetricTarget(src.Target, fldPath.Child("target"))...) } - if src.TargetValue.Sign() != 1 { - allErrs = append(allErrs, field.Required(fldPath.Child("targetValue"), "must specify a positive target value")) + if src.Target.Value == nil && src.Target.AverageValue == nil { + allErrs = append(allErrs, field.Required(fldPath.Child("target").Child("averageValue"), "must set either a target value or averageValue")) } return allErrs @@ -194,28 +196,19 @@ func validateObjectSource(src *autoscaling.ObjectMetricSource, fldPath *field.Pa func validateExternalSource(src *autoscaling.ExternalMetricSource, fldPath *field.Path) field.ErrorList { allErrs := field.ErrorList{} - if len(src.MetricName) == 0 { - allErrs = append(allErrs, field.Required(fldPath.Child("metricName"), "must specify a metric name")) + allErrs = append(allErrs, validateMetricIdentifier(src.Metric, fldPath.Child("metric"))...) + if &src.Target == nil { + allErrs = append(allErrs, field.Required(fldPath.Child("target"), "must specify a metric target")) } else { - for _, msg := range pathvalidation.IsValidPathSegmentName(src.MetricName) { - allErrs = append(allErrs, field.Invalid(fldPath.Child("metricName"), src.MetricName, msg)) - } + allErrs = append(allErrs, validateMetricTarget(src.Target, fldPath.Child("target"))...) } - if src.TargetValue == nil && src.TargetAverageValue == nil { - allErrs = append(allErrs, field.Required(fldPath.Child("targetValue"), "must set either a target value for metric or a per-pod target")) + if src.Target.Value == nil && src.Target.AverageValue == nil { + allErrs = append(allErrs, field.Required(fldPath.Child("target").Child("averageValue"), "must set either a target value for metric or a per-pod target")) } - if src.TargetValue != nil && src.TargetAverageValue != nil { - allErrs = append(allErrs, field.Forbidden(fldPath.Child("targetValue"), "may not set both a target value for metric and a per-pod target")) - } - - if src.TargetAverageValue != nil && src.TargetAverageValue.Sign() != 1 { - allErrs = append(allErrs, field.Invalid(fldPath.Child("targetAverageValue"), src.TargetAverageValue, "must be positive")) - } - - if src.TargetValue != nil && src.TargetValue.Sign() != 1 { - allErrs = append(allErrs, field.Invalid(fldPath.Child("targetValue"), src.TargetValue, "must be positive")) + if src.Target.Value != nil && src.Target.AverageValue != nil { + allErrs = append(allErrs, field.Forbidden(fldPath.Child("target").Child("value"), "may not set both a target value for metric and a per-pod target")) } return allErrs @@ -224,12 +217,15 @@ func validateExternalSource(src *autoscaling.ExternalMetricSource, fldPath *fiel func validatePodsSource(src *autoscaling.PodsMetricSource, fldPath *field.Path) field.ErrorList { allErrs := field.ErrorList{} - if len(src.MetricName) == 0 { - allErrs = append(allErrs, field.Required(fldPath.Child("metricName"), "must specify a metric name")) + allErrs = append(allErrs, validateMetricIdentifier(src.Metric, fldPath.Child("metric"))...) + if &src.Target == nil { + allErrs = append(allErrs, field.Required(fldPath.Child("target"), "must specify a metric target")) + } else { + allErrs = append(allErrs, validateMetricTarget(src.Target, fldPath.Child("target"))...) } - if src.TargetAverageValue.Sign() != 1 { - allErrs = append(allErrs, field.Required(fldPath.Child("targetAverageValue"), "must specify a positive target value")) + if src.Target.AverageValue == nil { + allErrs = append(allErrs, field.Required(fldPath.Child("target").Child("averageValue"), "must specify a positive target averageValue")) } return allErrs @@ -241,22 +237,60 @@ func validateResourceSource(src *autoscaling.ResourceMetricSource, fldPath *fiel if len(src.Name) == 0 { allErrs = append(allErrs, field.Required(fldPath.Child("name"), "must specify a resource name")) } - - if src.TargetAverageUtilization == nil && src.TargetAverageValue == nil { - allErrs = append(allErrs, field.Required(fldPath.Child("targetAverageUtilization"), "must set either a target raw value or a target utilization")) + if &src.Target == nil { + allErrs = append(allErrs, field.Required(fldPath.Child("target"), "must specify a metric target")) + } else { + allErrs = append(allErrs, validateMetricTarget(src.Target, fldPath.Child("target"))...) } - if src.TargetAverageUtilization != nil && *src.TargetAverageUtilization < 1 { - allErrs = append(allErrs, field.Invalid(fldPath.Child("targetAverageUtilization"), src.TargetAverageUtilization, "must be greater than 0")) + if src.Target.AverageUtilization == nil && src.Target.AverageValue == nil { + allErrs = append(allErrs, field.Required(fldPath.Child("target").Child("averageUtilization"), "must set either a target raw value or a target utilization")) } - if src.TargetAverageUtilization != nil && src.TargetAverageValue != nil { - allErrs = append(allErrs, field.Forbidden(fldPath.Child("targetAverageValue"), "may not set both a target raw value and a target utilization")) - } - - if src.TargetAverageValue != nil && src.TargetAverageValue.Sign() != 1 { - allErrs = append(allErrs, field.Invalid(fldPath.Child("targetAverageValue"), src.TargetAverageValue, "must be positive")) + if src.Target.AverageUtilization != nil && src.Target.AverageValue != nil { + allErrs = append(allErrs, field.Forbidden(fldPath.Child("target").Child("averageValue"), "may not set both a target raw value and a target utilization")) } return allErrs } + +func validateMetricTarget(mt autoscaling.MetricTarget, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + + if len(mt.Type) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("type"), "must specify a metric target type")) + } + + if mt.Type != autoscaling.UtilizationMetricType && + mt.Type != autoscaling.ValueMetricType && + mt.Type != autoscaling.AverageValueMetricType { + allErrs = append(allErrs, field.Invalid(fldPath.Child("type"), mt.Type, "must be either Utilization, Value, or AverageValue")) + } + + if mt.Value != nil && mt.Value.Sign() != 1 { + allErrs = append(allErrs, field.Invalid(fldPath.Child("value"), mt.Value, "must be positive")) + } + + if mt.AverageValue != nil && mt.AverageValue.Sign() != 1 { + allErrs = append(allErrs, field.Invalid(fldPath.Child("averageValue"), mt.AverageValue, "must be positive")) + } + + if mt.AverageUtilization != nil && *mt.AverageUtilization < 1 { + allErrs = append(allErrs, field.Invalid(fldPath.Child("averageUtilization"), mt.AverageUtilization, "must be greater than 0")) + } + + return allErrs +} + +func validateMetricIdentifier(id autoscaling.MetricIdentifier, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + + if len(id.Name) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Child("name"), "must specify a metric name")) + } else { + for _, msg := range pathvalidation.IsValidPathSegmentName(id.Name) { + allErrs = append(allErrs, field.Invalid(fldPath.Child("name"), id.Name, msg)) + } + } + return allErrs +} diff --git a/pkg/apis/autoscaling/validation/validation_test.go b/pkg/apis/autoscaling/validation/validation_test.go index 7c7a4250d31..deb952ba6bc 100644 --- a/pkg/apis/autoscaling/validation/validation_test.go +++ b/pkg/apis/autoscaling/validation/validation_test.go @@ -92,6 +92,10 @@ func TestValidateScale(t *testing.T) { } func TestValidateHorizontalPodAutoscaler(t *testing.T) { + metricLabelSelector, err := metav1.ParseToLabelSelector("label=value") + if err != nil { + t.Errorf("unable to parse label selector: %v", err) + } successCases := []autoscaling.HorizontalPodAutoscaler{ { ObjectMeta: metav1.ObjectMeta{ @@ -110,7 +114,10 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { Type: autoscaling.ResourceMetricSourceType, Resource: &autoscaling.ResourceMetricSource{ Name: api.ResourceCPU, - TargetAverageUtilization: utilpointer.Int32Ptr(70), + Target: autoscaling.MetricTarget{ + Type: autoscaling.UtilizationMetricType, + AverageUtilization: utilpointer.Int32Ptr(70), + }, }, }, }, @@ -146,8 +153,11 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { { Type: autoscaling.ResourceMetricSourceType, Resource: &autoscaling.ResourceMetricSource{ - Name: api.ResourceCPU, - TargetAverageValue: resource.NewMilliQuantity(300, resource.DecimalSI), + Name: api.ResourceCPU, + Target: autoscaling.MetricTarget{ + Type: autoscaling.AverageValueMetricType, + AverageValue: resource.NewMilliQuantity(300, resource.DecimalSI), + }, }, }, }, @@ -169,8 +179,13 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { { Type: autoscaling.PodsMetricSourceType, Pods: &autoscaling.PodsMetricSource{ - MetricName: "somemetric", - TargetAverageValue: *resource.NewMilliQuantity(300, resource.DecimalSI), + Metric: autoscaling.MetricIdentifier{ + Name: "somemetric", + }, + Target: autoscaling.MetricTarget{ + Type: autoscaling.AverageValueMetricType, + AverageValue: resource.NewMilliQuantity(300, resource.DecimalSI), + }, }, }, }, @@ -192,12 +207,17 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { { Type: autoscaling.ObjectMetricSourceType, Object: &autoscaling.ObjectMetricSource{ - Target: autoscaling.CrossVersionObjectReference{ + DescribedObject: autoscaling.CrossVersionObjectReference{ Kind: "ReplicationController", Name: "myrc", }, - MetricName: "somemetric", - TargetValue: *resource.NewMilliQuantity(300, resource.DecimalSI), + Metric: autoscaling.MetricIdentifier{ + Name: "somemetric", + }, + Target: autoscaling.MetricTarget{ + Type: autoscaling.ValueMetricType, + Value: resource.NewMilliQuantity(300, resource.DecimalSI), + }, }, }, }, @@ -219,13 +239,14 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { { Type: autoscaling.ExternalMetricSourceType, External: &autoscaling.ExternalMetricSource{ - MetricName: "somemetric", - MetricSelector: &metav1.LabelSelector{ - MatchLabels: map[string]string{ - "label": "value", - }, + Metric: autoscaling.MetricIdentifier{ + Name: "somemetric", + Selector: metricLabelSelector, + }, + Target: autoscaling.MetricTarget{ + Type: autoscaling.ValueMetricType, + Value: resource.NewMilliQuantity(300, resource.DecimalSI), }, - TargetValue: resource.NewMilliQuantity(300, resource.DecimalSI), }, }, }, @@ -247,13 +268,14 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { { Type: autoscaling.ExternalMetricSourceType, External: &autoscaling.ExternalMetricSource{ - MetricName: "somemetric", - MetricSelector: &metav1.LabelSelector{ - MatchLabels: map[string]string{ - "label": "value", - }, + Metric: autoscaling.MetricIdentifier{ + Name: "somemetric", + Selector: metricLabelSelector, + }, + Target: autoscaling.MetricTarget{ + Type: autoscaling.AverageValueMetricType, + AverageValue: resource.NewMilliQuantity(300, resource.DecimalSI), }, - TargetAverageValue: resource.NewMilliQuantity(300, resource.DecimalSI), }, }, }, @@ -282,7 +304,10 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { Type: autoscaling.ResourceMetricSourceType, Resource: &autoscaling.ResourceMetricSource{ Name: api.ResourceCPU, - TargetAverageUtilization: utilpointer.Int32Ptr(70), + Target: autoscaling.MetricTarget{ + Type: autoscaling.UtilizationMetricType, + AverageUtilization: utilpointer.Int32Ptr(70), + }, }, }, }, @@ -302,7 +327,10 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { Type: autoscaling.ResourceMetricSourceType, Resource: &autoscaling.ResourceMetricSource{ Name: api.ResourceCPU, - TargetAverageUtilization: utilpointer.Int32Ptr(70), + Target: autoscaling.MetricTarget{ + Type: autoscaling.UtilizationMetricType, + AverageUtilization: utilpointer.Int32Ptr(70), + }, }, }, }, @@ -322,7 +350,10 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { Type: autoscaling.ResourceMetricSourceType, Resource: &autoscaling.ResourceMetricSource{ Name: api.ResourceCPU, - TargetAverageUtilization: utilpointer.Int32Ptr(70), + Target: autoscaling.MetricTarget{ + Type: autoscaling.UtilizationMetricType, + AverageUtilization: utilpointer.Int32Ptr(70), + }, }, }, }, @@ -342,7 +373,10 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { Type: autoscaling.ResourceMetricSourceType, Resource: &autoscaling.ResourceMetricSource{ Name: api.ResourceCPU, - TargetAverageUtilization: utilpointer.Int32Ptr(70), + Target: autoscaling.MetricTarget{ + Type: autoscaling.UtilizationMetricType, + AverageUtilization: utilpointer.Int32Ptr(70), + }, }, }, }, @@ -393,8 +427,11 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { Type: autoscaling.ResourceMetricSourceType, Resource: &autoscaling.ResourceMetricSource{ Name: api.ResourceCPU, - TargetAverageUtilization: utilpointer.Int32Ptr(70), - TargetAverageValue: resource.NewMilliQuantity(300, resource.DecimalSI), + Target: autoscaling.MetricTarget{ + Type: autoscaling.UtilizationMetricType, + AverageUtilization: utilpointer.Int32Ptr(70), + AverageValue: resource.NewMilliQuantity(300, resource.DecimalSI), + }, }, }, }, @@ -413,7 +450,10 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { { Type: autoscaling.ResourceMetricSourceType, Resource: &autoscaling.ResourceMetricSource{ - TargetAverageUtilization: utilpointer.Int32Ptr(70), + Target: autoscaling.MetricTarget{ + Type: autoscaling.UtilizationMetricType, + AverageUtilization: utilpointer.Int32Ptr(70), + }, }, }, }, @@ -433,7 +473,10 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { Type: autoscaling.ResourceMetricSourceType, Resource: &autoscaling.ResourceMetricSource{ Name: api.ResourceCPU, - TargetAverageUtilization: utilpointer.Int32Ptr(-10), + Target: autoscaling.MetricTarget{ + Type: autoscaling.UtilizationMetricType, + AverageUtilization: utilpointer.Int32Ptr(-10), + }, }, }, }, @@ -453,6 +496,9 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { Type: autoscaling.ResourceMetricSourceType, Resource: &autoscaling.ResourceMetricSource{ Name: api.ResourceCPU, + Target: autoscaling.MetricTarget{ + Type: autoscaling.ValueMetricType, + }, }, }, }, @@ -471,7 +517,11 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { { Type: autoscaling.PodsMetricSourceType, Pods: &autoscaling.PodsMetricSource{ - TargetAverageValue: *resource.NewMilliQuantity(100, resource.DecimalSI), + Metric: autoscaling.MetricIdentifier{}, + Target: autoscaling.MetricTarget{ + Type: autoscaling.ValueMetricType, + AverageValue: resource.NewMilliQuantity(100, resource.DecimalSI), + }, }, }, }, @@ -490,36 +540,18 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { { Type: autoscaling.PodsMetricSourceType, Pods: &autoscaling.PodsMetricSource{ - MetricName: "somemetric", - }, - }, - }, - }, - }, - msg: "must specify a positive target value", - }, - { - horizontalPodAutoscaler: autoscaling.HorizontalPodAutoscaler{ - ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault}, - Spec: autoscaling.HorizontalPodAutoscalerSpec{ - ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"}, - MinReplicas: utilpointer.Int32Ptr(1), - MaxReplicas: 5, - Metrics: []autoscaling.MetricSpec{ - { - Type: autoscaling.ObjectMetricSourceType, - Object: &autoscaling.ObjectMetricSource{ - Target: autoscaling.CrossVersionObjectReference{ - Name: "myrc", + Metric: autoscaling.MetricIdentifier{ + Name: "somemetric", + }, + Target: autoscaling.MetricTarget{ + Type: autoscaling.ValueMetricType, }, - MetricName: "somemetric", - TargetValue: *resource.NewMilliQuantity(100, resource.DecimalSI), }, }, }, }, }, - msg: "target.kind: Required", + msg: "must specify a positive target averageValue", }, { horizontalPodAutoscaler: autoscaling.HorizontalPodAutoscaler{ @@ -532,11 +564,70 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { { Type: autoscaling.ObjectMetricSourceType, Object: &autoscaling.ObjectMetricSource{ - Target: autoscaling.CrossVersionObjectReference{ + DescribedObject: autoscaling.CrossVersionObjectReference{ Kind: "ReplicationController", Name: "myrc", }, - TargetValue: *resource.NewMilliQuantity(100, resource.DecimalSI), + Metric: autoscaling.MetricIdentifier{ + Name: "somemetric", + }, + Target: autoscaling.MetricTarget{ + Type: autoscaling.ValueMetricType, + }, + }, + }, + }, + }, + }, + msg: "must set either a target value or averageValue", + }, + { + horizontalPodAutoscaler: autoscaling.HorizontalPodAutoscaler{ + ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault}, + Spec: autoscaling.HorizontalPodAutoscalerSpec{ + ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"}, + MinReplicas: utilpointer.Int32Ptr(1), + MaxReplicas: 5, + Metrics: []autoscaling.MetricSpec{ + { + Type: autoscaling.ObjectMetricSourceType, + Object: &autoscaling.ObjectMetricSource{ + DescribedObject: autoscaling.CrossVersionObjectReference{ + Name: "myrc", + }, + Metric: autoscaling.MetricIdentifier{ + Name: "somemetric", + }, + Target: autoscaling.MetricTarget{ + Type: autoscaling.ValueMetricType, + Value: resource.NewMilliQuantity(100, resource.DecimalSI), + }, + }, + }, + }, + }, + }, + msg: "object.describedObject.kind: Required", + }, + { + horizontalPodAutoscaler: autoscaling.HorizontalPodAutoscaler{ + ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault}, + Spec: autoscaling.HorizontalPodAutoscalerSpec{ + ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"}, + MinReplicas: utilpointer.Int32Ptr(1), + MaxReplicas: 5, + Metrics: []autoscaling.MetricSpec{ + { + Type: autoscaling.ObjectMetricSourceType, + Object: &autoscaling.ObjectMetricSource{ + DescribedObject: autoscaling.CrossVersionObjectReference{ + Kind: "ReplicationController", + Name: "myrc", + }, + Target: autoscaling.MetricTarget{ + Type: autoscaling.ValueMetricType, + Value: resource.NewMilliQuantity(100, resource.DecimalSI), + }, }, }, }, @@ -555,12 +646,13 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { { Type: autoscaling.ExternalMetricSourceType, External: &autoscaling.ExternalMetricSource{ - MetricSelector: &metav1.LabelSelector{ - MatchLabels: map[string]string{ - "label": "value", - }, + Metric: autoscaling.MetricIdentifier{ + Selector: metricLabelSelector, + }, + Target: autoscaling.MetricTarget{ + Type: autoscaling.ValueMetricType, + Value: resource.NewMilliQuantity(300, resource.DecimalSI), }, - TargetValue: resource.NewMilliQuantity(300, resource.DecimalSI), }, }, }, @@ -579,13 +671,14 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { { Type: autoscaling.ExternalMetricSourceType, External: &autoscaling.ExternalMetricSource{ - MetricName: "foo/../", - MetricSelector: &metav1.LabelSelector{ - MatchLabels: map[string]string{ - "label": "value", - }, + Metric: autoscaling.MetricIdentifier{ + Name: "foo/../", + Selector: metricLabelSelector, + }, + Target: autoscaling.MetricTarget{ + Type: autoscaling.ValueMetricType, + Value: resource.NewMilliQuantity(300, resource.DecimalSI), }, - TargetValue: resource.NewMilliQuantity(300, resource.DecimalSI), }, }, }, @@ -605,11 +698,12 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { { Type: autoscaling.ExternalMetricSourceType, External: &autoscaling.ExternalMetricSource{ - MetricName: "somemetric", - MetricSelector: &metav1.LabelSelector{ - MatchLabels: map[string]string{ - "label": "value", - }, + Metric: autoscaling.MetricIdentifier{ + Name: "somemetric", + Selector: metricLabelSelector, + }, + Target: autoscaling.MetricTarget{ + Type: autoscaling.ValueMetricType, }, }, }, @@ -629,13 +723,14 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { { Type: autoscaling.ExternalMetricSourceType, External: &autoscaling.ExternalMetricSource{ - MetricName: "somemetric", - MetricSelector: &metav1.LabelSelector{ - MatchLabels: map[string]string{ - "label": "value", - }, + Metric: autoscaling.MetricIdentifier{ + Name: "somemetric", + Selector: metricLabelSelector, + }, + Target: autoscaling.MetricTarget{ + Type: autoscaling.ValueMetricType, + Value: resource.NewMilliQuantity(-300, resource.DecimalSI), }, - TargetValue: resource.NewMilliQuantity(-300, resource.DecimalSI), }, }, }, @@ -654,13 +749,14 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { { Type: autoscaling.ExternalMetricSourceType, External: &autoscaling.ExternalMetricSource{ - MetricName: "somemetric", - MetricSelector: &metav1.LabelSelector{ - MatchLabels: map[string]string{ - "label": "value", - }, + Metric: autoscaling.MetricIdentifier{ + Name: "somemetric", + Selector: metricLabelSelector, + }, + Target: autoscaling.MetricTarget{ + Type: autoscaling.ValueMetricType, + AverageValue: resource.NewMilliQuantity(-300, resource.DecimalSI), }, - TargetAverageValue: resource.NewMilliQuantity(-300, resource.DecimalSI), }, }, }, @@ -679,14 +775,15 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { { Type: autoscaling.ExternalMetricSourceType, External: &autoscaling.ExternalMetricSource{ - MetricName: "somemetric", - MetricSelector: &metav1.LabelSelector{ - MatchLabels: map[string]string{ - "label": "value", - }, + Metric: autoscaling.MetricIdentifier{ + Name: "somemetric", + Selector: metricLabelSelector, + }, + Target: autoscaling.MetricTarget{ + Type: autoscaling.ValueMetricType, + Value: resource.NewMilliQuantity(300, resource.DecimalSI), + AverageValue: resource.NewMilliQuantity(300, resource.DecimalSI), }, - TargetValue: resource.NewMilliQuantity(300, resource.DecimalSI), - TargetAverageValue: resource.NewMilliQuantity(300, resource.DecimalSI), }, }, }, @@ -694,6 +791,79 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { }, msg: "may not set both a target value for metric and a per-pod target", }, + { + horizontalPodAutoscaler: autoscaling.HorizontalPodAutoscaler{ + ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault}, + Spec: autoscaling.HorizontalPodAutoscalerSpec{ + ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"}, + MinReplicas: utilpointer.Int32Ptr(1), + MaxReplicas: 5, + Metrics: []autoscaling.MetricSpec{ + { + Type: autoscaling.ExternalMetricSourceType, + External: &autoscaling.ExternalMetricSource{ + Metric: autoscaling.MetricIdentifier{ + Name: "somemetric", + Selector: metricLabelSelector, + }, + Target: autoscaling.MetricTarget{ + Type: "boogity", + Value: resource.NewMilliQuantity(300, resource.DecimalSI), + }, + }, + }, + }, + }, + }, + msg: "must be either Utilization, Value, or AverageValue", + }, + { + horizontalPodAutoscaler: autoscaling.HorizontalPodAutoscaler{ + ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault}, + Spec: autoscaling.HorizontalPodAutoscalerSpec{ + ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"}, + MinReplicas: utilpointer.Int32Ptr(1), + MaxReplicas: 5, + Metrics: []autoscaling.MetricSpec{ + { + Type: autoscaling.ExternalMetricSourceType, + External: &autoscaling.ExternalMetricSource{ + Metric: autoscaling.MetricIdentifier{ + Name: "somemetric", + Selector: metricLabelSelector, + }, + Target: autoscaling.MetricTarget{ + Value: resource.NewMilliQuantity(300, resource.DecimalSI), + }, + }, + }, + }, + }, + }, + msg: "must specify a metric target type", + }, + { + horizontalPodAutoscaler: autoscaling.HorizontalPodAutoscaler{ + ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault}, + Spec: autoscaling.HorizontalPodAutoscalerSpec{ + ScaleTargetRef: autoscaling.CrossVersionObjectReference{Name: "myrc", Kind: "ReplicationController"}, + MinReplicas: utilpointer.Int32Ptr(1), + MaxReplicas: 5, + Metrics: []autoscaling.MetricSpec{ + { + Type: autoscaling.ExternalMetricSourceType, + External: &autoscaling.ExternalMetricSource{ + Metric: autoscaling.MetricIdentifier{ + Name: "somemetric", + Selector: metricLabelSelector, + }, + }, + }, + }, + }, + }, + msg: "must specify a metric target", + }, { horizontalPodAutoscaler: autoscaling.HorizontalPodAutoscaler{ ObjectMeta: metav1.ObjectMeta{Name: "myautoscaler", Namespace: metav1.NamespaceDefault}, @@ -735,12 +905,20 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { { Type: autoscaling.ResourceMetricSourceType, Resource: &autoscaling.ResourceMetricSource{ - Name: api.ResourceCPU, - TargetAverageValue: resource.NewMilliQuantity(100, resource.DecimalSI), + Name: api.ResourceCPU, + Target: autoscaling.MetricTarget{ + Type: autoscaling.AverageValueMetricType, + AverageValue: resource.NewMilliQuantity(100, resource.DecimalSI), + }, }, Pods: &autoscaling.PodsMetricSource{ - MetricName: "somemetric", - TargetAverageValue: *resource.NewMilliQuantity(100, resource.DecimalSI), + Metric: autoscaling.MetricIdentifier{ + Name: "somemetric", + }, + Target: autoscaling.MetricTarget{ + Type: autoscaling.AverageValueMetricType, + AverageValue: resource.NewMilliQuantity(100, resource.DecimalSI), + }, }, }, }, @@ -762,24 +940,37 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { sourceTypes := map[autoscaling.MetricSourceType]autoscaling.MetricSpec{ autoscaling.ResourceMetricSourceType: { Resource: &autoscaling.ResourceMetricSource{ - Name: api.ResourceCPU, - TargetAverageValue: resource.NewMilliQuantity(100, resource.DecimalSI), + Name: api.ResourceCPU, + Target: autoscaling.MetricTarget{ + Type: autoscaling.AverageValueMetricType, + AverageValue: resource.NewMilliQuantity(100, resource.DecimalSI), + }, }, }, autoscaling.PodsMetricSourceType: { Pods: &autoscaling.PodsMetricSource{ - MetricName: "somemetric", - TargetAverageValue: *resource.NewMilliQuantity(100, resource.DecimalSI), + Metric: autoscaling.MetricIdentifier{ + Name: "somemetric", + }, + Target: autoscaling.MetricTarget{ + Type: autoscaling.AverageValueMetricType, + AverageValue: resource.NewMilliQuantity(100, resource.DecimalSI), + }, }, }, autoscaling.ObjectMetricSourceType: { Object: &autoscaling.ObjectMetricSource{ - Target: autoscaling.CrossVersionObjectReference{ + DescribedObject: autoscaling.CrossVersionObjectReference{ Kind: "ReplicationController", Name: "myrc", }, - MetricName: "somemetric", - TargetValue: *resource.NewMilliQuantity(100, resource.DecimalSI), + Metric: autoscaling.MetricIdentifier{ + Name: "somemetric", + }, + Target: autoscaling.MetricTarget{ + Type: autoscaling.ValueMetricType, + Value: resource.NewMilliQuantity(100, resource.DecimalSI), + }, }, }, } diff --git a/pkg/apis/autoscaling/zz_generated.deepcopy.go b/pkg/apis/autoscaling/zz_generated.deepcopy.go index 0681900073f..7455c0933c7 100644 --- a/pkg/apis/autoscaling/zz_generated.deepcopy.go +++ b/pkg/apis/autoscaling/zz_generated.deepcopy.go @@ -21,7 +21,6 @@ limitations under the License. package autoscaling import ( - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -44,21 +43,8 @@ func (in *CrossVersionObjectReference) DeepCopy() *CrossVersionObjectReference { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ExternalMetricSource) DeepCopyInto(out *ExternalMetricSource) { *out = *in - if in.MetricSelector != nil { - in, out := &in.MetricSelector, &out.MetricSelector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - if in.TargetValue != nil { - in, out := &in.TargetValue, &out.TargetValue - x := (*in).DeepCopy() - *out = &x - } - if in.TargetAverageValue != nil { - in, out := &in.TargetAverageValue, &out.TargetAverageValue - x := (*in).DeepCopy() - *out = &x - } + out.Metric = in.Metric + in.Target.DeepCopyInto(&out.Target) return } @@ -75,17 +61,8 @@ func (in *ExternalMetricSource) DeepCopy() *ExternalMetricSource { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ExternalMetricStatus) DeepCopyInto(out *ExternalMetricStatus) { *out = *in - if in.MetricSelector != nil { - in, out := &in.MetricSelector, &out.MetricSelector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - out.CurrentValue = in.CurrentValue.DeepCopy() - if in.CurrentAverageValue != nil { - in, out := &in.CurrentAverageValue, &out.CurrentAverageValue - x := (*in).DeepCopy() - *out = &x - } + out.Metric = in.Metric + in.Current.DeepCopyInto(&out.Current) return } @@ -245,6 +222,22 @@ func (in *HorizontalPodAutoscalerStatus) DeepCopy() *HorizontalPodAutoscalerStat return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MetricIdent) DeepCopyInto(out *MetricIdent) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricIdent. +func (in *MetricIdent) DeepCopy() *MetricIdent { + if in == nil { + return nil + } + out := new(MetricIdent) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MetricSpec) DeepCopyInto(out *MetricSpec) { *out = *in @@ -317,11 +310,74 @@ func (in *MetricStatus) DeepCopy() *MetricStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MetricTarget) DeepCopyInto(out *MetricTarget) { + *out = *in + if in.Value != nil { + in, out := &in.Value, &out.Value + x := (*in).DeepCopy() + *out = &x + } + if in.AverageValue != nil { + in, out := &in.AverageValue, &out.AverageValue + x := (*in).DeepCopy() + *out = &x + } + if in.AverageUtilization != nil { + in, out := &in.AverageUtilization, &out.AverageUtilization + *out = new(int32) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricTarget. +func (in *MetricTarget) DeepCopy() *MetricTarget { + if in == nil { + return nil + } + out := new(MetricTarget) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MetricValueStatus) DeepCopyInto(out *MetricValueStatus) { + *out = *in + if in.Value != nil { + in, out := &in.Value, &out.Value + x := (*in).DeepCopy() + *out = &x + } + if in.AverageValue != nil { + in, out := &in.AverageValue, &out.AverageValue + x := (*in).DeepCopy() + *out = &x + } + if in.AverageUtilization != nil { + in, out := &in.AverageUtilization, &out.AverageUtilization + *out = new(int32) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricValueStatus. +func (in *MetricValueStatus) DeepCopy() *MetricValueStatus { + if in == nil { + return nil + } + out := new(MetricValueStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ObjectMetricSource) DeepCopyInto(out *ObjectMetricSource) { *out = *in - out.Target = in.Target - out.TargetValue = in.TargetValue.DeepCopy() + out.DescribedObject = in.DescribedObject + in.Target.DeepCopyInto(&out.Target) + out.Metric = in.Metric return } @@ -338,8 +394,9 @@ func (in *ObjectMetricSource) DeepCopy() *ObjectMetricSource { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ObjectMetricStatus) DeepCopyInto(out *ObjectMetricStatus) { *out = *in - out.Target = in.Target - out.CurrentValue = in.CurrentValue.DeepCopy() + out.Metric = in.Metric + in.Current.DeepCopyInto(&out.Current) + out.DescribedObject = in.DescribedObject return } @@ -356,7 +413,8 @@ func (in *ObjectMetricStatus) DeepCopy() *ObjectMetricStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PodsMetricSource) DeepCopyInto(out *PodsMetricSource) { *out = *in - out.TargetAverageValue = in.TargetAverageValue.DeepCopy() + out.Metric = in.Metric + in.Target.DeepCopyInto(&out.Target) return } @@ -373,7 +431,8 @@ func (in *PodsMetricSource) DeepCopy() *PodsMetricSource { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PodsMetricStatus) DeepCopyInto(out *PodsMetricStatus) { *out = *in - out.CurrentAverageValue = in.CurrentAverageValue.DeepCopy() + out.Metric = in.Metric + in.Current.DeepCopyInto(&out.Current) return } @@ -390,16 +449,7 @@ func (in *PodsMetricStatus) DeepCopy() *PodsMetricStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ResourceMetricSource) DeepCopyInto(out *ResourceMetricSource) { *out = *in - if in.TargetAverageUtilization != nil { - in, out := &in.TargetAverageUtilization, &out.TargetAverageUtilization - *out = new(int32) - **out = **in - } - if in.TargetAverageValue != nil { - in, out := &in.TargetAverageValue, &out.TargetAverageValue - x := (*in).DeepCopy() - *out = &x - } + in.Target.DeepCopyInto(&out.Target) return } @@ -416,12 +466,7 @@ func (in *ResourceMetricSource) DeepCopy() *ResourceMetricSource { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ResourceMetricStatus) DeepCopyInto(out *ResourceMetricStatus) { *out = *in - if in.CurrentAverageUtilization != nil { - in, out := &in.CurrentAverageUtilization, &out.CurrentAverageUtilization - *out = new(int32) - **out = **in - } - out.CurrentAverageValue = in.CurrentAverageValue.DeepCopy() + in.Current.DeepCopyInto(&out.Current) return } diff --git a/staging/src/k8s.io/api/autoscaling/v1/generated.pb.go b/staging/src/k8s.io/api/autoscaling/v1/generated.pb.go index 8d67ef976db..6c2c2ef2ebb 100644 --- a/staging/src/k8s.io/api/autoscaling/v1/generated.pb.go +++ b/staging/src/k8s.io/api/autoscaling/v1/generated.pb.go @@ -675,6 +675,20 @@ func (m *ObjectMetricSource) MarshalTo(dAtA []byte) (int, error) { return 0, err } i += n23 + dAtA[i] = 0x22 + i++ + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Selector))) + i += copy(dAtA[i:], m.Selector) + if m.AverageValue != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintGenerated(dAtA, i, uint64(m.AverageValue.Size())) + n24, err := m.AverageValue.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n24 + } return i, nil } @@ -696,11 +710,11 @@ func (m *ObjectMetricStatus) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0xa i++ i = encodeVarintGenerated(dAtA, i, uint64(m.Target.Size())) - n24, err := m.Target.MarshalTo(dAtA[i:]) + n25, err := m.Target.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n24 + i += n25 dAtA[i] = 0x12 i++ i = encodeVarintGenerated(dAtA, i, uint64(len(m.MetricName))) @@ -708,11 +722,25 @@ func (m *ObjectMetricStatus) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x1a i++ i = encodeVarintGenerated(dAtA, i, uint64(m.CurrentValue.Size())) - n25, err := m.CurrentValue.MarshalTo(dAtA[i:]) + n26, err := m.CurrentValue.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n25 + i += n26 + dAtA[i] = 0x22 + i++ + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Selector))) + i += copy(dAtA[i:], m.Selector) + if m.AverageValue != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintGenerated(dAtA, i, uint64(m.AverageValue.Size())) + n27, err := m.AverageValue.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n27 + } return i, nil } @@ -738,11 +766,25 @@ func (m *PodsMetricSource) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x12 i++ i = encodeVarintGenerated(dAtA, i, uint64(m.TargetAverageValue.Size())) - n26, err := m.TargetAverageValue.MarshalTo(dAtA[i:]) + n28, err := m.TargetAverageValue.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n26 + i += n28 + dAtA[i] = 0x1a + i++ + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Selector))) + i += copy(dAtA[i:], m.Selector) + if m.Value != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintGenerated(dAtA, i, uint64(m.Value.Size())) + n29, err := m.Value.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n29 + } return i, nil } @@ -768,11 +810,25 @@ func (m *PodsMetricStatus) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x12 i++ i = encodeVarintGenerated(dAtA, i, uint64(m.CurrentAverageValue.Size())) - n27, err := m.CurrentAverageValue.MarshalTo(dAtA[i:]) + n30, err := m.CurrentAverageValue.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n27 + i += n30 + dAtA[i] = 0x1a + i++ + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Selector))) + i += copy(dAtA[i:], m.Selector) + if m.Value != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintGenerated(dAtA, i, uint64(m.Value.Size())) + n31, err := m.Value.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n31 + } return i, nil } @@ -804,11 +860,11 @@ func (m *ResourceMetricSource) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x1a i++ i = encodeVarintGenerated(dAtA, i, uint64(m.TargetAverageValue.Size())) - n28, err := m.TargetAverageValue.MarshalTo(dAtA[i:]) + n32, err := m.TargetAverageValue.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n28 + i += n32 } return i, nil } @@ -840,11 +896,11 @@ func (m *ResourceMetricStatus) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x1a i++ i = encodeVarintGenerated(dAtA, i, uint64(m.CurrentAverageValue.Size())) - n29, err := m.CurrentAverageValue.MarshalTo(dAtA[i:]) + n33, err := m.CurrentAverageValue.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n29 + i += n33 return i, nil } @@ -866,27 +922,27 @@ func (m *Scale) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0xa i++ i = encodeVarintGenerated(dAtA, i, uint64(m.ObjectMeta.Size())) - n30, err := m.ObjectMeta.MarshalTo(dAtA[i:]) + n34, err := m.ObjectMeta.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n30 + i += n34 dAtA[i] = 0x12 i++ i = encodeVarintGenerated(dAtA, i, uint64(m.Spec.Size())) - n31, err := m.Spec.MarshalTo(dAtA[i:]) + n35, err := m.Spec.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n31 + i += n35 dAtA[i] = 0x1a i++ i = encodeVarintGenerated(dAtA, i, uint64(m.Status.Size())) - n32, err := m.Status.MarshalTo(dAtA[i:]) + n36, err := m.Status.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n32 + i += n36 return i, nil } @@ -1145,6 +1201,12 @@ func (m *ObjectMetricSource) Size() (n int) { n += 1 + l + sovGenerated(uint64(l)) l = m.TargetValue.Size() n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Selector) + n += 1 + l + sovGenerated(uint64(l)) + if m.AverageValue != nil { + l = m.AverageValue.Size() + n += 1 + l + sovGenerated(uint64(l)) + } return n } @@ -1157,6 +1219,12 @@ func (m *ObjectMetricStatus) Size() (n int) { n += 1 + l + sovGenerated(uint64(l)) l = m.CurrentValue.Size() n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Selector) + n += 1 + l + sovGenerated(uint64(l)) + if m.AverageValue != nil { + l = m.AverageValue.Size() + n += 1 + l + sovGenerated(uint64(l)) + } return n } @@ -1167,6 +1235,12 @@ func (m *PodsMetricSource) Size() (n int) { n += 1 + l + sovGenerated(uint64(l)) l = m.TargetAverageValue.Size() n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Selector) + n += 1 + l + sovGenerated(uint64(l)) + if m.Value != nil { + l = m.Value.Size() + n += 1 + l + sovGenerated(uint64(l)) + } return n } @@ -1177,6 +1251,12 @@ func (m *PodsMetricStatus) Size() (n int) { n += 1 + l + sovGenerated(uint64(l)) l = m.CurrentAverageValue.Size() n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Selector) + n += 1 + l + sovGenerated(uint64(l)) + if m.Value != nil { + l = m.Value.Size() + n += 1 + l + sovGenerated(uint64(l)) + } return n } @@ -1387,6 +1467,8 @@ func (this *ObjectMetricSource) String() string { `Target:` + strings.Replace(strings.Replace(this.Target.String(), "CrossVersionObjectReference", "CrossVersionObjectReference", 1), `&`, ``, 1) + `,`, `MetricName:` + fmt.Sprintf("%v", this.MetricName) + `,`, `TargetValue:` + strings.Replace(strings.Replace(this.TargetValue.String(), "Quantity", "k8s_io_apimachinery_pkg_api_resource.Quantity", 1), `&`, ``, 1) + `,`, + `Selector:` + fmt.Sprintf("%v", this.Selector) + `,`, + `AverageValue:` + strings.Replace(fmt.Sprintf("%v", this.AverageValue), "Quantity", "k8s_io_apimachinery_pkg_api_resource.Quantity", 1) + `,`, `}`, }, "") return s @@ -1399,6 +1481,8 @@ func (this *ObjectMetricStatus) String() string { `Target:` + strings.Replace(strings.Replace(this.Target.String(), "CrossVersionObjectReference", "CrossVersionObjectReference", 1), `&`, ``, 1) + `,`, `MetricName:` + fmt.Sprintf("%v", this.MetricName) + `,`, `CurrentValue:` + strings.Replace(strings.Replace(this.CurrentValue.String(), "Quantity", "k8s_io_apimachinery_pkg_api_resource.Quantity", 1), `&`, ``, 1) + `,`, + `Selector:` + fmt.Sprintf("%v", this.Selector) + `,`, + `AverageValue:` + strings.Replace(fmt.Sprintf("%v", this.AverageValue), "Quantity", "k8s_io_apimachinery_pkg_api_resource.Quantity", 1) + `,`, `}`, }, "") return s @@ -1410,6 +1494,8 @@ func (this *PodsMetricSource) String() string { s := strings.Join([]string{`&PodsMetricSource{`, `MetricName:` + fmt.Sprintf("%v", this.MetricName) + `,`, `TargetAverageValue:` + strings.Replace(strings.Replace(this.TargetAverageValue.String(), "Quantity", "k8s_io_apimachinery_pkg_api_resource.Quantity", 1), `&`, ``, 1) + `,`, + `Selector:` + fmt.Sprintf("%v", this.Selector) + `,`, + `Value:` + strings.Replace(fmt.Sprintf("%v", this.Value), "Quantity", "k8s_io_apimachinery_pkg_api_resource.Quantity", 1) + `,`, `}`, }, "") return s @@ -1421,6 +1507,8 @@ func (this *PodsMetricStatus) String() string { s := strings.Join([]string{`&PodsMetricStatus{`, `MetricName:` + fmt.Sprintf("%v", this.MetricName) + `,`, `CurrentAverageValue:` + strings.Replace(strings.Replace(this.CurrentAverageValue.String(), "Quantity", "k8s_io_apimachinery_pkg_api_resource.Quantity", 1), `&`, ``, 1) + `,`, + `Selector:` + fmt.Sprintf("%v", this.Selector) + `,`, + `Value:` + strings.Replace(fmt.Sprintf("%v", this.Value), "Quantity", "k8s_io_apimachinery_pkg_api_resource.Quantity", 1) + `,`, `}`, }, "") return s @@ -3267,6 +3355,68 @@ func (m *ObjectMetricSource) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Selector", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Selector = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AverageValue", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.AverageValue == nil { + m.AverageValue = &k8s_io_apimachinery_pkg_api_resource.Quantity{} + } + if err := m.AverageValue.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -3406,6 +3556,68 @@ func (m *ObjectMetricStatus) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Selector", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Selector = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AverageValue", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.AverageValue == nil { + m.AverageValue = &k8s_io_apimachinery_pkg_api_resource.Quantity{} + } + if err := m.AverageValue.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -3515,6 +3727,68 @@ func (m *PodsMetricSource) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Selector", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Selector = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Value == nil { + m.Value = &k8s_io_apimachinery_pkg_api_resource.Quantity{} + } + if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -3624,6 +3898,68 @@ func (m *PodsMetricStatus) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Selector", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Selector = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Value == nil { + m.Value = &k8s_io_apimachinery_pkg_api_resource.Quantity{} + } + if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -4323,6 +4659,7 @@ func init() { } var fileDescriptorGenerated = []byte{ +<<<<<<< HEAD // 1471 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x58, 0x4b, 0x6f, 0x14, 0xc7, 0x13, 0xf7, 0x3e, 0x6c, 0xec, 0x5e, 0x63, 0xf3, 0x6f, 0x10, 0x18, 0xf3, 0x67, 0xc7, 0x9a, 0x20, @@ -4416,4 +4753,104 @@ var fileDescriptorGenerated = []byte{ 0xf2, 0xd8, 0xb3, 0xe7, 0xe5, 0xb1, 0xaf, 0xc2, 0x72, 0xee, 0x49, 0x58, 0xce, 0x3d, 0x0d, 0xcb, 0xb9, 0x67, 0x61, 0x39, 0xf7, 0x67, 0x58, 0xce, 0x7d, 0xf7, 0x57, 0x79, 0xec, 0xd3, 0x7c, 0x77, 0xf1, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x4d, 0x5f, 0x69, 0x0c, 0x4c, 0x17, 0x00, 0x00, +======= + // 1538 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x58, 0xcf, 0x6f, 0x13, 0xc7, + 0x17, 0x8f, 0x7f, 0x85, 0x64, 0x1c, 0x92, 0x7c, 0x07, 0x04, 0x21, 0x7c, 0xf1, 0x46, 0xfb, 0x45, + 0x88, 0x6f, 0x5b, 0xd6, 0x4d, 0xa0, 0x88, 0x1e, 0x63, 0xb7, 0x14, 0xd4, 0x04, 0xc2, 0x24, 0x50, + 0xfa, 0x43, 0x15, 0x93, 0xf5, 0xe0, 0x0c, 0xb1, 0x77, 0xad, 0xd9, 0xb1, 0x45, 0x90, 0x2a, 0xb5, + 0x87, 0xde, 0x7b, 0x69, 0xd5, 0x63, 0xa5, 0x4a, 0xbd, 0xf5, 0xcc, 0x19, 0xa9, 0x07, 0x8e, 0x1c, + 0x7a, 0xe0, 0xb4, 0x2a, 0xdb, 0x63, 0xff, 0x03, 0x4e, 0xd5, 0xfc, 0xd8, 0xf5, 0xae, 0xed, 0x75, + 0x12, 0x13, 0x52, 0x7a, 0xf3, 0xec, 0x7b, 0xef, 0xf3, 0x9e, 0xdf, 0x7b, 0xf3, 0x7e, 0x0c, 0xa8, + 0x6c, 0x5f, 0xf1, 0x2c, 0xea, 0x96, 0xb7, 0xdb, 0x9b, 0x84, 0x39, 0x84, 0x13, 0xaf, 0xdc, 0x21, + 0x4e, 0xcd, 0x65, 0x65, 0x4d, 0xc0, 0x2d, 0x5a, 0xc6, 0x6d, 0xee, 0x7a, 0x36, 0x6e, 0x50, 0xa7, + 0x5e, 0xee, 0x2c, 0x96, 0xeb, 0xc4, 0x21, 0x0c, 0x73, 0x52, 0xb3, 0x5a, 0xcc, 0xe5, 0x2e, 0x3c, + 0xa5, 0x58, 0x2d, 0xdc, 0xa2, 0x56, 0x8c, 0xd5, 0xea, 0x2c, 0xce, 0x5f, 0xa8, 0x53, 0xbe, 0xd5, + 0xde, 0xb4, 0x6c, 0xb7, 0x59, 0xae, 0xbb, 0x75, 0xb7, 0x2c, 0x25, 0x36, 0xdb, 0xf7, 0xe5, 0x49, + 0x1e, 0xe4, 0x2f, 0x85, 0x34, 0x6f, 0xc6, 0x94, 0xda, 0x2e, 0x23, 0x03, 0xb4, 0xcd, 0x5f, 0xea, + 0xf2, 0x34, 0xb1, 0xbd, 0x45, 0x1d, 0xc2, 0x76, 0xca, 0xad, 0xed, 0xba, 0x14, 0x62, 0xc4, 0x73, + 0xdb, 0xcc, 0x26, 0xfb, 0x92, 0xf2, 0xca, 0x4d, 0xc2, 0xf1, 0x20, 0x5d, 0xe5, 0x34, 0x29, 0xd6, + 0x76, 0x38, 0x6d, 0xf6, 0xab, 0xb9, 0xbc, 0x9b, 0x80, 0x67, 0x6f, 0x91, 0x26, 0xee, 0x93, 0xbb, + 0x98, 0x26, 0xd7, 0xe6, 0xb4, 0x51, 0xa6, 0x0e, 0xf7, 0x38, 0xeb, 0x15, 0x32, 0xbf, 0xcf, 0x80, + 0xd3, 0x55, 0xe6, 0x7a, 0xde, 0x1d, 0xc2, 0x3c, 0xea, 0x3a, 0x37, 0x37, 0x1f, 0x10, 0x9b, 0x23, + 0x72, 0x9f, 0x30, 0xe2, 0xd8, 0x04, 0x2e, 0x80, 0xfc, 0x36, 0x75, 0x6a, 0x73, 0x99, 0x85, 0xcc, + 0xf9, 0xc9, 0xca, 0xd4, 0x53, 0xdf, 0x18, 0x0b, 0x7c, 0x23, 0xff, 0x31, 0x75, 0x6a, 0x48, 0x52, + 0x04, 0x87, 0x83, 0x9b, 0x64, 0x2e, 0x9b, 0xe4, 0xb8, 0x81, 0x9b, 0x04, 0x49, 0x0a, 0x5c, 0x02, + 0x00, 0xb7, 0xa8, 0x56, 0x30, 0x97, 0x93, 0x7c, 0x50, 0xf3, 0x81, 0xe5, 0xb5, 0xeb, 0x9a, 0x82, + 0x62, 0x5c, 0xe6, 0x0f, 0x39, 0x70, 0xfc, 0xc3, 0x87, 0x9c, 0x30, 0x07, 0x37, 0x56, 0x09, 0x67, + 0xd4, 0x5e, 0x97, 0x41, 0x11, 0x60, 0x4d, 0x79, 0x16, 0x0a, 0xb4, 0x59, 0x11, 0xd8, 0x6a, 0x44, + 0x41, 0x31, 0x2e, 0xe8, 0x82, 0x69, 0x75, 0x5a, 0x27, 0x0d, 0x62, 0x73, 0x97, 0x49, 0x63, 0x8b, + 0x4b, 0x17, 0xad, 0x6e, 0xd6, 0x45, 0x2e, 0xb3, 0x5a, 0xdb, 0x75, 0xf1, 0xc1, 0xb3, 0x44, 0x44, + 0xad, 0xce, 0xa2, 0xb5, 0x82, 0x37, 0x49, 0x23, 0x14, 0xad, 0xc0, 0xc0, 0x37, 0xa6, 0x57, 0x13, + 0x70, 0xa8, 0x07, 0x1e, 0x62, 0x50, 0xe4, 0x98, 0xd5, 0x09, 0xbf, 0x83, 0x1b, 0x6d, 0x22, 0xff, + 0x72, 0x71, 0xc9, 0x1a, 0xa6, 0xcd, 0x0a, 0xb3, 0xce, 0xba, 0xd5, 0xc6, 0x0e, 0xa7, 0x7c, 0xa7, + 0x32, 0x13, 0xf8, 0x46, 0x71, 0xa3, 0x0b, 0x83, 0xe2, 0x98, 0xb0, 0x03, 0xa0, 0x3a, 0x2e, 0x77, + 0x08, 0xc3, 0x75, 0xa2, 0x34, 0xe5, 0x47, 0xd2, 0x74, 0x22, 0xf0, 0x0d, 0xb8, 0xd1, 0x87, 0x86, + 0x06, 0x68, 0x30, 0x7f, 0xea, 0x0f, 0x0c, 0xc7, 0xbc, 0xed, 0xfd, 0x3b, 0x02, 0xb3, 0x05, 0xa6, + 0xec, 0x36, 0x63, 0xc4, 0x79, 0xa5, 0xc8, 0x1c, 0xd7, 0x7f, 0x6b, 0xaa, 0x1a, 0xc3, 0x42, 0x09, + 0x64, 0xb8, 0x03, 0x8e, 0xe9, 0xf3, 0x01, 0x04, 0xe8, 0x64, 0xe0, 0x1b, 0xc7, 0xaa, 0xfd, 0x70, + 0x68, 0x90, 0x0e, 0xf3, 0x71, 0x16, 0x9c, 0xbc, 0xe6, 0x32, 0xfa, 0xc8, 0x75, 0x38, 0x6e, 0xac, + 0xb9, 0xb5, 0x65, 0x5d, 0x50, 0x09, 0x83, 0xf7, 0xc0, 0x84, 0xf0, 0x5e, 0x0d, 0x73, 0x2c, 0x63, + 0x54, 0x5c, 0x7a, 0x77, 0x6f, 0xbe, 0x56, 0x85, 0x61, 0x95, 0x70, 0xdc, 0x8d, 0x6a, 0xf7, 0x1b, + 0x8a, 0x50, 0xe1, 0x5d, 0x90, 0xf7, 0x5a, 0xc4, 0xd6, 0x91, 0xbc, 0x6c, 0xa5, 0x16, 0x76, 0x2b, + 0xc5, 0xc6, 0xf5, 0x16, 0xb1, 0xbb, 0x75, 0x44, 0x9c, 0x90, 0x44, 0x84, 0xf7, 0xc0, 0xb8, 0x27, + 0x73, 0x4d, 0x87, 0xed, 0xca, 0x08, 0xd8, 0x52, 0xbe, 0x32, 0xad, 0xd1, 0xc7, 0xd5, 0x19, 0x69, + 0x5c, 0xf3, 0xdb, 0x1c, 0x58, 0x48, 0x91, 0xac, 0xba, 0x4e, 0x8d, 0x72, 0xea, 0x3a, 0xf0, 0x1a, + 0xc8, 0xf3, 0x9d, 0x56, 0x98, 0xe2, 0x97, 0x42, 0x43, 0x37, 0x76, 0x5a, 0xe4, 0xa5, 0x6f, 0x9c, + 0xdd, 0x4d, 0x5e, 0xf0, 0x21, 0x89, 0x00, 0x57, 0xa2, 0x3f, 0x94, 0x4d, 0x60, 0x69, 0xb3, 0x5e, + 0xfa, 0xc6, 0x80, 0x66, 0x66, 0x45, 0x48, 0x49, 0xe3, 0x45, 0x45, 0x68, 0x60, 0x8f, 0x6f, 0x30, + 0xec, 0x78, 0x4a, 0x13, 0x6d, 0x86, 0x19, 0xfe, 0xd6, 0xde, 0x82, 0x2c, 0x24, 0x2a, 0xf3, 0xda, + 0x0a, 0xb8, 0xd2, 0x87, 0x86, 0x06, 0x68, 0x80, 0xe7, 0xc0, 0x38, 0x23, 0xd8, 0x73, 0x1d, 0x99, + 0xdc, 0x93, 0x5d, 0xe7, 0x22, 0xf9, 0x15, 0x69, 0x2a, 0xfc, 0x3f, 0x38, 0xd2, 0x24, 0x9e, 0x87, + 0xeb, 0x64, 0xae, 0x20, 0x19, 0x67, 0x34, 0xe3, 0x91, 0x55, 0xf5, 0x19, 0x85, 0x74, 0xf3, 0xf7, + 0x0c, 0x38, 0x9d, 0xe2, 0xc7, 0x15, 0xea, 0x71, 0xf8, 0x45, 0x5f, 0x16, 0x5b, 0x7b, 0xac, 0x18, + 0xd4, 0x53, 0x39, 0x3c, 0xab, 0x75, 0x4f, 0x84, 0x5f, 0x62, 0x19, 0xfc, 0x09, 0x28, 0x50, 0x4e, + 0x9a, 0x22, 0x2a, 0xb9, 0xf3, 0xc5, 0xa5, 0xa5, 0xfd, 0xa7, 0x59, 0xe5, 0xa8, 0x86, 0x2f, 0x5c, + 0x17, 0x40, 0x48, 0xe1, 0x99, 0x7f, 0x65, 0x53, 0xff, 0x96, 0x48, 0x73, 0xd8, 0x01, 0xd3, 0xf2, + 0xa4, 0x4a, 0x31, 0x22, 0xf7, 0xf5, 0x9f, 0x1b, 0x76, 0x89, 0x86, 0x34, 0xef, 0xca, 0x09, 0x6d, + 0xc5, 0xf4, 0x7a, 0x02, 0x15, 0xf5, 0x68, 0x81, 0x8b, 0xa0, 0xd8, 0xa4, 0x0e, 0x22, 0xad, 0x06, + 0xb5, 0xb1, 0x4a, 0xc6, 0x82, 0x6a, 0x3f, 0xab, 0xdd, 0xcf, 0x28, 0xce, 0x03, 0xdf, 0x03, 0xc5, + 0x26, 0x7e, 0x18, 0x89, 0xe4, 0xa4, 0xc8, 0x31, 0xad, 0xaf, 0xb8, 0xda, 0x25, 0xa1, 0x38, 0x1f, + 0x7c, 0x00, 0x4a, 0xaa, 0xa7, 0x54, 0xd7, 0x6e, 0xdf, 0xe6, 0xb4, 0x41, 0x1f, 0x61, 0x91, 0x47, + 0x6b, 0x84, 0xd9, 0xc4, 0xe1, 0x22, 0x35, 0xf2, 0x12, 0xc9, 0x0c, 0x7c, 0xa3, 0xb4, 0x31, 0x94, + 0x13, 0xed, 0x82, 0x64, 0x3e, 0xc9, 0x81, 0x33, 0x43, 0xcb, 0x00, 0xbc, 0x0a, 0xa0, 0xbb, 0xe9, + 0x11, 0xd6, 0x21, 0xb5, 0x8f, 0xd4, 0x5c, 0x24, 0x06, 0x14, 0xe1, 0xf3, 0x9c, 0xea, 0x89, 0x37, + 0xfb, 0xa8, 0x68, 0x80, 0x04, 0xb4, 0xc1, 0x51, 0x71, 0x2f, 0x94, 0x97, 0xa9, 0x9e, 0x85, 0xf6, + 0x77, 0xe9, 0xfe, 0x13, 0xf8, 0xc6, 0xd1, 0x95, 0x38, 0x08, 0x4a, 0x62, 0xc2, 0x65, 0x30, 0xa3, + 0x8b, 0x7d, 0x8f, 0xd7, 0x4f, 0x6a, 0xaf, 0xcf, 0x54, 0x93, 0x64, 0xd4, 0xcb, 0x2f, 0x20, 0x6a, + 0xc4, 0xa3, 0x8c, 0xd4, 0x22, 0x88, 0x7c, 0x12, 0xe2, 0x83, 0x24, 0x19, 0xf5, 0xf2, 0xc3, 0x26, + 0x30, 0x34, 0x6a, 0x6a, 0x04, 0x0b, 0x12, 0xf2, 0x7f, 0x81, 0x6f, 0x18, 0xd5, 0xe1, 0xac, 0x68, + 0x37, 0x2c, 0x31, 0x06, 0xea, 0xd9, 0x41, 0x5e, 0x90, 0x4b, 0x89, 0xd2, 0xbb, 0xd0, 0x53, 0x7a, + 0x67, 0xe3, 0x83, 0x62, 0xac, 0xcc, 0xde, 0x02, 0xe3, 0xae, 0xbc, 0x19, 0x3a, 0x2e, 0x17, 0x86, + 0x5c, 0xa7, 0xa8, 0xa5, 0x45, 0x40, 0x15, 0x20, 0x6a, 0x99, 0xbe, 0x5a, 0x1a, 0x08, 0x5e, 0x07, + 0xf9, 0x96, 0x5b, 0x0b, 0x1b, 0xd1, 0xdb, 0x43, 0x00, 0xd7, 0xdc, 0x9a, 0x97, 0x80, 0x9b, 0x10, + 0x16, 0x8b, 0xaf, 0x48, 0x42, 0xc0, 0x4f, 0xc1, 0x44, 0xd8, 0xf0, 0xf5, 0x74, 0x50, 0x1e, 0x02, + 0x87, 0x34, 0x6b, 0x02, 0x72, 0x4a, 0x14, 0xb2, 0x90, 0x82, 0x22, 0x38, 0x01, 0x4d, 0xf4, 0xa8, + 0x26, 0xa3, 0x32, 0x1c, 0x7a, 0xd0, 0xb8, 0xad, 0xa0, 0x43, 0x0a, 0x8a, 0xe0, 0xcc, 0x1f, 0x73, + 0x60, 0x2a, 0x31, 0xfe, 0x1d, 0x72, 0x68, 0x54, 0x1f, 0x3f, 0xb0, 0xd0, 0x28, 0xb8, 0x03, 0x0d, + 0x8d, 0x82, 0x7c, 0x2d, 0xa1, 0x89, 0x41, 0x0f, 0x08, 0xcd, 0xcf, 0x39, 0x00, 0xfb, 0xd3, 0x18, + 0x7e, 0x09, 0xc6, 0x55, 0xc1, 0x7c, 0xc5, 0xa6, 0x12, 0xb5, 0x77, 0xdd, 0x3f, 0x34, 0x6a, 0xcf, + 0xfc, 0x9f, 0xdd, 0xd3, 0xfc, 0x4f, 0x0e, 0x62, 0x4f, 0x8a, 0xba, 0x4e, 0xea, 0xae, 0xf4, 0x0e, + 0x98, 0xf0, 0xc2, 0x05, 0x43, 0xcd, 0x28, 0x51, 0xfb, 0x8f, 0x36, 0x85, 0x88, 0x03, 0xd6, 0xc0, + 0x14, 0x8e, 0x8f, 0xec, 0x85, 0x91, 0xac, 0x9a, 0x15, 0xfb, 0x41, 0x62, 0x56, 0x4f, 0xa0, 0x9a, + 0xbf, 0xf4, 0x46, 0x49, 0x5d, 0xa3, 0x37, 0x31, 0x4a, 0x87, 0xb7, 0x34, 0xbd, 0x89, 0x81, 0x7a, + 0x92, 0x05, 0xb3, 0xbd, 0x45, 0x7c, 0xa4, 0x65, 0xf7, 0xd1, 0xc0, 0x8d, 0x3d, 0x3b, 0x92, 0xd1, + 0xd1, 0x8c, 0xbe, 0xb7, 0xad, 0x3d, 0xe1, 0xd8, 0xdc, 0xae, 0x8e, 0xbd, 0x09, 0x0a, 0x9d, 0x57, + 0xd8, 0x56, 0x27, 0xc5, 0xe0, 0xab, 0x6c, 0x51, 0x38, 0xe6, 0x6f, 0x49, 0x1f, 0x8e, 0xfe, 0x60, + 0xf0, 0xd5, 0xe0, 0xad, 0x7a, 0x34, 0x27, 0x9e, 0xd6, 0xca, 0xf6, 0xbc, 0x59, 0xff, 0xd3, 0x6e, + 0xfc, 0x35, 0x0b, 0x8e, 0x0f, 0x1a, 0x00, 0x60, 0x55, 0xbf, 0xc1, 0x29, 0x27, 0x96, 0xe3, 0x6f, + 0x70, 0x2f, 0x7d, 0xc3, 0x18, 0xb0, 0x44, 0x86, 0x30, 0xb1, 0x67, 0xba, 0xbb, 0x60, 0x2e, 0x91, + 0x39, 0xb1, 0x89, 0x4c, 0xaf, 0x04, 0xff, 0x0d, 0x7c, 0x63, 0x6e, 0x23, 0x85, 0x07, 0xa5, 0x4a, + 0xa7, 0xbc, 0x55, 0xe5, 0x5e, 0xfb, 0x5b, 0xd5, 0xe3, 0x7e, 0x7f, 0xa9, 0xd4, 0x3b, 0x10, 0x7f, + 0x7d, 0x0e, 0x4e, 0x25, 0x73, 0xa4, 0xdf, 0x61, 0x67, 0x02, 0xdf, 0x38, 0x55, 0x4d, 0x63, 0x42, + 0xe9, 0xf2, 0x69, 0x89, 0x9e, 0x3b, 0x9c, 0x44, 0x37, 0xbf, 0xc9, 0x82, 0x82, 0x5c, 0x3d, 0x0e, + 0xe1, 0xc1, 0xe8, 0x6a, 0xe2, 0xc1, 0xe8, 0xec, 0x90, 0x86, 0x27, 0x2d, 0x4a, 0x7d, 0x1e, 0xba, + 0xd1, 0xf3, 0x3c, 0x74, 0x6e, 0x57, 0xa4, 0xe1, 0x8f, 0x41, 0xef, 0x83, 0xc9, 0x48, 0xa1, 0xb8, + 0xf9, 0x2c, 0xdc, 0x99, 0x32, 0x32, 0xb6, 0xd1, 0xcd, 0x8f, 0x96, 0xa5, 0x88, 0xc3, 0xa4, 0xa0, + 0x18, 0xd3, 0xb0, 0x3f, 0xe1, 0x44, 0x91, 0xc9, 0xee, 0x56, 0x64, 0x2a, 0xe7, 0x9f, 0xbe, 0x28, + 0x8d, 0x3d, 0x7b, 0x51, 0x1a, 0x7b, 0xfe, 0xa2, 0x34, 0xf6, 0x75, 0x50, 0xca, 0x3c, 0x0d, 0x4a, + 0x99, 0x67, 0x41, 0x29, 0xf3, 0x3c, 0x28, 0x65, 0xfe, 0x08, 0x4a, 0x99, 0xef, 0xfe, 0x2c, 0x8d, + 0x7d, 0x96, 0xed, 0x2c, 0xfe, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x85, 0x3c, 0x66, 0x84, 0xa7, 0x19, + 0x00, 0x00, +>>>>>>> Update autoscaling conversion and validation for v2beta2 inclusion } diff --git a/staging/src/k8s.io/api/autoscaling/v1/generated.proto b/staging/src/k8s.io/api/autoscaling/v1/generated.proto index a3c542de25c..0fdad06c4db 100644 --- a/staging/src/k8s.io/api/autoscaling/v1/generated.proto +++ b/staging/src/k8s.io/api/autoscaling/v1/generated.proto @@ -257,6 +257,16 @@ message ObjectMetricSource { // targetValue is the target value of the metric (as a quantity). optional k8s.io.apimachinery.pkg.api.resource.Quantity targetValue = 3; + + // selector is the selector for the given metric + // it is the string-encoded form of a standard kubernetes label selector + // +optional + optional string selector = 4; + + // averageValue is the target value of the average of the + // metric across all relevant pods (as a quantity) + // +optional + optional k8s.io.apimachinery.pkg.api.resource.Quantity averageValue = 5; } // ObjectMetricStatus indicates the current value of a metric describing a @@ -270,6 +280,16 @@ message ObjectMetricStatus { // currentValue is the current value of the metric (as a quantity). optional k8s.io.apimachinery.pkg.api.resource.Quantity currentValue = 3; + + // selector is the selector for the given metric + // it is the string-encoded form of a standard kubernetes label selector + // +optional + optional string selector = 4; + + // averageValue is the current value of the average of the + // metric across all relevant pods (as a quantity) + // +optional + optional k8s.io.apimachinery.pkg.api.resource.Quantity averageValue = 5; } // PodsMetricSource indicates how to scale on a metric describing each pod in @@ -283,6 +303,15 @@ message PodsMetricSource { // targetAverageValue is the target value of the average of the // metric across all relevant pods (as a quantity) optional k8s.io.apimachinery.pkg.api.resource.Quantity targetAverageValue = 2; + + // selector is the selector for the given metric + // it is the string-encoded form of a standard kubernetes label selector + // +optional + optional string selector = 3; + + // value is the target value of the metric (as a quantity). + // +optional + optional k8s.io.apimachinery.pkg.api.resource.Quantity value = 4; } // PodsMetricStatus indicates the current value of a metric describing each pod in @@ -294,6 +323,15 @@ message PodsMetricStatus { // currentAverageValue is the current value of the average of the // metric across all relevant pods (as a quantity) optional k8s.io.apimachinery.pkg.api.resource.Quantity currentAverageValue = 2; + + // selector is the selector for the given metric + // it is the string-encoded form of a standard kubernetes label selector + // +optional + optional string selector = 3; + + // value is the current value of the metric (as a quantity) + // +optional + optional k8s.io.apimachinery.pkg.api.resource.Quantity value = 4; } // ResourceMetricSource indicates how to scale on a resource metric known to diff --git a/staging/src/k8s.io/api/autoscaling/v1/types_swagger_doc_generated.go b/staging/src/k8s.io/api/autoscaling/v1/types_swagger_doc_generated.go index e84909269db..b1bdf1eb987 100644 --- a/staging/src/k8s.io/api/autoscaling/v1/types_swagger_doc_generated.go +++ b/staging/src/k8s.io/api/autoscaling/v1/types_swagger_doc_generated.go @@ -148,10 +148,12 @@ func (MetricStatus) SwaggerDoc() map[string]string { } var map_ObjectMetricSource = map[string]string{ - "": "ObjectMetricSource indicates how to scale on a metric describing a kubernetes object (for example, hits-per-second on an Ingress object).", - "target": "target is the described Kubernetes object.", - "metricName": "metricName is the name of the metric in question.", - "targetValue": "targetValue is the target value of the metric (as a quantity).", + "": "ObjectMetricSource indicates how to scale on a metric describing a kubernetes object (for example, hits-per-second on an Ingress object).", + "target": "target is the described Kubernetes object.", + "metricName": "metricName is the name of the metric in question.", + "targetValue": "targetValue is the target value of the metric (as a quantity).", + "selector": "selector is the selector for the given metric it is the string-encoded form of a standard kubernetes label selector", + "averageValue": "averageValue is the target value of the average of the metric across all relevant pods (as a quantity)", } func (ObjectMetricSource) SwaggerDoc() map[string]string { @@ -163,6 +165,8 @@ var map_ObjectMetricStatus = map[string]string{ "target": "target is the described Kubernetes object.", "metricName": "metricName is the name of the metric in question.", "currentValue": "currentValue is the current value of the metric (as a quantity).", + "selector": "selector is the selector for the given metric it is the string-encoded form of a standard kubernetes label selector", + "averageValue": "averageValue is the current value of the average of the metric across all relevant pods (as a quantity)", } func (ObjectMetricStatus) SwaggerDoc() map[string]string { @@ -173,6 +177,8 @@ var map_PodsMetricSource = map[string]string{ "": "PodsMetricSource indicates how to scale on a metric describing each pod in the current scale target (for example, transactions-processed-per-second). The values will be averaged together before being compared to the target value.", "metricName": "metricName is the name of the metric in question", "targetAverageValue": "targetAverageValue is the target value of the average of the metric across all relevant pods (as a quantity)", + "selector": "selector is the selector for the given metric it is the string-encoded form of a standard kubernetes label selector", + "value": "value is the target value of the metric (as a quantity).", } func (PodsMetricSource) SwaggerDoc() map[string]string { @@ -183,6 +189,8 @@ var map_PodsMetricStatus = map[string]string{ "": "PodsMetricStatus indicates the current value of a metric describing each pod in the current scale target (for example, transactions-processed-per-second).", "metricName": "metricName is the name of the metric in question", "currentAverageValue": "currentAverageValue is the current value of the average of the metric across all relevant pods (as a quantity)", + "selector": "selector is the selector for the given metric it is the string-encoded form of a standard kubernetes label selector", + "value": "value is the current value of the metric (as a quantity)", } func (PodsMetricStatus) SwaggerDoc() map[string]string { diff --git a/staging/src/k8s.io/api/autoscaling/v1/zz_generated.deepcopy.go b/staging/src/k8s.io/api/autoscaling/v1/zz_generated.deepcopy.go index 6bafc0887f2..25af97ac803 100644 --- a/staging/src/k8s.io/api/autoscaling/v1/zz_generated.deepcopy.go +++ b/staging/src/k8s.io/api/autoscaling/v1/zz_generated.deepcopy.go @@ -311,6 +311,11 @@ func (in *ObjectMetricSource) DeepCopyInto(out *ObjectMetricSource) { *out = *in out.Target = in.Target out.TargetValue = in.TargetValue.DeepCopy() + if in.AverageValue != nil { + in, out := &in.AverageValue, &out.AverageValue + x := (*in).DeepCopy() + *out = &x + } return } @@ -329,6 +334,11 @@ func (in *ObjectMetricStatus) DeepCopyInto(out *ObjectMetricStatus) { *out = *in out.Target = in.Target out.CurrentValue = in.CurrentValue.DeepCopy() + if in.AverageValue != nil { + in, out := &in.AverageValue, &out.AverageValue + x := (*in).DeepCopy() + *out = &x + } return } @@ -346,6 +356,11 @@ func (in *ObjectMetricStatus) DeepCopy() *ObjectMetricStatus { func (in *PodsMetricSource) DeepCopyInto(out *PodsMetricSource) { *out = *in out.TargetAverageValue = in.TargetAverageValue.DeepCopy() + if in.Value != nil { + in, out := &in.Value, &out.Value + x := (*in).DeepCopy() + *out = &x + } return } @@ -363,6 +378,11 @@ func (in *PodsMetricSource) DeepCopy() *PodsMetricSource { func (in *PodsMetricStatus) DeepCopyInto(out *PodsMetricStatus) { *out = *in out.CurrentAverageValue = in.CurrentAverageValue.DeepCopy() + if in.Value != nil { + in, out := &in.Value, &out.Value + x := (*in).DeepCopy() + *out = &x + } return } diff --git a/staging/src/k8s.io/api/autoscaling/v2beta1/generated.pb.go b/staging/src/k8s.io/api/autoscaling/v2beta1/generated.pb.go index 33f67913a94..37a8583eab7 100644 --- a/staging/src/k8s.io/api/autoscaling/v2beta1/generated.pb.go +++ b/staging/src/k8s.io/api/autoscaling/v2beta1/generated.pb.go @@ -683,6 +683,20 @@ func (m *ObjectMetricSource) MarshalTo(dAtA []byte) (int, error) { return 0, err } i += n23 + dAtA[i] = 0x22 + i++ + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Selector))) + i += copy(dAtA[i:], m.Selector) + if m.AverageValue != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintGenerated(dAtA, i, uint64(m.AverageValue.Size())) + n24, err := m.AverageValue.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n24 + } return i, nil } @@ -704,11 +718,11 @@ func (m *ObjectMetricStatus) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0xa i++ i = encodeVarintGenerated(dAtA, i, uint64(m.Target.Size())) - n24, err := m.Target.MarshalTo(dAtA[i:]) + n25, err := m.Target.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n24 + i += n25 dAtA[i] = 0x12 i++ i = encodeVarintGenerated(dAtA, i, uint64(len(m.MetricName))) @@ -716,11 +730,25 @@ func (m *ObjectMetricStatus) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x1a i++ i = encodeVarintGenerated(dAtA, i, uint64(m.CurrentValue.Size())) - n25, err := m.CurrentValue.MarshalTo(dAtA[i:]) + n26, err := m.CurrentValue.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n25 + i += n26 + dAtA[i] = 0x22 + i++ + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Selector))) + i += copy(dAtA[i:], m.Selector) + if m.AverageValue != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintGenerated(dAtA, i, uint64(m.AverageValue.Size())) + n27, err := m.AverageValue.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n27 + } return i, nil } @@ -746,11 +774,25 @@ func (m *PodsMetricSource) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x12 i++ i = encodeVarintGenerated(dAtA, i, uint64(m.TargetAverageValue.Size())) - n26, err := m.TargetAverageValue.MarshalTo(dAtA[i:]) + n28, err := m.TargetAverageValue.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n26 + i += n28 + dAtA[i] = 0x1a + i++ + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Selector))) + i += copy(dAtA[i:], m.Selector) + if m.Value != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintGenerated(dAtA, i, uint64(m.Value.Size())) + n29, err := m.Value.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n29 + } return i, nil } @@ -776,11 +818,25 @@ func (m *PodsMetricStatus) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x12 i++ i = encodeVarintGenerated(dAtA, i, uint64(m.CurrentAverageValue.Size())) - n27, err := m.CurrentAverageValue.MarshalTo(dAtA[i:]) + n30, err := m.CurrentAverageValue.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n27 + i += n30 + dAtA[i] = 0x1a + i++ + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Selector))) + i += copy(dAtA[i:], m.Selector) + if m.Value != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintGenerated(dAtA, i, uint64(m.Value.Size())) + n31, err := m.Value.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n31 + } return i, nil } @@ -812,11 +868,11 @@ func (m *ResourceMetricSource) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x1a i++ i = encodeVarintGenerated(dAtA, i, uint64(m.TargetAverageValue.Size())) - n28, err := m.TargetAverageValue.MarshalTo(dAtA[i:]) + n32, err := m.TargetAverageValue.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n28 + i += n32 } return i, nil } @@ -848,11 +904,11 @@ func (m *ResourceMetricStatus) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x1a i++ i = encodeVarintGenerated(dAtA, i, uint64(m.CurrentAverageValue.Size())) - n29, err := m.CurrentAverageValue.MarshalTo(dAtA[i:]) + n33, err := m.CurrentAverageValue.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n29 + i += n33 return i, nil } @@ -1077,6 +1133,12 @@ func (m *ObjectMetricSource) Size() (n int) { n += 1 + l + sovGenerated(uint64(l)) l = m.TargetValue.Size() n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Selector) + n += 1 + l + sovGenerated(uint64(l)) + if m.AverageValue != nil { + l = m.AverageValue.Size() + n += 1 + l + sovGenerated(uint64(l)) + } return n } @@ -1089,6 +1151,12 @@ func (m *ObjectMetricStatus) Size() (n int) { n += 1 + l + sovGenerated(uint64(l)) l = m.CurrentValue.Size() n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Selector) + n += 1 + l + sovGenerated(uint64(l)) + if m.AverageValue != nil { + l = m.AverageValue.Size() + n += 1 + l + sovGenerated(uint64(l)) + } return n } @@ -1099,6 +1167,12 @@ func (m *PodsMetricSource) Size() (n int) { n += 1 + l + sovGenerated(uint64(l)) l = m.TargetAverageValue.Size() n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Selector) + n += 1 + l + sovGenerated(uint64(l)) + if m.Value != nil { + l = m.Value.Size() + n += 1 + l + sovGenerated(uint64(l)) + } return n } @@ -1109,6 +1183,12 @@ func (m *PodsMetricStatus) Size() (n int) { n += 1 + l + sovGenerated(uint64(l)) l = m.CurrentAverageValue.Size() n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Selector) + n += 1 + l + sovGenerated(uint64(l)) + if m.Value != nil { + l = m.Value.Size() + n += 1 + l + sovGenerated(uint64(l)) + } return n } @@ -1292,6 +1372,8 @@ func (this *ObjectMetricSource) String() string { `Target:` + strings.Replace(strings.Replace(this.Target.String(), "CrossVersionObjectReference", "CrossVersionObjectReference", 1), `&`, ``, 1) + `,`, `MetricName:` + fmt.Sprintf("%v", this.MetricName) + `,`, `TargetValue:` + strings.Replace(strings.Replace(this.TargetValue.String(), "Quantity", "k8s_io_apimachinery_pkg_api_resource.Quantity", 1), `&`, ``, 1) + `,`, + `Selector:` + fmt.Sprintf("%v", this.Selector) + `,`, + `AverageValue:` + strings.Replace(fmt.Sprintf("%v", this.AverageValue), "Quantity", "k8s_io_apimachinery_pkg_api_resource.Quantity", 1) + `,`, `}`, }, "") return s @@ -1304,6 +1386,8 @@ func (this *ObjectMetricStatus) String() string { `Target:` + strings.Replace(strings.Replace(this.Target.String(), "CrossVersionObjectReference", "CrossVersionObjectReference", 1), `&`, ``, 1) + `,`, `MetricName:` + fmt.Sprintf("%v", this.MetricName) + `,`, `CurrentValue:` + strings.Replace(strings.Replace(this.CurrentValue.String(), "Quantity", "k8s_io_apimachinery_pkg_api_resource.Quantity", 1), `&`, ``, 1) + `,`, + `Selector:` + fmt.Sprintf("%v", this.Selector) + `,`, + `AverageValue:` + strings.Replace(fmt.Sprintf("%v", this.AverageValue), "Quantity", "k8s_io_apimachinery_pkg_api_resource.Quantity", 1) + `,`, `}`, }, "") return s @@ -1315,6 +1399,8 @@ func (this *PodsMetricSource) String() string { s := strings.Join([]string{`&PodsMetricSource{`, `MetricName:` + fmt.Sprintf("%v", this.MetricName) + `,`, `TargetAverageValue:` + strings.Replace(strings.Replace(this.TargetAverageValue.String(), "Quantity", "k8s_io_apimachinery_pkg_api_resource.Quantity", 1), `&`, ``, 1) + `,`, + `Selector:` + fmt.Sprintf("%v", this.Selector) + `,`, + `Value:` + strings.Replace(fmt.Sprintf("%v", this.Value), "Quantity", "k8s_io_apimachinery_pkg_api_resource.Quantity", 1) + `,`, `}`, }, "") return s @@ -1326,6 +1412,8 @@ func (this *PodsMetricStatus) String() string { s := strings.Join([]string{`&PodsMetricStatus{`, `MetricName:` + fmt.Sprintf("%v", this.MetricName) + `,`, `CurrentAverageValue:` + strings.Replace(strings.Replace(this.CurrentAverageValue.String(), "Quantity", "k8s_io_apimachinery_pkg_api_resource.Quantity", 1), `&`, ``, 1) + `,`, + `Selector:` + fmt.Sprintf("%v", this.Selector) + `,`, + `Value:` + strings.Replace(fmt.Sprintf("%v", this.Value), "Quantity", "k8s_io_apimachinery_pkg_api_resource.Quantity", 1) + `,`, `}`, }, "") return s @@ -3192,6 +3280,68 @@ func (m *ObjectMetricSource) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Selector", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Selector = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AverageValue", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.AverageValue == nil { + m.AverageValue = &k8s_io_apimachinery_pkg_api_resource.Quantity{} + } + if err := m.AverageValue.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -3331,6 +3481,68 @@ func (m *ObjectMetricStatus) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Selector", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Selector = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AverageValue", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.AverageValue == nil { + m.AverageValue = &k8s_io_apimachinery_pkg_api_resource.Quantity{} + } + if err := m.AverageValue.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -3440,6 +3652,68 @@ func (m *PodsMetricSource) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Selector", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Selector = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Value == nil { + m.Value = &k8s_io_apimachinery_pkg_api_resource.Quantity{} + } + if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -3549,6 +3823,68 @@ func (m *PodsMetricStatus) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Selector", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Selector = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Value == nil { + m.Value = &k8s_io_apimachinery_pkg_api_resource.Quantity{} + } + if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -3941,6 +4277,7 @@ func init() { } var fileDescriptorGenerated = []byte{ +<<<<<<< HEAD // 1426 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x58, 0xcb, 0x8f, 0x1b, 0x45, 0x13, 0x5f, 0x3f, 0x76, 0xb3, 0x69, 0x6f, 0x76, 0xf3, 0x75, 0xa2, 0xc4, 0xd9, 0x7c, 0xf1, 0xac, @@ -4032,4 +4369,101 @@ var fileDescriptorGenerated = []byte{ 0xb9, 0x1f, 0x96, 0x32, 0x0f, 0xc2, 0x52, 0xe6, 0x8f, 0xb0, 0x94, 0xf9, 0xe2, 0xcf, 0xd2, 0xdc, 0x7b, 0x87, 0x74, 0xdd, 0xfb, 0x2b, 0x00, 0x00, 0xff, 0xff, 0xe1, 0xb1, 0xdd, 0xcd, 0x57, 0x16, 0x00, 0x00, +======= + // 1498 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x58, 0xcd, 0x6f, 0x1b, 0x45, + 0x14, 0x8f, 0x3f, 0x92, 0xa6, 0xe3, 0x34, 0x09, 0xd3, 0xaa, 0x75, 0x53, 0x6a, 0x47, 0x16, 0x42, + 0xa5, 0x6a, 0x77, 0x5b, 0x37, 0x7c, 0x48, 0x08, 0x89, 0xd8, 0x40, 0x5b, 0x11, 0xb7, 0x65, 0x92, + 0x56, 0x08, 0x0a, 0x62, 0xbc, 0x9e, 0x3a, 0x43, 0xec, 0x5d, 0x6b, 0x66, 0x6c, 0x35, 0x45, 0x48, + 0x5c, 0xb8, 0x73, 0x81, 0x33, 0x47, 0xc4, 0xc7, 0x15, 0xce, 0x95, 0x38, 0xf4, 0xd8, 0x63, 0x11, + 0x92, 0x45, 0xcd, 0x7f, 0xd1, 0x13, 0x9a, 0x8f, 0x5d, 0xef, 0xda, 0xde, 0xd8, 0x75, 0xd3, 0x0f, + 0x6e, 0x3b, 0xf3, 0xde, 0xfb, 0xbd, 0xb7, 0xef, 0xbd, 0x79, 0xf3, 0xde, 0x80, 0x8b, 0x3b, 0x6f, + 0x71, 0x8b, 0x7a, 0xf6, 0x4e, 0xbb, 0x4a, 0x98, 0x4b, 0x04, 0xe1, 0x76, 0x87, 0xb8, 0x35, 0x8f, + 0xd9, 0x86, 0x80, 0x5b, 0xd4, 0xc6, 0x6d, 0xe1, 0x71, 0x07, 0x37, 0xa8, 0x5b, 0xb7, 0x3b, 0xc5, + 0x2a, 0x11, 0xf8, 0xbc, 0x5d, 0x27, 0x2e, 0x61, 0x58, 0x90, 0x9a, 0xd5, 0x62, 0x9e, 0xf0, 0x60, + 0x4e, 0xf3, 0x5b, 0xb8, 0x45, 0xad, 0x10, 0xbf, 0x65, 0xf8, 0x57, 0xce, 0xd6, 0xa9, 0xd8, 0x6e, + 0x57, 0x2d, 0xc7, 0x6b, 0xda, 0x75, 0xaf, 0xee, 0xd9, 0x4a, 0xac, 0xda, 0xbe, 0xa5, 0x56, 0x6a, + 0xa1, 0xbe, 0x34, 0xdc, 0x4a, 0x21, 0xa4, 0xde, 0xf1, 0x18, 0xb1, 0x3b, 0x43, 0x2a, 0x57, 0xd6, + 0xfa, 0x3c, 0x4d, 0xec, 0x6c, 0x53, 0x97, 0xb0, 0x5d, 0xbb, 0xb5, 0x53, 0x57, 0x42, 0x8c, 0x70, + 0xaf, 0xcd, 0x1c, 0xf2, 0x58, 0x52, 0xdc, 0x6e, 0x12, 0x81, 0x47, 0xe9, 0xb2, 0xe3, 0xa4, 0x58, + 0xdb, 0x15, 0xb4, 0x39, 0xac, 0xe6, 0x8d, 0x71, 0x02, 0xdc, 0xd9, 0x26, 0x4d, 0x3c, 0x24, 0x77, + 0x21, 0x4e, 0xae, 0x2d, 0x68, 0xc3, 0xa6, 0xae, 0xe0, 0x82, 0x0d, 0x0a, 0x15, 0xbe, 0x4f, 0x80, + 0x13, 0x65, 0xe6, 0x71, 0x7e, 0x83, 0x30, 0x4e, 0x3d, 0xf7, 0x6a, 0xf5, 0x4b, 0xe2, 0x08, 0x44, + 0x6e, 0x11, 0x46, 0x5c, 0x87, 0xc0, 0x55, 0x90, 0xde, 0xa1, 0x6e, 0x2d, 0x9b, 0x58, 0x4d, 0x9c, + 0x3a, 0x58, 0x5a, 0xb8, 0xd7, 0xcd, 0xcf, 0xf4, 0xba, 0xf9, 0xf4, 0x87, 0xd4, 0xad, 0x21, 0x45, + 0x91, 0x1c, 0x2e, 0x6e, 0x92, 0x6c, 0x32, 0xca, 0x71, 0x05, 0x37, 0x09, 0x52, 0x14, 0x58, 0x04, + 0x00, 0xb7, 0xa8, 0x51, 0x90, 0x4d, 0x29, 0x3e, 0x68, 0xf8, 0xc0, 0xfa, 0xb5, 0xcb, 0x86, 0x82, + 0x42, 0x5c, 0x85, 0x1f, 0x52, 0xe0, 0xc8, 0xfb, 0xb7, 0x05, 0x61, 0x2e, 0x6e, 0x54, 0x88, 0x60, + 0xd4, 0xd9, 0x54, 0x41, 0x91, 0x60, 0x4d, 0xb5, 0x96, 0x0a, 0x8c, 0x59, 0x01, 0x58, 0x25, 0xa0, + 0xa0, 0x10, 0x17, 0xf4, 0xc0, 0xa2, 0x5e, 0x6d, 0x92, 0x06, 0x71, 0x84, 0xc7, 0x94, 0xb1, 0x99, + 0xe2, 0x05, 0xab, 0x9f, 0x7a, 0x81, 0xcb, 0xac, 0xd6, 0x4e, 0x5d, 0x6e, 0x70, 0x4b, 0x46, 0xd4, + 0xea, 0x9c, 0xb7, 0x36, 0x70, 0x95, 0x34, 0x7c, 0xd1, 0x12, 0xec, 0x75, 0xf3, 0x8b, 0x95, 0x08, + 0x1c, 0x1a, 0x80, 0x87, 0x18, 0x64, 0x04, 0x66, 0x75, 0x22, 0x6e, 0xe0, 0x46, 0x9b, 0xa8, 0x5f, + 0xce, 0x14, 0xad, 0xbd, 0xb4, 0x59, 0x7e, 0xd6, 0x59, 0x1f, 0xb5, 0xb1, 0x2b, 0xa8, 0xd8, 0x2d, + 0x2d, 0xf5, 0xba, 0xf9, 0xcc, 0x56, 0x1f, 0x06, 0x85, 0x31, 0x61, 0x07, 0x40, 0xbd, 0x5c, 0xef, + 0x10, 0x86, 0xeb, 0x44, 0x6b, 0x4a, 0x4f, 0xa5, 0xe9, 0x68, 0xaf, 0x9b, 0x87, 0x5b, 0x43, 0x68, + 0x68, 0x84, 0x86, 0xc2, 0x8f, 0xc3, 0x81, 0x11, 0x58, 0xb4, 0xf9, 0xff, 0x23, 0x30, 0xdb, 0x60, + 0xc1, 0x69, 0x33, 0x46, 0xdc, 0x27, 0x8a, 0xcc, 0x11, 0xf3, 0x5b, 0x0b, 0xe5, 0x10, 0x16, 0x8a, + 0x20, 0xc3, 0x5d, 0x70, 0xd8, 0xac, 0xf7, 0x21, 0x40, 0xc7, 0x7a, 0xdd, 0xfc, 0xe1, 0xf2, 0x30, + 0x1c, 0x1a, 0xa5, 0xa3, 0x70, 0x37, 0x09, 0x8e, 0x5d, 0xf2, 0x18, 0xbd, 0xe3, 0xb9, 0x02, 0x37, + 0xae, 0x79, 0xb5, 0x75, 0x53, 0x55, 0x09, 0x83, 0x5f, 0x80, 0x79, 0xe9, 0xbd, 0x1a, 0x16, 0x58, + 0xc5, 0x28, 0x53, 0x3c, 0x37, 0x99, 0xaf, 0x75, 0x61, 0xa8, 0x10, 0x81, 0xfb, 0x51, 0xed, 0xef, + 0xa1, 0x00, 0x15, 0x7e, 0x06, 0xd2, 0xbc, 0x45, 0x1c, 0x13, 0xc9, 0xb7, 0xad, 0xbd, 0xab, 0xbb, + 0x15, 0x63, 0xe8, 0x66, 0x8b, 0x38, 0xfd, 0x62, 0x22, 0x57, 0x48, 0xc1, 0x42, 0x02, 0xe6, 0xb8, + 0x4a, 0x38, 0x13, 0xbb, 0x77, 0xa6, 0x55, 0xa0, 0x40, 0x4a, 0x8b, 0x46, 0xc5, 0x9c, 0x5e, 0x23, + 0x03, 0x5e, 0xf8, 0x36, 0x05, 0x56, 0x63, 0x24, 0xcb, 0x9e, 0x5b, 0xa3, 0x82, 0x7a, 0x2e, 0xbc, + 0x04, 0xd2, 0x62, 0xb7, 0xe5, 0x27, 0xfb, 0x9a, 0x6f, 0xed, 0xd6, 0x6e, 0x8b, 0x3c, 0xea, 0xe6, + 0x5f, 0x19, 0x27, 0x2f, 0xf9, 0x90, 0x42, 0x80, 0x1b, 0xc1, 0x5f, 0x25, 0x23, 0x58, 0xc6, 0xac, + 0x47, 0xdd, 0xfc, 0x88, 0x6b, 0xcd, 0x0a, 0x90, 0xa2, 0xc6, 0xcb, 0xda, 0xd0, 0xc0, 0x5c, 0x6c, + 0x31, 0xec, 0x72, 0xad, 0x89, 0x36, 0xfd, 0x5c, 0x3f, 0x3d, 0x59, 0xb8, 0xa5, 0x44, 0x69, 0xc5, + 0x58, 0x01, 0x37, 0x86, 0xd0, 0xd0, 0x08, 0x0d, 0xf0, 0x55, 0x30, 0xc7, 0x08, 0xe6, 0x9e, 0xab, + 0xd2, 0xfc, 0x60, 0xdf, 0xb9, 0x48, 0xed, 0x22, 0x43, 0x85, 0xaf, 0x81, 0x03, 0x4d, 0xc2, 0x39, + 0xae, 0x93, 0xec, 0xac, 0x62, 0x5c, 0x32, 0x8c, 0x07, 0x2a, 0x7a, 0x1b, 0xf9, 0xf4, 0xc2, 0x5f, + 0x09, 0x70, 0x22, 0xc6, 0x8f, 0x1b, 0x94, 0x0b, 0x78, 0x73, 0x28, 0x9f, 0xad, 0x09, 0x6b, 0x07, + 0xe5, 0x3a, 0x9b, 0x97, 0x8d, 0xee, 0x79, 0x7f, 0x27, 0x94, 0xcb, 0x37, 0xc1, 0x2c, 0x15, 0xa4, + 0x29, 0xa3, 0x92, 0x3a, 0x95, 0x29, 0xbe, 0x39, 0x65, 0xae, 0x95, 0x0e, 0x19, 0x1d, 0xb3, 0x97, + 0x25, 0x1a, 0xd2, 0xa0, 0x85, 0xbf, 0x93, 0xb1, 0xff, 0x26, 0x13, 0x1e, 0x7e, 0x05, 0x16, 0xd5, + 0x4a, 0x57, 0x66, 0x44, 0x6e, 0x99, 0x3f, 0x1c, 0x7b, 0xa6, 0xf6, 0xb8, 0xd0, 0x4b, 0x47, 0x8d, + 0x29, 0x8b, 0x9b, 0x11, 0x68, 0x34, 0xa0, 0x0a, 0x9e, 0x07, 0x99, 0x26, 0x75, 0x11, 0x69, 0x35, + 0xa8, 0x83, 0x75, 0x5a, 0xce, 0xea, 0x2b, 0xa9, 0xd2, 0xdf, 0x46, 0x61, 0x1e, 0xf8, 0x3a, 0xc8, + 0x34, 0xf1, 0xed, 0x40, 0x24, 0xa5, 0x44, 0x0e, 0x1b, 0x7d, 0x99, 0x4a, 0x9f, 0x84, 0xc2, 0x7c, + 0xf0, 0xba, 0xcc, 0x06, 0x59, 0xa5, 0x79, 0x36, 0xad, 0xdc, 0x7c, 0x7a, 0xdc, 0xff, 0x99, 0x22, + 0x2f, 0x4b, 0x44, 0x28, 0x73, 0x14, 0x04, 0xf2, 0xb1, 0x0a, 0xbf, 0xa7, 0xc1, 0xc9, 0x3d, 0xcf, + 0x3e, 0xfc, 0x00, 0x40, 0xaf, 0xca, 0x09, 0xeb, 0x90, 0xda, 0x45, 0xdd, 0x16, 0xc9, 0xfe, 0x44, + 0xfa, 0x38, 0xa5, 0xaf, 0xc4, 0xab, 0x43, 0x54, 0x34, 0x42, 0x02, 0x3a, 0xe0, 0x90, 0x3c, 0x0c, + 0xda, 0xa1, 0xd4, 0xb4, 0x42, 0x8f, 0x77, 0xd2, 0x5e, 0xea, 0x75, 0xf3, 0x87, 0x36, 0xc2, 0x20, + 0x28, 0x8a, 0x09, 0xd7, 0xc1, 0x92, 0xa9, 0xf5, 0x03, 0x0e, 0x3e, 0x66, 0x3c, 0xb0, 0x54, 0x8e, + 0x92, 0xd1, 0x20, 0xbf, 0x84, 0xa8, 0x11, 0x4e, 0x19, 0xa9, 0x05, 0x10, 0xe9, 0x28, 0xc4, 0x7b, + 0x51, 0x32, 0x1a, 0xe4, 0x87, 0x0d, 0xb0, 0x68, 0x50, 0x8d, 0xbf, 0xb3, 0xb3, 0x2a, 0x64, 0x67, + 0x26, 0x0c, 0x99, 0x2e, 0xba, 0x41, 0x0e, 0x96, 0x23, 0x58, 0x68, 0x00, 0x1b, 0x0a, 0x00, 0x1c, + 0xbf, 0xc4, 0xf1, 0xec, 0x9c, 0xd2, 0xf4, 0xee, 0x94, 0x67, 0x30, 0xa8, 0x95, 0xfd, 0xeb, 0x2b, + 0xd8, 0xe2, 0x28, 0xa4, 0xa7, 0xf0, 0x73, 0x0a, 0x80, 0x7e, 0x86, 0xc1, 0xb5, 0x48, 0x91, 0x5f, + 0x1d, 0x28, 0xf2, 0xcb, 0xe1, 0xe6, 0x34, 0x54, 0xd0, 0x6f, 0x80, 0x39, 0x4f, 0x9d, 0x3c, 0x93, + 0x0c, 0xc5, 0x71, 0x66, 0x07, 0x77, 0x69, 0x80, 0x56, 0x02, 0xb2, 0x74, 0x9a, 0xf3, 0x6b, 0xd0, + 0xe0, 0x15, 0x90, 0x6e, 0x79, 0x35, 0xff, 0xf2, 0x3b, 0x37, 0x0e, 0xf5, 0x9a, 0x57, 0xe3, 0x11, + 0xcc, 0x79, 0x69, 0xbb, 0xdc, 0x45, 0x0a, 0x07, 0x7e, 0x0e, 0xe6, 0xfd, 0x76, 0xc3, 0xf4, 0x26, + 0x6b, 0xe3, 0x30, 0x91, 0xe1, 0x8f, 0xe0, 0x2e, 0xc8, 0x0a, 0xea, 0x53, 0x50, 0x80, 0x29, 0xf1, + 0x89, 0xe9, 0x16, 0x55, 0xad, 0x9f, 0x00, 0x7f, 0x54, 0xdb, 0xaf, 0xf1, 0x7d, 0x0a, 0x0a, 0x30, + 0x0b, 0xbf, 0xa6, 0xc0, 0x42, 0xa4, 0x0d, 0x7d, 0x1e, 0xe1, 0xd2, 0x59, 0xbd, 0xbf, 0xe1, 0xd2, + 0x98, 0xfb, 0x1f, 0x2e, 0x8d, 0xfb, 0xf4, 0xc2, 0x15, 0xc2, 0x1f, 0x11, 0xae, 0x9f, 0x52, 0x00, + 0x0e, 0x67, 0x3a, 0x74, 0xc0, 0x9c, 0x1e, 0x35, 0xf6, 0xe3, 0x86, 0x0b, 0xba, 0x0e, 0x73, 0x99, + 0x19, 0xe8, 0x81, 0x01, 0x25, 0x39, 0xd1, 0x80, 0x42, 0xf6, 0x63, 0x90, 0x0b, 0xae, 0xc0, 0xd8, + 0x61, 0xee, 0x0c, 0x98, 0xe7, 0xfe, 0x04, 0xa4, 0x5b, 0xa7, 0xa0, 0x2b, 0x09, 0x46, 0x99, 0x80, + 0x03, 0xd6, 0xc0, 0x02, 0x0e, 0xcf, 0x14, 0xb3, 0x53, 0x59, 0xb5, 0x2c, 0x07, 0x98, 0xc8, 0x30, + 0x11, 0x41, 0x2d, 0xfc, 0x32, 0x18, 0x2a, 0x7d, 0xbe, 0x5e, 0xd8, 0x50, 0x3d, 0xbb, 0xd1, 0xee, + 0x45, 0x8c, 0xd6, 0xdd, 0x24, 0x58, 0x1e, 0x2c, 0xf6, 0x53, 0x8d, 0xe4, 0x77, 0x46, 0xbe, 0x2b, + 0x24, 0xa7, 0x32, 0x3a, 0x98, 0x1f, 0x26, 0x7b, 0x5b, 0x88, 0x38, 0x36, 0x35, 0xd6, 0xb1, 0x57, + 0xc1, 0x6c, 0xe7, 0x09, 0x66, 0xea, 0x83, 0xb2, 0x1f, 0xd7, 0xb6, 0x68, 0x9c, 0xc2, 0x9f, 0x51, + 0x1f, 0x4e, 0xff, 0xac, 0xf1, 0xf5, 0xe8, 0xd9, 0x7f, 0x3a, 0x27, 0x9e, 0x30, 0xca, 0x26, 0x9e, + 0xff, 0x9f, 0xb7, 0x1b, 0x7f, 0x4b, 0x82, 0x23, 0xa3, 0x7a, 0x04, 0x58, 0x36, 0x2f, 0x85, 0xda, + 0x89, 0x76, 0xf8, 0xa5, 0xf0, 0x51, 0x37, 0x9f, 0x1f, 0x31, 0xe0, 0xfa, 0x30, 0xa1, 0xc7, 0xc4, + 0x8f, 0x41, 0x36, 0x92, 0x39, 0xd7, 0x05, 0x6d, 0xd0, 0x3b, 0xba, 0x75, 0xd7, 0x43, 0xca, 0xcb, + 0xbd, 0x6e, 0x3e, 0xbb, 0x15, 0xc3, 0x83, 0x62, 0xa5, 0x63, 0x5e, 0xd4, 0x52, 0x4f, 0xfd, 0x45, + 0xed, 0x8f, 0x61, 0x7f, 0xe9, 0xd4, 0xdb, 0x17, 0x7f, 0x7d, 0x0a, 0x8e, 0x47, 0x73, 0x64, 0xd8, + 0x61, 0x27, 0x7b, 0xdd, 0xfc, 0xf1, 0x72, 0x1c, 0x13, 0x8a, 0x97, 0x8f, 0x4b, 0xf4, 0xd4, 0xb3, + 0x49, 0xf4, 0xd2, 0xd9, 0x7b, 0x0f, 0x73, 0x33, 0xf7, 0x1f, 0xe6, 0x66, 0x1e, 0x3c, 0xcc, 0xcd, + 0x7c, 0xd3, 0xcb, 0x25, 0xee, 0xf5, 0x72, 0x89, 0xfb, 0xbd, 0x5c, 0xe2, 0x41, 0x2f, 0x97, 0xf8, + 0xa7, 0x97, 0x4b, 0x7c, 0xf7, 0x6f, 0x6e, 0xe6, 0x93, 0x03, 0xe6, 0x26, 0xfa, 0x2f, 0x00, 0x00, + 0xff, 0xff, 0x8e, 0x62, 0x63, 0xbc, 0xb2, 0x18, 0x00, 0x00, +>>>>>>> Update autoscaling conversion and validation for v2beta2 inclusion } diff --git a/staging/src/k8s.io/api/autoscaling/v2beta1/generated.proto b/staging/src/k8s.io/api/autoscaling/v2beta1/generated.proto index 5cc6063d014..528d9dfaac1 100644 --- a/staging/src/k8s.io/api/autoscaling/v2beta1/generated.proto +++ b/staging/src/k8s.io/api/autoscaling/v2beta1/generated.proto @@ -186,6 +186,7 @@ message HorizontalPodAutoscalerStatus { optional int32 desiredReplicas = 4; // currentMetrics is the last read state of the metrics used by this autoscaler. + // +optional repeated MetricStatus currentMetrics = 5; // conditions is the set of conditions required for this autoscaler to scale its target, @@ -273,6 +274,16 @@ message ObjectMetricSource { // targetValue is the target value of the metric (as a quantity). optional k8s.io.apimachinery.pkg.api.resource.Quantity targetValue = 3; + + // selector is the selector for the given metric + // it is the string-encoded form of a standard kubernetes label selector + // +optional + optional string selector = 4; + + // averageValue is the target value of the average of the + // metric across all relevant pods (as a quantity) + // +optional + optional k8s.io.apimachinery.pkg.api.resource.Quantity averageValue = 5; } // ObjectMetricStatus indicates the current value of a metric describing a @@ -286,6 +297,16 @@ message ObjectMetricStatus { // currentValue is the current value of the metric (as a quantity). optional k8s.io.apimachinery.pkg.api.resource.Quantity currentValue = 3; + + // selector is the selector for the given metric + // it is the string-encoded form of a standard kubernetes label selector + // +optional + optional string selector = 4; + + // averageValue is the current value of the average of the + // metric across all relevant pods (as a quantity) + // +optional + optional k8s.io.apimachinery.pkg.api.resource.Quantity averageValue = 5; } // PodsMetricSource indicates how to scale on a metric describing each pod in @@ -299,6 +320,15 @@ message PodsMetricSource { // targetAverageValue is the target value of the average of the // metric across all relevant pods (as a quantity) optional k8s.io.apimachinery.pkg.api.resource.Quantity targetAverageValue = 2; + + // selector is the selector for the given metric + // it is the string-encoded form of a standard kubernetes label selector + // +optional + optional string selector = 3; + + // value is the target value of the metric (as a quantity). + // +optional + optional k8s.io.apimachinery.pkg.api.resource.Quantity value = 4; } // PodsMetricStatus indicates the current value of a metric describing each pod in @@ -310,6 +340,15 @@ message PodsMetricStatus { // currentAverageValue is the current value of the average of the // metric across all relevant pods (as a quantity) optional k8s.io.apimachinery.pkg.api.resource.Quantity currentAverageValue = 2; + + // selector is the selector for the given metric + // it is the string-encoded form of a standard kubernetes label selector + // +optional + optional string selector = 3; + + // value is the current value of the metric (as a quantity) + // +optional + optional k8s.io.apimachinery.pkg.api.resource.Quantity value = 4; } // ResourceMetricSource indicates how to scale on a resource metric known to diff --git a/staging/src/k8s.io/api/autoscaling/v2beta1/types.go b/staging/src/k8s.io/api/autoscaling/v2beta1/types.go index 5bcb9f33c0e..6a30e6774db 100644 --- a/staging/src/k8s.io/api/autoscaling/v2beta1/types.go +++ b/staging/src/k8s.io/api/autoscaling/v2beta1/types.go @@ -216,6 +216,7 @@ type HorizontalPodAutoscalerStatus struct { DesiredReplicas int32 `json:"desiredReplicas" protobuf:"varint,4,opt,name=desiredReplicas"` // currentMetrics is the last read state of the metrics used by this autoscaler. + // +optional CurrentMetrics []MetricStatus `json:"currentMetrics" protobuf:"bytes,5,rep,name=currentMetrics"` // conditions is the set of conditions required for this autoscaler to scale its target, diff --git a/staging/src/k8s.io/api/autoscaling/v2beta1/types_swagger_doc_generated.go b/staging/src/k8s.io/api/autoscaling/v2beta1/types_swagger_doc_generated.go index 6fa9385c234..77355909338 100644 --- a/staging/src/k8s.io/api/autoscaling/v2beta1/types_swagger_doc_generated.go +++ b/staging/src/k8s.io/api/autoscaling/v2beta1/types_swagger_doc_generated.go @@ -149,10 +149,12 @@ func (MetricStatus) SwaggerDoc() map[string]string { } var map_ObjectMetricSource = map[string]string{ - "": "ObjectMetricSource indicates how to scale on a metric describing a kubernetes object (for example, hits-per-second on an Ingress object).", - "target": "target is the described Kubernetes object.", - "metricName": "metricName is the name of the metric in question.", - "targetValue": "targetValue is the target value of the metric (as a quantity).", + "": "ObjectMetricSource indicates how to scale on a metric describing a kubernetes object (for example, hits-per-second on an Ingress object).", + "target": "target is the described Kubernetes object.", + "metricName": "metricName is the name of the metric in question.", + "targetValue": "targetValue is the target value of the metric (as a quantity).", + "selector": "selector is the selector for the given metric it is the string-encoded form of a standard kubernetes label selector", + "averageValue": "averageValue is the target value of the average of the metric across all relevant pods (as a quantity)", } func (ObjectMetricSource) SwaggerDoc() map[string]string { @@ -164,6 +166,8 @@ var map_ObjectMetricStatus = map[string]string{ "target": "target is the described Kubernetes object.", "metricName": "metricName is the name of the metric in question.", "currentValue": "currentValue is the current value of the metric (as a quantity).", + "selector": "selector is the selector for the given metric it is the string-encoded form of a standard kubernetes label selector", + "averageValue": "averageValue is the current value of the average of the metric across all relevant pods (as a quantity)", } func (ObjectMetricStatus) SwaggerDoc() map[string]string { @@ -174,6 +178,8 @@ var map_PodsMetricSource = map[string]string{ "": "PodsMetricSource indicates how to scale on a metric describing each pod in the current scale target (for example, transactions-processed-per-second). The values will be averaged together before being compared to the target value.", "metricName": "metricName is the name of the metric in question", "targetAverageValue": "targetAverageValue is the target value of the average of the metric across all relevant pods (as a quantity)", + "selector": "selector is the selector for the given metric it is the string-encoded form of a standard kubernetes label selector", + "value": "value is the target value of the metric (as a quantity).", } func (PodsMetricSource) SwaggerDoc() map[string]string { @@ -184,6 +190,8 @@ var map_PodsMetricStatus = map[string]string{ "": "PodsMetricStatus indicates the current value of a metric describing each pod in the current scale target (for example, transactions-processed-per-second).", "metricName": "metricName is the name of the metric in question", "currentAverageValue": "currentAverageValue is the current value of the average of the metric across all relevant pods (as a quantity)", + "selector": "selector is the selector for the given metric it is the string-encoded form of a standard kubernetes label selector", + "value": "value is the current value of the metric (as a quantity)", } func (PodsMetricStatus) SwaggerDoc() map[string]string { diff --git a/staging/src/k8s.io/api/autoscaling/v2beta1/zz_generated.deepcopy.go b/staging/src/k8s.io/api/autoscaling/v2beta1/zz_generated.deepcopy.go index 41da778fab0..bdf1359411b 100644 --- a/staging/src/k8s.io/api/autoscaling/v2beta1/zz_generated.deepcopy.go +++ b/staging/src/k8s.io/api/autoscaling/v2beta1/zz_generated.deepcopy.go @@ -322,6 +322,11 @@ func (in *ObjectMetricSource) DeepCopyInto(out *ObjectMetricSource) { *out = *in out.Target = in.Target out.TargetValue = in.TargetValue.DeepCopy() + if in.AverageValue != nil { + in, out := &in.AverageValue, &out.AverageValue + x := (*in).DeepCopy() + *out = &x + } return } @@ -340,6 +345,11 @@ func (in *ObjectMetricStatus) DeepCopyInto(out *ObjectMetricStatus) { *out = *in out.Target = in.Target out.CurrentValue = in.CurrentValue.DeepCopy() + if in.AverageValue != nil { + in, out := &in.AverageValue, &out.AverageValue + x := (*in).DeepCopy() + *out = &x + } return } @@ -357,6 +367,11 @@ func (in *ObjectMetricStatus) DeepCopy() *ObjectMetricStatus { func (in *PodsMetricSource) DeepCopyInto(out *PodsMetricSource) { *out = *in out.TargetAverageValue = in.TargetAverageValue.DeepCopy() + if in.Value != nil { + in, out := &in.Value, &out.Value + x := (*in).DeepCopy() + *out = &x + } return } @@ -374,6 +389,11 @@ func (in *PodsMetricSource) DeepCopy() *PodsMetricSource { func (in *PodsMetricStatus) DeepCopyInto(out *PodsMetricStatus) { *out = *in out.CurrentAverageValue = in.CurrentAverageValue.DeepCopy() + if in.Value != nil { + in, out := &in.Value, &out.Value + x := (*in).DeepCopy() + *out = &x + } return }