Commit a79916fa authored by Mike Dame's avatar Mike Dame

Update autoscaling conversion and validation for v2beta2 inclusion

parent 5d1ee164
...@@ -39,6 +39,7 @@ filegroup( ...@@ -39,6 +39,7 @@ filegroup(
"//pkg/apis/autoscaling/install:all-srcs", "//pkg/apis/autoscaling/install:all-srcs",
"//pkg/apis/autoscaling/v1:all-srcs", "//pkg/apis/autoscaling/v1:all-srcs",
"//pkg/apis/autoscaling/v2beta1:all-srcs", "//pkg/apis/autoscaling/v2beta1:all-srcs",
"//pkg/apis/autoscaling/v2beta2:all-srcs",
"//pkg/apis/autoscaling/validation:all-srcs", "//pkg/apis/autoscaling/validation:all-srcs",
], ],
tags = ["automanaged"], tags = ["automanaged"],
......
...@@ -52,19 +52,28 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} { ...@@ -52,19 +52,28 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
} }
targetUtilization := int32(c.RandUint64()) targetUtilization := int32(c.RandUint64())
averageValue := randomQuantity()
s.Metrics = []autoscaling.MetricSpec{ s.Metrics = []autoscaling.MetricSpec{
{ {
Type: autoscaling.PodsMetricSourceType, Type: autoscaling.PodsMetricSourceType,
Pods: &autoscaling.PodsMetricSource{ Pods: &autoscaling.PodsMetricSource{
MetricName: c.RandString(), Metric: autoscaling.MetricIdentifier{
TargetAverageValue: randomQuantity(), Name: c.RandString(),
},
Target: autoscaling.MetricTarget{
Type: autoscaling.AverageValueMetricType,
AverageValue: &averageValue,
},
}, },
}, },
{ {
Type: autoscaling.ResourceMetricSourceType, Type: autoscaling.ResourceMetricSourceType,
Resource: &autoscaling.ResourceMetricSource{ Resource: &autoscaling.ResourceMetricSource{
Name: api.ResourceCPU, Name: api.ResourceCPU,
TargetAverageUtilization: &targetUtilization, Target: autoscaling.MetricTarget{
Type: autoscaling.UtilizationMetricType,
AverageUtilization: &targetUtilization,
},
}, },
}, },
} }
...@@ -78,20 +87,28 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} { ...@@ -78,20 +87,28 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
_ = q.String() _ = q.String()
return q return q
} }
averageValue := randomQuantity()
currentUtilization := int32(c.RandUint64()) currentUtilization := int32(c.RandUint64())
s.CurrentMetrics = []autoscaling.MetricStatus{ s.CurrentMetrics = []autoscaling.MetricStatus{
{ {
Type: autoscaling.PodsMetricSourceType, Type: autoscaling.PodsMetricSourceType,
Pods: &autoscaling.PodsMetricStatus{ Pods: &autoscaling.PodsMetricStatus{
MetricName: c.RandString(), Metric: autoscaling.MetricIdentifier{
CurrentAverageValue: randomQuantity(), Name: c.RandString(),
},
Current: autoscaling.MetricValueStatus{
AverageValue: &averageValue,
},
}, },
}, },
{ {
Type: autoscaling.ResourceMetricSourceType, Type: autoscaling.ResourceMetricSourceType,
Resource: &autoscaling.ResourceMetricStatus{ Resource: &autoscaling.ResourceMetricStatus{
Name: api.ResourceCPU, Name: api.ResourceCPU,
CurrentAverageUtilization: &currentUtilization, Current: autoscaling.MetricValueStatus{
AverageUtilization: &currentUtilization,
AverageValue: &averageValue,
},
}, },
}, },
} }
......
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( go_library(
name = "go_default_library", name = "go_default_library",
srcs = ["install.go"], srcs = ["install.go"],
importpath = "k8s.io/kubernetes/pkg/apis/autoscaling/install", importpath = "k8s.io/kubernetes/pkg/apis/autoscaling/install",
visibility = ["//visibility:public"],
deps = [ deps = [
"//pkg/api/legacyscheme:go_default_library", "//pkg/api/legacyscheme:go_default_library",
"//pkg/apis/autoscaling:go_default_library", "//pkg/apis/autoscaling:go_default_library",
"//pkg/apis/autoscaling/v1:go_default_library", "//pkg/apis/autoscaling/v1:go_default_library",
"//pkg/apis/autoscaling/v2beta1: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/runtime:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/runtime:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/runtime:go_default_library",
], ],
...@@ -30,4 +27,5 @@ filegroup( ...@@ -30,4 +27,5 @@ filegroup(
name = "all-srcs", name = "all-srcs",
srcs = [":package-srcs"], srcs = [":package-srcs"],
tags = ["automanaged"], tags = ["automanaged"],
visibility = ["//visibility:public"],
) )
...@@ -25,6 +25,7 @@ import ( ...@@ -25,6 +25,7 @@ import (
"k8s.io/kubernetes/pkg/apis/autoscaling" "k8s.io/kubernetes/pkg/apis/autoscaling"
"k8s.io/kubernetes/pkg/apis/autoscaling/v1" "k8s.io/kubernetes/pkg/apis/autoscaling/v1"
"k8s.io/kubernetes/pkg/apis/autoscaling/v2beta1" "k8s.io/kubernetes/pkg/apis/autoscaling/v2beta1"
"k8s.io/kubernetes/pkg/apis/autoscaling/v2beta2"
) )
func init() { func init() {
...@@ -34,7 +35,8 @@ func init() { ...@@ -34,7 +35,8 @@ func init() {
// Install registers the API group and adds types to a scheme // Install registers the API group and adds types to a scheme
func Install(scheme *runtime.Scheme) { func Install(scheme *runtime.Scheme) {
utilruntime.Must(autoscaling.AddToScheme(scheme)) utilruntime.Must(autoscaling.AddToScheme(scheme))
utilruntime.Must(v2beta2.AddToScheme(scheme))
utilruntime.Must(v2beta1.AddToScheme(scheme)) utilruntime.Must(v2beta1.AddToScheme(scheme))
utilruntime.Must(v1.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))
} }
...@@ -251,6 +251,7 @@ type HorizontalPodAutoscalerStatus struct { ...@@ -251,6 +251,7 @@ type HorizontalPodAutoscalerStatus struct {
DesiredReplicas int32 DesiredReplicas int32
// CurrentMetrics is the last read state of the metrics used by this autoscaler. // CurrentMetrics is the last read state of the metrics used by this autoscaler.
// +optional
CurrentMetrics []MetricStatus CurrentMetrics []MetricStatus
// Conditions is the set of conditions required for this autoscaler to scale its target, // Conditions is the set of conditions required for this autoscaler to scale its target,
...@@ -343,6 +344,8 @@ type MetricStatus struct { ...@@ -343,6 +344,8 @@ type MetricStatus struct {
type ObjectMetricStatus struct { type ObjectMetricStatus struct {
Metric MetricIdentifier Metric MetricIdentifier
Current MetricValueStatus Current MetricValueStatus
DescribedObject CrossVersionObjectReference
} }
// PodsMetricStatus indicates the current value of a metric describing each pod in // PodsMetricStatus indicates the current value of a metric describing each pod in
...@@ -360,18 +363,7 @@ type PodsMetricStatus struct { ...@@ -360,18 +363,7 @@ type PodsMetricStatus struct {
type ResourceMetricStatus struct { type ResourceMetricStatus struct {
// Name is the name of the resource in question. // Name is the name of the resource in question.
Name api.ResourceName Name api.ResourceName
// CurrentAverageUtilization is the current value of the average of the Current MetricValueStatus
// 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
} }
// ExternalMetricStatus indicates the current value of a global metric // ExternalMetricStatus indicates the current value of a global metric
......
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( go_library(
name = "go_default_library", name = "go_default_library",
...@@ -17,12 +11,12 @@ go_library( ...@@ -17,12 +11,12 @@ go_library(
"zz_generated.defaults.go", "zz_generated.defaults.go",
], ],
importpath = "k8s.io/kubernetes/pkg/apis/autoscaling/v1", importpath = "k8s.io/kubernetes/pkg/apis/autoscaling/v1",
visibility = ["//visibility:public"],
deps = [ deps = [
"//pkg/apis/autoscaling:go_default_library", "//pkg/apis/autoscaling:go_default_library",
"//pkg/apis/core:go_default_library", "//pkg/apis/core:go_default_library",
"//staging/src/k8s.io/api/autoscaling/v1: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/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/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
...@@ -55,4 +49,5 @@ filegroup( ...@@ -55,4 +49,5 @@ filegroup(
name = "all-srcs", name = "all-srcs",
srcs = [":package-srcs"], srcs = [":package-srcs"],
tags = ["automanaged"], tags = ["automanaged"],
visibility = ["//visibility:public"],
) )
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( go_library(
name = "go_default_library", name = "go_default_library",
srcs = [ srcs = [
"conversion.go",
"defaults.go", "defaults.go",
"doc.go", "doc.go",
"register.go", "register.go",
...@@ -16,12 +11,12 @@ go_library( ...@@ -16,12 +11,12 @@ go_library(
"zz_generated.defaults.go", "zz_generated.defaults.go",
], ],
importpath = "k8s.io/kubernetes/pkg/apis/autoscaling/v2beta1", importpath = "k8s.io/kubernetes/pkg/apis/autoscaling/v2beta1",
visibility = ["//visibility:public"],
deps = [ deps = [
"//pkg/apis/autoscaling:go_default_library", "//pkg/apis/autoscaling:go_default_library",
"//pkg/apis/core:go_default_library", "//pkg/apis/core:go_default_library",
"//staging/src/k8s.io/api/autoscaling/v2beta1: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/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/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
...@@ -29,19 +24,6 @@ go_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( go_test(
name = "go_default_test", name = "go_default_test",
srcs = ["defaults_test.go"], srcs = ["defaults_test.go"],
...@@ -58,3 +40,17 @@ go_test( ...@@ -58,3 +40,17 @@ go_test(
"//vendor/k8s.io/utils/pointer:go_default_library", "//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"],
)
...@@ -41,5 +41,5 @@ func init() { ...@@ -41,5 +41,5 @@ func init() {
// We only register manually written functions here. The registration of the // We only register manually written functions here. The registration of the
// generated functions takes place in the generated files. The separation // generated functions takes place in the generated files. The separation
// makes the code compile even when the generated files are missing. // makes the code compile even when the generated files are missing.
localSchemeBuilder.Register(addDefaultingFuncs) localSchemeBuilder.Register(addDefaultingFuncs, addConversionFuncs)
} }
...@@ -178,14 +178,16 @@ func validateMetricSpec(spec autoscaling.MetricSpec, fldPath *field.Path) field. ...@@ -178,14 +178,16 @@ func validateMetricSpec(spec autoscaling.MetricSpec, fldPath *field.Path) field.
func validateObjectSource(src *autoscaling.ObjectMetricSource, fldPath *field.Path) field.ErrorList { func validateObjectSource(src *autoscaling.ObjectMetricSource, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{} allErrs := field.ErrorList{}
allErrs = append(allErrs, ValidateCrossVersionObjectReference(src.Target, fldPath.Child("target"))...) allErrs = append(allErrs, ValidateCrossVersionObjectReference(src.DescribedObject, fldPath.Child("describedObject"))...)
allErrs = append(allErrs, validateMetricIdentifier(src.Metric, fldPath.Child("metric"))...)
if len(src.MetricName) == 0 { if &src.Target == nil {
allErrs = append(allErrs, field.Required(fldPath.Child("metricName"), "must specify a metric name")) 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 { if src.Target.Value == nil && src.Target.AverageValue == nil {
allErrs = append(allErrs, field.Required(fldPath.Child("targetValue"), "must specify a positive target value")) allErrs = append(allErrs, field.Required(fldPath.Child("target").Child("averageValue"), "must set either a target value or averageValue"))
} }
return allErrs return allErrs
...@@ -194,28 +196,19 @@ func validateObjectSource(src *autoscaling.ObjectMetricSource, fldPath *field.Pa ...@@ -194,28 +196,19 @@ func validateObjectSource(src *autoscaling.ObjectMetricSource, fldPath *field.Pa
func validateExternalSource(src *autoscaling.ExternalMetricSource, fldPath *field.Path) field.ErrorList { func validateExternalSource(src *autoscaling.ExternalMetricSource, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{} allErrs := field.ErrorList{}
if len(src.MetricName) == 0 { allErrs = append(allErrs, validateMetricIdentifier(src.Metric, fldPath.Child("metric"))...)
allErrs = append(allErrs, field.Required(fldPath.Child("metricName"), "must specify a metric name")) if &src.Target == nil {
allErrs = append(allErrs, field.Required(fldPath.Child("target"), "must specify a metric target"))
} else { } else {
for _, msg := range pathvalidation.IsValidPathSegmentName(src.MetricName) { allErrs = append(allErrs, validateMetricTarget(src.Target, fldPath.Child("target"))...)
allErrs = append(allErrs, field.Invalid(fldPath.Child("metricName"), src.MetricName, msg))
}
}
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.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 { if src.Target.Value == nil && src.Target.AverageValue == nil {
allErrs = append(allErrs, field.Invalid(fldPath.Child("targetAverageValue"), src.TargetAverageValue, "must be positive")) 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.TargetValue.Sign() != 1 { if src.Target.Value != nil && src.Target.AverageValue != nil {
allErrs = append(allErrs, field.Invalid(fldPath.Child("targetValue"), src.TargetValue, "must be positive")) 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 return allErrs
...@@ -224,12 +217,15 @@ func validateExternalSource(src *autoscaling.ExternalMetricSource, fldPath *fiel ...@@ -224,12 +217,15 @@ func validateExternalSource(src *autoscaling.ExternalMetricSource, fldPath *fiel
func validatePodsSource(src *autoscaling.PodsMetricSource, fldPath *field.Path) field.ErrorList { func validatePodsSource(src *autoscaling.PodsMetricSource, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{} allErrs := field.ErrorList{}
if len(src.MetricName) == 0 { allErrs = append(allErrs, validateMetricIdentifier(src.Metric, fldPath.Child("metric"))...)
allErrs = append(allErrs, field.Required(fldPath.Child("metricName"), "must specify a metric name")) 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 { if src.Target.AverageValue == nil {
allErrs = append(allErrs, field.Required(fldPath.Child("targetAverageValue"), "must specify a positive target value")) allErrs = append(allErrs, field.Required(fldPath.Child("target").Child("averageValue"), "must specify a positive target averageValue"))
} }
return allErrs return allErrs
...@@ -241,22 +237,60 @@ func validateResourceSource(src *autoscaling.ResourceMetricSource, fldPath *fiel ...@@ -241,22 +237,60 @@ func validateResourceSource(src *autoscaling.ResourceMetricSource, fldPath *fiel
if len(src.Name) == 0 { if len(src.Name) == 0 {
allErrs = append(allErrs, field.Required(fldPath.Child("name"), "must specify a resource name")) allErrs = append(allErrs, field.Required(fldPath.Child("name"), "must specify a resource name"))
} }
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.TargetAverageValue == nil { if src.Target.AverageUtilization == nil && src.Target.AverageValue == nil {
allErrs = append(allErrs, field.Required(fldPath.Child("targetAverageUtilization"), "must set either a target raw value or a target utilization")) 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.TargetAverageUtilization < 1 { if src.Target.AverageUtilization != nil && src.Target.AverageValue != nil {
allErrs = append(allErrs, field.Invalid(fldPath.Child("targetAverageUtilization"), src.TargetAverageUtilization, "must be greater than 0")) allErrs = append(allErrs, field.Forbidden(fldPath.Child("target").Child("averageValue"), "may not set both a target raw value and a target utilization"))
} }
if src.TargetAverageUtilization != nil && src.TargetAverageValue != nil { return allErrs
allErrs = append(allErrs, field.Forbidden(fldPath.Child("targetAverageValue"), "may not set both a target raw value and a target utilization")) }
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 src.TargetAverageValue != nil && src.TargetAverageValue.Sign() != 1 { if mt.Type != autoscaling.UtilizationMetricType &&
allErrs = append(allErrs, field.Invalid(fldPath.Child("targetAverageValue"), src.TargetAverageValue, "must be positive")) 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 return allErrs
} }
...@@ -21,7 +21,6 @@ limitations under the License. ...@@ -21,7 +21,6 @@ limitations under the License.
package autoscaling package autoscaling
import ( import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime" runtime "k8s.io/apimachinery/pkg/runtime"
) )
...@@ -44,21 +43,8 @@ func (in *CrossVersionObjectReference) DeepCopy() *CrossVersionObjectReference { ...@@ -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. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ExternalMetricSource) DeepCopyInto(out *ExternalMetricSource) { func (in *ExternalMetricSource) DeepCopyInto(out *ExternalMetricSource) {
*out = *in *out = *in
if in.MetricSelector != nil { out.Metric = in.Metric
in, out := &in.MetricSelector, &out.MetricSelector in.Target.DeepCopyInto(&out.Target)
*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
}
return return
} }
...@@ -75,17 +61,8 @@ func (in *ExternalMetricSource) DeepCopy() *ExternalMetricSource { ...@@ -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. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ExternalMetricStatus) DeepCopyInto(out *ExternalMetricStatus) { func (in *ExternalMetricStatus) DeepCopyInto(out *ExternalMetricStatus) {
*out = *in *out = *in
if in.MetricSelector != nil { out.Metric = in.Metric
in, out := &in.MetricSelector, &out.MetricSelector in.Current.DeepCopyInto(&out.Current)
*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
}
return return
} }
...@@ -246,6 +223,22 @@ func (in *HorizontalPodAutoscalerStatus) DeepCopy() *HorizontalPodAutoscalerStat ...@@ -246,6 +223,22 @@ func (in *HorizontalPodAutoscalerStatus) DeepCopy() *HorizontalPodAutoscalerStat
} }
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. // 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) { func (in *MetricSpec) DeepCopyInto(out *MetricSpec) {
*out = *in *out = *in
if in.Object != nil { if in.Object != nil {
...@@ -318,10 +311,73 @@ func (in *MetricStatus) DeepCopy() *MetricStatus { ...@@ -318,10 +311,73 @@ func (in *MetricStatus) DeepCopy() *MetricStatus {
} }
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. // 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) { func (in *ObjectMetricSource) DeepCopyInto(out *ObjectMetricSource) {
*out = *in *out = *in
out.Target = in.Target out.DescribedObject = in.DescribedObject
out.TargetValue = in.TargetValue.DeepCopy() in.Target.DeepCopyInto(&out.Target)
out.Metric = in.Metric
return return
} }
...@@ -338,8 +394,9 @@ func (in *ObjectMetricSource) DeepCopy() *ObjectMetricSource { ...@@ -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. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ObjectMetricStatus) DeepCopyInto(out *ObjectMetricStatus) { func (in *ObjectMetricStatus) DeepCopyInto(out *ObjectMetricStatus) {
*out = *in *out = *in
out.Target = in.Target out.Metric = in.Metric
out.CurrentValue = in.CurrentValue.DeepCopy() in.Current.DeepCopyInto(&out.Current)
out.DescribedObject = in.DescribedObject
return return
} }
...@@ -356,7 +413,8 @@ func (in *ObjectMetricStatus) DeepCopy() *ObjectMetricStatus { ...@@ -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. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PodsMetricSource) DeepCopyInto(out *PodsMetricSource) { func (in *PodsMetricSource) DeepCopyInto(out *PodsMetricSource) {
*out = *in *out = *in
out.TargetAverageValue = in.TargetAverageValue.DeepCopy() out.Metric = in.Metric
in.Target.DeepCopyInto(&out.Target)
return return
} }
...@@ -373,7 +431,8 @@ func (in *PodsMetricSource) DeepCopy() *PodsMetricSource { ...@@ -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. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PodsMetricStatus) DeepCopyInto(out *PodsMetricStatus) { func (in *PodsMetricStatus) DeepCopyInto(out *PodsMetricStatus) {
*out = *in *out = *in
out.CurrentAverageValue = in.CurrentAverageValue.DeepCopy() out.Metric = in.Metric
in.Current.DeepCopyInto(&out.Current)
return return
} }
...@@ -390,16 +449,7 @@ func (in *PodsMetricStatus) DeepCopy() *PodsMetricStatus { ...@@ -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. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ResourceMetricSource) DeepCopyInto(out *ResourceMetricSource) { func (in *ResourceMetricSource) DeepCopyInto(out *ResourceMetricSource) {
*out = *in *out = *in
if in.TargetAverageUtilization != nil { in.Target.DeepCopyInto(&out.Target)
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
}
return return
} }
...@@ -416,12 +466,7 @@ func (in *ResourceMetricSource) DeepCopy() *ResourceMetricSource { ...@@ -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. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ResourceMetricStatus) DeepCopyInto(out *ResourceMetricStatus) { func (in *ResourceMetricStatus) DeepCopyInto(out *ResourceMetricStatus) {
*out = *in *out = *in
if in.CurrentAverageUtilization != nil { in.Current.DeepCopyInto(&out.Current)
in, out := &in.CurrentAverageUtilization, &out.CurrentAverageUtilization
*out = new(int32)
**out = **in
}
out.CurrentAverageValue = in.CurrentAverageValue.DeepCopy()
return return
} }
......
...@@ -257,6 +257,16 @@ message ObjectMetricSource { ...@@ -257,6 +257,16 @@ message ObjectMetricSource {
// targetValue is the target value of the metric (as a quantity). // targetValue is the target value of the metric (as a quantity).
optional k8s.io.apimachinery.pkg.api.resource.Quantity targetValue = 3; 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 // ObjectMetricStatus indicates the current value of a metric describing a
...@@ -270,6 +280,16 @@ message ObjectMetricStatus { ...@@ -270,6 +280,16 @@ message ObjectMetricStatus {
// currentValue is the current value of the metric (as a quantity). // currentValue is the current value of the metric (as a quantity).
optional k8s.io.apimachinery.pkg.api.resource.Quantity currentValue = 3; 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 // PodsMetricSource indicates how to scale on a metric describing each pod in
...@@ -283,6 +303,15 @@ message PodsMetricSource { ...@@ -283,6 +303,15 @@ message PodsMetricSource {
// targetAverageValue is the target value of the average of the // targetAverageValue is the target value of the average of the
// metric across all relevant pods (as a quantity) // metric across all relevant pods (as a quantity)
optional k8s.io.apimachinery.pkg.api.resource.Quantity targetAverageValue = 2; 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 // PodsMetricStatus indicates the current value of a metric describing each pod in
...@@ -294,6 +323,15 @@ message PodsMetricStatus { ...@@ -294,6 +323,15 @@ message PodsMetricStatus {
// currentAverageValue is the current value of the average of the // currentAverageValue is the current value of the average of the
// metric across all relevant pods (as a quantity) // metric across all relevant pods (as a quantity)
optional k8s.io.apimachinery.pkg.api.resource.Quantity currentAverageValue = 2; 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 // ResourceMetricSource indicates how to scale on a resource metric known to
......
...@@ -152,6 +152,8 @@ var map_ObjectMetricSource = map[string]string{ ...@@ -152,6 +152,8 @@ var map_ObjectMetricSource = map[string]string{
"target": "target is the described Kubernetes object.", "target": "target is the described Kubernetes object.",
"metricName": "metricName is the name of the metric in question.", "metricName": "metricName is the name of the metric in question.",
"targetValue": "targetValue is the target value of the metric (as a quantity).", "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 { func (ObjectMetricSource) SwaggerDoc() map[string]string {
...@@ -163,6 +165,8 @@ var map_ObjectMetricStatus = map[string]string{ ...@@ -163,6 +165,8 @@ var map_ObjectMetricStatus = map[string]string{
"target": "target is the described Kubernetes object.", "target": "target is the described Kubernetes object.",
"metricName": "metricName is the name of the metric in question.", "metricName": "metricName is the name of the metric in question.",
"currentValue": "currentValue is the current value of the metric (as a quantity).", "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 { func (ObjectMetricStatus) SwaggerDoc() map[string]string {
...@@ -173,6 +177,8 @@ var map_PodsMetricSource = 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.", "": "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", "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)", "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 { func (PodsMetricSource) SwaggerDoc() map[string]string {
...@@ -183,6 +189,8 @@ var map_PodsMetricStatus = 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).", "": "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", "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)", "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 { func (PodsMetricStatus) SwaggerDoc() map[string]string {
......
...@@ -311,6 +311,11 @@ func (in *ObjectMetricSource) DeepCopyInto(out *ObjectMetricSource) { ...@@ -311,6 +311,11 @@ func (in *ObjectMetricSource) DeepCopyInto(out *ObjectMetricSource) {
*out = *in *out = *in
out.Target = in.Target out.Target = in.Target
out.TargetValue = in.TargetValue.DeepCopy() out.TargetValue = in.TargetValue.DeepCopy()
if in.AverageValue != nil {
in, out := &in.AverageValue, &out.AverageValue
x := (*in).DeepCopy()
*out = &x
}
return return
} }
...@@ -329,6 +334,11 @@ func (in *ObjectMetricStatus) DeepCopyInto(out *ObjectMetricStatus) { ...@@ -329,6 +334,11 @@ func (in *ObjectMetricStatus) DeepCopyInto(out *ObjectMetricStatus) {
*out = *in *out = *in
out.Target = in.Target out.Target = in.Target
out.CurrentValue = in.CurrentValue.DeepCopy() out.CurrentValue = in.CurrentValue.DeepCopy()
if in.AverageValue != nil {
in, out := &in.AverageValue, &out.AverageValue
x := (*in).DeepCopy()
*out = &x
}
return return
} }
...@@ -346,6 +356,11 @@ func (in *ObjectMetricStatus) DeepCopy() *ObjectMetricStatus { ...@@ -346,6 +356,11 @@ func (in *ObjectMetricStatus) DeepCopy() *ObjectMetricStatus {
func (in *PodsMetricSource) DeepCopyInto(out *PodsMetricSource) { func (in *PodsMetricSource) DeepCopyInto(out *PodsMetricSource) {
*out = *in *out = *in
out.TargetAverageValue = in.TargetAverageValue.DeepCopy() out.TargetAverageValue = in.TargetAverageValue.DeepCopy()
if in.Value != nil {
in, out := &in.Value, &out.Value
x := (*in).DeepCopy()
*out = &x
}
return return
} }
...@@ -363,6 +378,11 @@ func (in *PodsMetricSource) DeepCopy() *PodsMetricSource { ...@@ -363,6 +378,11 @@ func (in *PodsMetricSource) DeepCopy() *PodsMetricSource {
func (in *PodsMetricStatus) DeepCopyInto(out *PodsMetricStatus) { func (in *PodsMetricStatus) DeepCopyInto(out *PodsMetricStatus) {
*out = *in *out = *in
out.CurrentAverageValue = in.CurrentAverageValue.DeepCopy() out.CurrentAverageValue = in.CurrentAverageValue.DeepCopy()
if in.Value != nil {
in, out := &in.Value, &out.Value
x := (*in).DeepCopy()
*out = &x
}
return return
} }
......
...@@ -186,6 +186,7 @@ message HorizontalPodAutoscalerStatus { ...@@ -186,6 +186,7 @@ message HorizontalPodAutoscalerStatus {
optional int32 desiredReplicas = 4; optional int32 desiredReplicas = 4;
// currentMetrics is the last read state of the metrics used by this autoscaler. // currentMetrics is the last read state of the metrics used by this autoscaler.
// +optional
repeated MetricStatus currentMetrics = 5; repeated MetricStatus currentMetrics = 5;
// conditions is the set of conditions required for this autoscaler to scale its target, // conditions is the set of conditions required for this autoscaler to scale its target,
...@@ -273,6 +274,16 @@ message ObjectMetricSource { ...@@ -273,6 +274,16 @@ message ObjectMetricSource {
// targetValue is the target value of the metric (as a quantity). // targetValue is the target value of the metric (as a quantity).
optional k8s.io.apimachinery.pkg.api.resource.Quantity targetValue = 3; 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 // ObjectMetricStatus indicates the current value of a metric describing a
...@@ -286,6 +297,16 @@ message ObjectMetricStatus { ...@@ -286,6 +297,16 @@ message ObjectMetricStatus {
// currentValue is the current value of the metric (as a quantity). // currentValue is the current value of the metric (as a quantity).
optional k8s.io.apimachinery.pkg.api.resource.Quantity currentValue = 3; 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 // PodsMetricSource indicates how to scale on a metric describing each pod in
...@@ -299,6 +320,15 @@ message PodsMetricSource { ...@@ -299,6 +320,15 @@ message PodsMetricSource {
// targetAverageValue is the target value of the average of the // targetAverageValue is the target value of the average of the
// metric across all relevant pods (as a quantity) // metric across all relevant pods (as a quantity)
optional k8s.io.apimachinery.pkg.api.resource.Quantity targetAverageValue = 2; 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 // PodsMetricStatus indicates the current value of a metric describing each pod in
...@@ -310,6 +340,15 @@ message PodsMetricStatus { ...@@ -310,6 +340,15 @@ message PodsMetricStatus {
// currentAverageValue is the current value of the average of the // currentAverageValue is the current value of the average of the
// metric across all relevant pods (as a quantity) // metric across all relevant pods (as a quantity)
optional k8s.io.apimachinery.pkg.api.resource.Quantity currentAverageValue = 2; 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 // ResourceMetricSource indicates how to scale on a resource metric known to
......
...@@ -216,6 +216,7 @@ type HorizontalPodAutoscalerStatus struct { ...@@ -216,6 +216,7 @@ type HorizontalPodAutoscalerStatus struct {
DesiredReplicas int32 `json:"desiredReplicas" protobuf:"varint,4,opt,name=desiredReplicas"` DesiredReplicas int32 `json:"desiredReplicas" protobuf:"varint,4,opt,name=desiredReplicas"`
// currentMetrics is the last read state of the metrics used by this autoscaler. // currentMetrics is the last read state of the metrics used by this autoscaler.
// +optional
CurrentMetrics []MetricStatus `json:"currentMetrics" protobuf:"bytes,5,rep,name=currentMetrics"` CurrentMetrics []MetricStatus `json:"currentMetrics" protobuf:"bytes,5,rep,name=currentMetrics"`
// conditions is the set of conditions required for this autoscaler to scale its target, // conditions is the set of conditions required for this autoscaler to scale its target,
......
...@@ -153,6 +153,8 @@ var map_ObjectMetricSource = map[string]string{ ...@@ -153,6 +153,8 @@ var map_ObjectMetricSource = map[string]string{
"target": "target is the described Kubernetes object.", "target": "target is the described Kubernetes object.",
"metricName": "metricName is the name of the metric in question.", "metricName": "metricName is the name of the metric in question.",
"targetValue": "targetValue is the target value of the metric (as a quantity).", "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 { func (ObjectMetricSource) SwaggerDoc() map[string]string {
...@@ -164,6 +166,8 @@ var map_ObjectMetricStatus = map[string]string{ ...@@ -164,6 +166,8 @@ var map_ObjectMetricStatus = map[string]string{
"target": "target is the described Kubernetes object.", "target": "target is the described Kubernetes object.",
"metricName": "metricName is the name of the metric in question.", "metricName": "metricName is the name of the metric in question.",
"currentValue": "currentValue is the current value of the metric (as a quantity).", "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 { func (ObjectMetricStatus) SwaggerDoc() map[string]string {
...@@ -174,6 +178,8 @@ var map_PodsMetricSource = 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.", "": "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", "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)", "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 { func (PodsMetricSource) SwaggerDoc() map[string]string {
...@@ -184,6 +190,8 @@ var map_PodsMetricStatus = 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).", "": "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", "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)", "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 { func (PodsMetricStatus) SwaggerDoc() map[string]string {
......
...@@ -322,6 +322,11 @@ func (in *ObjectMetricSource) DeepCopyInto(out *ObjectMetricSource) { ...@@ -322,6 +322,11 @@ func (in *ObjectMetricSource) DeepCopyInto(out *ObjectMetricSource) {
*out = *in *out = *in
out.Target = in.Target out.Target = in.Target
out.TargetValue = in.TargetValue.DeepCopy() out.TargetValue = in.TargetValue.DeepCopy()
if in.AverageValue != nil {
in, out := &in.AverageValue, &out.AverageValue
x := (*in).DeepCopy()
*out = &x
}
return return
} }
...@@ -340,6 +345,11 @@ func (in *ObjectMetricStatus) DeepCopyInto(out *ObjectMetricStatus) { ...@@ -340,6 +345,11 @@ func (in *ObjectMetricStatus) DeepCopyInto(out *ObjectMetricStatus) {
*out = *in *out = *in
out.Target = in.Target out.Target = in.Target
out.CurrentValue = in.CurrentValue.DeepCopy() out.CurrentValue = in.CurrentValue.DeepCopy()
if in.AverageValue != nil {
in, out := &in.AverageValue, &out.AverageValue
x := (*in).DeepCopy()
*out = &x
}
return return
} }
...@@ -357,6 +367,11 @@ func (in *ObjectMetricStatus) DeepCopy() *ObjectMetricStatus { ...@@ -357,6 +367,11 @@ func (in *ObjectMetricStatus) DeepCopy() *ObjectMetricStatus {
func (in *PodsMetricSource) DeepCopyInto(out *PodsMetricSource) { func (in *PodsMetricSource) DeepCopyInto(out *PodsMetricSource) {
*out = *in *out = *in
out.TargetAverageValue = in.TargetAverageValue.DeepCopy() out.TargetAverageValue = in.TargetAverageValue.DeepCopy()
if in.Value != nil {
in, out := &in.Value, &out.Value
x := (*in).DeepCopy()
*out = &x
}
return return
} }
...@@ -374,6 +389,11 @@ func (in *PodsMetricSource) DeepCopy() *PodsMetricSource { ...@@ -374,6 +389,11 @@ func (in *PodsMetricSource) DeepCopy() *PodsMetricSource {
func (in *PodsMetricStatus) DeepCopyInto(out *PodsMetricStatus) { func (in *PodsMetricStatus) DeepCopyInto(out *PodsMetricStatus) {
*out = *in *out = *in
out.CurrentAverageValue = in.CurrentAverageValue.DeepCopy() out.CurrentAverageValue = in.CurrentAverageValue.DeepCopy()
if in.Value != nil {
in, out := &in.Value, &out.Value
x := (*in).DeepCopy()
*out = &x
}
return return
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment