Commit 76bd48b1 authored by Solly Ross's avatar Solly Ross Committed by Mike Dame

Fix up potentially empty fields in HPA v2beta2

There were a few cases where fields that should have been marked optional were not. This was causing weird validation issues, but is now fixed.
parent 364afe40
...@@ -79039,11 +79039,6 @@ ...@@ -79039,11 +79039,6 @@
}, },
"io.k8s.api.autoscaling.v2beta2.MetricValueStatus": { "io.k8s.api.autoscaling.v2beta2.MetricValueStatus": {
"description": "MetricValueStatus holds the current value for a metric", "description": "MetricValueStatus holds the current value for a metric",
"required": [
"value",
"averageValue",
"averageUtilization"
],
"properties": { "properties": {
"averageUtilization": { "averageUtilization": {
"description": "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.", "description": "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.",
...@@ -1840,11 +1840,6 @@ ...@@ -1840,11 +1840,6 @@
"v2beta2.MetricValueStatus": { "v2beta2.MetricValueStatus": {
"id": "v2beta2.MetricValueStatus", "id": "v2beta2.MetricValueStatus",
"description": "MetricValueStatus holds the current value for a metric", "description": "MetricValueStatus holds the current value for a metric",
"required": [
"value",
"averageValue",
"averageUtilization"
],
"properties": { "properties": {
"value": { "value": {
"type": "string", "type": "string",
......
...@@ -1002,21 +1002,21 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; } ...@@ -1002,21 +1002,21 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
<tr> <tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">value</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">value</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">value is the current value of the metric (as a quantity).</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">value is the current value of the metric (as a quantity).</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td> <td class="tableblock halign-left valign-top"></td>
</tr> </tr>
<tr> <tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">averageValue</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">averageValue</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">averageValue is the current value of the average of the metric across all relevant pods (as a quantity)</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">averageValue is the current value of the average of the metric across all relevant pods (as a quantity)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td> <td class="tableblock halign-left valign-top"></td>
</tr> </tr>
<tr> <tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">averageUtilization</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">averageUtilization</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">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.</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">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.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer (int32)</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">integer (int32)</p></td>
<td class="tableblock halign-left valign-top"></td> <td class="tableblock halign-left valign-top"></td>
</tr> </tr>
......
...@@ -259,31 +259,37 @@ message MetricTarget { ...@@ -259,31 +259,37 @@ message MetricTarget {
optional string type = 1; optional string type = 1;
// value is the target value of the metric (as a quantity). // value is the target value of the metric (as a quantity).
// +optional
optional k8s.io.apimachinery.pkg.api.resource.Quantity value = 2; optional k8s.io.apimachinery.pkg.api.resource.Quantity value = 2;
// averageValue is the target value of the average of the // averageValue 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
optional k8s.io.apimachinery.pkg.api.resource.Quantity averageValue = 3; optional k8s.io.apimachinery.pkg.api.resource.Quantity averageValue = 3;
// averageUtilization is the target value of the average of the // averageUtilization is the target value of the average of the
// resource metric across all relevant pods, represented as a percentage of // resource metric across all relevant pods, represented as a percentage of
// the requested value of the resource for the pods. // the requested value of the resource for the pods.
// Currently only valid for Resource metric source type // Currently only valid for Resource metric source type
// +optional
optional int32 averageUtilization = 4; optional int32 averageUtilization = 4;
} }
// MetricValueStatus holds the current value for a metric // MetricValueStatus holds the current value for a metric
message MetricValueStatus { message MetricValueStatus {
// value is the current value of the metric (as a quantity). // value is the current value of the metric (as a quantity).
// +optional
optional k8s.io.apimachinery.pkg.api.resource.Quantity value = 1; optional k8s.io.apimachinery.pkg.api.resource.Quantity value = 1;
// averageValue is the current value of the average of the // averageValue 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
optional k8s.io.apimachinery.pkg.api.resource.Quantity averageValue = 2; optional k8s.io.apimachinery.pkg.api.resource.Quantity averageValue = 2;
// currentAverageUtilization is the current value of the average of the // currentAverageUtilization is the current value of the average of the
// resource metric across all relevant pods, represented as a percentage of // resource metric across all relevant pods, represented as a percentage of
// the requested value of the resource for the pods. // the requested value of the resource for the pods.
// +optional
optional int32 averageUtilization = 3; optional int32 averageUtilization = 3;
} }
......
...@@ -200,16 +200,18 @@ type MetricTarget struct { ...@@ -200,16 +200,18 @@ type MetricTarget struct {
// type represents whether the metric type is Utilization, Value, or AverageValue // type represents whether the metric type is Utilization, Value, or AverageValue
Type MetricTargetType `json:"type" protobuf:"bytes,1,name=type"` Type MetricTargetType `json:"type" protobuf:"bytes,1,name=type"`
// value is the target value of the metric (as a quantity). // value is the target value of the metric (as a quantity).
Value *resource.Quantity `json:"value,omitempty" protobuf:"bytes,2,name=value"` // +optional
Value *resource.Quantity `json:"value,omitempty" protobuf:"bytes,2,opt,name=value"`
// averageValue is the target value of the average of the // averageValue 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)
AverageValue *resource.Quantity `json:"averageValue,omitempty" protobuf:"bytes,3,name=averageValue"` // +optional
AverageValue *resource.Quantity `json:"averageValue,omitempty" protobuf:"bytes,3,opt,name=averageValue"`
// averageUtilization is the target value of the average of the // averageUtilization is the target value of the average of the
// resource metric across all relevant pods, represented as a percentage of // resource metric across all relevant pods, represented as a percentage of
// the requested value of the resource for the pods. // the requested value of the resource for the pods.
// Currently only valid for Resource metric source type // Currently only valid for Resource metric source type
AverageUtilization *int32 `json:"averageUtilization,omitempty" protobuf:"bytes,4,name=averageUtilization"` // +optional
AverageUtilization *int32 `json:"averageUtilization,omitempty" protobuf:"bytes,4,opt,name=averageUtilization"`
} }
// MetricTargetType specifies the type of metric being targeted, and should be either // MetricTargetType specifies the type of metric being targeted, and should be either
...@@ -364,14 +366,17 @@ type ExternalMetricStatus struct { ...@@ -364,14 +366,17 @@ type ExternalMetricStatus struct {
// MetricValueStatus holds the current value for a metric // MetricValueStatus holds the current value for a metric
type MetricValueStatus struct { type MetricValueStatus struct {
// value is the current value of the metric (as a quantity). // value is the current value of the metric (as a quantity).
Value *resource.Quantity `json:"value" protobuf:"bytes,1,name=value"` // +optional
Value *resource.Quantity `json:"value,omitempty" protobuf:"bytes,1,opt,name=value"`
// averageValue is the current value of the average of the // averageValue 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)
AverageValue *resource.Quantity `json:"averageValue" protobuf:"bytes,2,name=averageValue"` // +optional
AverageValue *resource.Quantity `json:"averageValue,omitempty" protobuf:"bytes,2,opt,name=averageValue"`
// currentAverageUtilization is the current value of the average of the // currentAverageUtilization is the current value of the average of the
// resource metric across all relevant pods, represented as a percentage of // resource metric across all relevant pods, represented as a percentage of
// the requested value of the resource for the pods. // the requested value of the resource for the pods.
AverageUtilization *int32 `json:"averageUtilization" protobuf:"bytes,3,name=averageUtilization"` // +optional
AverageUtilization *int32 `json:"averageUtilization,omitempty" protobuf:"bytes,3,opt,name=averageUtilization"`
} }
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
......
...@@ -451,10 +451,6 @@ ...@@ -451,10 +451,6 @@
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}, },
{ {
"ImportPath": "k8s.io/client-go/discovery/cached",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
},
{
"ImportPath": "k8s.io/client-go/discovery/fake", "ImportPath": "k8s.io/client-go/discovery/fake",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}, },
......
...@@ -22,6 +22,7 @@ go_library( ...@@ -22,6 +22,7 @@ go_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/api/extensions/v1beta1:go_default_library", "//staging/src/k8s.io/api/extensions/v1beta1:go_default_library",
"//staging/src/k8s.io/api/rbac/v1:go_default_library", "//staging/src/k8s.io/api/rbac/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/api/meta:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/api/resource: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/labels:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/labels:go_default_library",
...@@ -29,8 +30,8 @@ go_library( ...@@ -29,8 +30,8 @@ go_library(
"//staging/src/k8s.io/apimachinery/pkg/selection:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/selection:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library",
"//staging/src/k8s.io/client-go/discovery:go_default_library", "//staging/src/k8s.io/client-go/discovery:go_default_library",
"//staging/src/k8s.io/client-go/discovery/cached:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes:go_default_library", "//staging/src/k8s.io/client-go/kubernetes:go_default_library",
"//staging/src/k8s.io/metrics/pkg/apis/custom_metrics/v1beta1:go_default_library",
"//staging/src/k8s.io/metrics/pkg/client/custom_metrics:go_default_library", "//staging/src/k8s.io/metrics/pkg/client/custom_metrics:go_default_library",
"//staging/src/k8s.io/metrics/pkg/client/external_metrics:go_default_library", "//staging/src/k8s.io/metrics/pkg/client/external_metrics:go_default_library",
"//test/e2e/common:go_default_library", "//test/e2e/common:go_default_library",
......
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