Cleanups in HorizontalPodAutoscaler API.

Cleanups in HorizontalPodAutoscaler API: renamed Min/MaxCount to Min/MaxReplicas as Replicas is the proper name used in other objects.
This commit is contained in:
Jerzy Szczepkowski
2015-09-17 14:08:39 +02:00
parent 81d3bd9a36
commit 7fcf7f1177
15 changed files with 101 additions and 101 deletions

View File

@@ -957,8 +957,8 @@ func deepCopy_experimental_HorizontalPodAutoscalerSpec(in HorizontalPodAutoscale
} else {
out.ScaleRef = nil
}
out.MinCount = in.MinCount
out.MaxCount = in.MaxCount
out.MinReplicas = in.MinReplicas
out.MaxReplicas = in.MaxReplicas
if err := deepCopy_experimental_ResourceConsumption(in.Target, &out.Target, c); err != nil {
return err
}

View File

@@ -92,10 +92,10 @@ type HorizontalPodAutoscalerSpec struct {
// ScaleRef is a reference to Scale subresource. HorizontalPodAutoscaler will learn the current resource consumption from its status,
// and will set the desired number of pods by modyfying its spec.
ScaleRef *SubresourceReference `json:"scaleRef"`
// MinCount is the lower limit for the number of pods that can be set by the autoscaler.
MinCount int `json:"minCount"`
// MaxCount is the upper limit for the number of pods that can be set by the autoscaler. It cannot be smaller than MinCount.
MaxCount int `json:"maxCount"`
// MinReplicas is the lower limit for the number of pods that can be set by the autoscaler.
MinReplicas int `json:"minReplicas"`
// MaxReplicas is the upper limit for the number of pods that can be set by the autoscaler. It cannot be smaller than MinReplicas.
MaxReplicas int `json:"maxReplicas"`
// Target is the target average consumption of the given resource that the autoscaler will try to maintain by adjusting the desired number of pods.
// Currently two types of resources are supported: "cpu" and "memory".
Target ResourceConsumption `json:"target"`

View File

@@ -1756,8 +1756,8 @@ func convert_experimental_HorizontalPodAutoscalerSpec_To_v1_HorizontalPodAutosca
} else {
out.ScaleRef = nil
}
out.MinCount = in.MinCount
out.MaxCount = in.MaxCount
out.MinReplicas = in.MinReplicas
out.MaxReplicas = in.MaxReplicas
if err := convert_experimental_ResourceConsumption_To_v1_ResourceConsumption(&in.Target, &out.Target, s); err != nil {
return err
}
@@ -2272,8 +2272,8 @@ func convert_v1_HorizontalPodAutoscalerSpec_To_experimental_HorizontalPodAutosca
} else {
out.ScaleRef = nil
}
out.MinCount = in.MinCount
out.MaxCount = in.MaxCount
out.MinReplicas = in.MinReplicas
out.MaxReplicas = in.MaxReplicas
if err := convert_v1_ResourceConsumption_To_experimental_ResourceConsumption(&in.Target, &out.Target, s); err != nil {
return err
}

View File

@@ -969,8 +969,8 @@ func deepCopy_v1_HorizontalPodAutoscalerSpec(in HorizontalPodAutoscalerSpec, out
} else {
out.ScaleRef = nil
}
out.MinCount = in.MinCount
out.MaxCount = in.MaxCount
out.MinReplicas = in.MinReplicas
out.MaxReplicas = in.MaxReplicas
if err := deepCopy_v1_ResourceConsumption(in.Target, &out.Target, c); err != nil {
return err
}

View File

@@ -82,10 +82,10 @@ type HorizontalPodAutoscalerSpec struct {
// ScaleRef is a reference to Scale subresource. HorizontalPodAutoscaler will learn the current resource consumption from its status,
// and will set the desired number of pods by modyfying its spec.
ScaleRef *SubresourceReference `json:"scaleRef"`
// MinCount is the lower limit for the number of pods that can be set by the autoscaler.
MinCount int `json:"minCount"`
// MaxCount is the upper limit for the number of pods that can be set by the autoscaler. It cannot be smaller than MinCount.
MaxCount int `json:"maxCount"`
// MinReplicas is the lower limit for the number of pods that can be set by the autoscaler.
MinReplicas int `json:"minReplicas"`
// MaxReplicas is the upper limit for the number of pods that can be set by the autoscaler. It cannot be smaller than MinReplicas.
MaxReplicas int `json:"maxReplicas"`
// Target is the target average consumption of the given resource that the autoscaler will try to maintain by adjusting the desired number of pods.
// Currently two types of resources are supported: "cpu" and "memory".
Target ResourceConsumption `json:"target"`

View File

@@ -155,11 +155,11 @@ func (HorizontalPodAutoscalerList) SwaggerDoc() map[string]string {
}
var map_HorizontalPodAutoscalerSpec = map[string]string{
"": "HorizontalPodAutoscalerSpec is the specification of a horizontal pod autoscaler.",
"scaleRef": "ScaleRef is a reference to Scale subresource. HorizontalPodAutoscaler will learn the current resource consumption from its status, and will set the desired number of pods by modyfying its spec.",
"minCount": "MinCount is the lower limit for the number of pods that can be set by the autoscaler.",
"maxCount": "MaxCount is the upper limit for the number of pods that can be set by the autoscaler. It cannot be smaller than MinCount.",
"target": "Target is the target average consumption of the given resource that the autoscaler will try to maintain by adjusting the desired number of pods. Currently two types of resources are supported: \"cpu\" and \"memory\".",
"": "HorizontalPodAutoscalerSpec is the specification of a horizontal pod autoscaler.",
"scaleRef": "ScaleRef is a reference to Scale subresource. HorizontalPodAutoscaler will learn the current resource consumption from its status, and will set the desired number of pods by modyfying its spec.",
"minReplicas": "MinReplicas is the lower limit for the number of pods that can be set by the autoscaler.",
"maxReplicas": "MaxReplicas is the upper limit for the number of pods that can be set by the autoscaler. It cannot be smaller than MinReplicas.",
"target": "Target is the target average consumption of the given resource that the autoscaler will try to maintain by adjusting the desired number of pods. Currently two types of resources are supported: \"cpu\" and \"memory\".",
}
func (HorizontalPodAutoscalerSpec) SwaggerDoc() map[string]string {

View File

@@ -40,11 +40,11 @@ func ValidateHorizontalPodAutoscalerName(name string, prefix bool) (bool, string
func validateHorizontalPodAutoscalerSpec(autoscaler experimental.HorizontalPodAutoscalerSpec) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
if autoscaler.MinCount < 0 {
allErrs = append(allErrs, errs.NewFieldInvalid("minCount", autoscaler.MinCount, `must be non-negative`))
if autoscaler.MinReplicas < 0 {
allErrs = append(allErrs, errs.NewFieldInvalid("minReplicas", autoscaler.MinReplicas, `must be non-negative`))
}
if autoscaler.MaxCount < autoscaler.MinCount {
allErrs = append(allErrs, errs.NewFieldInvalid("maxCount", autoscaler.MaxCount, `must be bigger or equal to minCount`))
if autoscaler.MaxReplicas < autoscaler.MinReplicas {
allErrs = append(allErrs, errs.NewFieldInvalid("maxReplicas", autoscaler.MaxReplicas, `must be bigger or equal to minReplicas`))
}
if autoscaler.ScaleRef == nil {
allErrs = append(allErrs, errs.NewFieldRequired("scaleRef"))

View File

@@ -38,9 +38,9 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
ScaleRef: &experimental.SubresourceReference{
Subresource: "scale",
},
MinCount: 1,
MaxCount: 5,
Target: experimental.ResourceConsumption{Resource: api.ResourceCPU, Quantity: resource.MustParse("0.8")},
MinReplicas: 1,
MaxReplicas: 5,
Target: experimental.ResourceConsumption{Resource: api.ResourceCPU, Quantity: resource.MustParse("0.8")},
},
},
}
@@ -60,12 +60,12 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
ScaleRef: &experimental.SubresourceReference{
Subresource: "scale",
},
MinCount: -1,
MaxCount: 5,
Target: experimental.ResourceConsumption{Resource: api.ResourceCPU, Quantity: resource.MustParse("0.8")},
MinReplicas: -1,
MaxReplicas: 5,
Target: experimental.ResourceConsumption{Resource: api.ResourceCPU, Quantity: resource.MustParse("0.8")},
},
},
"must be bigger or equal to minCount": {
"must be bigger or equal to minReplicas": {
ObjectMeta: api.ObjectMeta{
Name: "myautoscaler",
Namespace: api.NamespaceDefault,
@@ -74,9 +74,9 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
ScaleRef: &experimental.SubresourceReference{
Subresource: "scale",
},
MinCount: 7,
MaxCount: 5,
Target: experimental.ResourceConsumption{Resource: api.ResourceCPU, Quantity: resource.MustParse("0.8")},
MinReplicas: 7,
MaxReplicas: 5,
Target: experimental.ResourceConsumption{Resource: api.ResourceCPU, Quantity: resource.MustParse("0.8")},
},
},
"invalid value": {
@@ -88,9 +88,9 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
ScaleRef: &experimental.SubresourceReference{
Subresource: "scale",
},
MinCount: 1,
MaxCount: 5,
Target: experimental.ResourceConsumption{Resource: api.ResourceCPU, Quantity: resource.MustParse("-0.8")},
MinReplicas: 1,
MaxReplicas: 5,
Target: experimental.ResourceConsumption{Resource: api.ResourceCPU, Quantity: resource.MustParse("-0.8")},
},
},
"resource not supported": {
@@ -102,9 +102,9 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
ScaleRef: &experimental.SubresourceReference{
Subresource: "scale",
},
MinCount: 1,
MaxCount: 5,
Target: experimental.ResourceConsumption{Resource: api.ResourceName("NotSupportedResource"), Quantity: resource.MustParse("0.8")},
MinReplicas: 1,
MaxReplicas: 5,
Target: experimental.ResourceConsumption{Resource: api.ResourceName("NotSupportedResource"), Quantity: resource.MustParse("0.8")},
},
},
"required value": {
@@ -113,9 +113,9 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
Namespace: api.NamespaceDefault,
},
Spec: experimental.HorizontalPodAutoscalerSpec{
MinCount: 1,
MaxCount: 5,
Target: experimental.ResourceConsumption{Resource: api.ResourceCPU, Quantity: resource.MustParse("0.8")},
MinReplicas: 1,
MaxReplicas: 5,
Target: experimental.ResourceConsumption{Resource: api.ResourceCPU, Quantity: resource.MustParse("0.8")},
},
},
}