Skip to content

Commit 76bd48b

Browse files
DirectXMan12damemi
authored andcommitted
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.
1 parent 364afe4 commit 76bd48b

File tree

7 files changed

+23
-25
lines changed

7 files changed

+23
-25
lines changed

api/openapi-spec/swagger.json

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/swagger-spec/autoscaling_v2beta2.json

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/api-reference/autoscaling/v2beta2/definitions.html

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

staging/src/k8s.io/api/autoscaling/v2beta2/generated.proto

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

staging/src/k8s.io/api/autoscaling/v2beta2/types.go

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,16 +200,18 @@ type MetricTarget struct {
200200
// type represents whether the metric type is Utilization, Value, or AverageValue
201201
Type MetricTargetType `json:"type" protobuf:"bytes,1,name=type"`
202202
// value is the target value of the metric (as a quantity).
203-
Value *resource.Quantity `json:"value,omitempty" protobuf:"bytes,2,name=value"`
203+
// +optional
204+
Value *resource.Quantity `json:"value,omitempty" protobuf:"bytes,2,opt,name=value"`
204205
// averageValue is the target value of the average of the
205206
// metric across all relevant pods (as a quantity)
206-
AverageValue *resource.Quantity `json:"averageValue,omitempty" protobuf:"bytes,3,name=averageValue"`
207-
207+
// +optional
208+
AverageValue *resource.Quantity `json:"averageValue,omitempty" protobuf:"bytes,3,opt,name=averageValue"`
208209
// averageUtilization is the target value of the average of the
209210
// resource metric across all relevant pods, represented as a percentage of
210211
// the requested value of the resource for the pods.
211212
// Currently only valid for Resource metric source type
212-
AverageUtilization *int32 `json:"averageUtilization,omitempty" protobuf:"bytes,4,name=averageUtilization"`
213+
// +optional
214+
AverageUtilization *int32 `json:"averageUtilization,omitempty" protobuf:"bytes,4,opt,name=averageUtilization"`
213215
}
214216

215217
// MetricTargetType specifies the type of metric being targeted, and should be either
@@ -364,14 +366,17 @@ type ExternalMetricStatus struct {
364366
// MetricValueStatus holds the current value for a metric
365367
type MetricValueStatus struct {
366368
// value is the current value of the metric (as a quantity).
367-
Value *resource.Quantity `json:"value" protobuf:"bytes,1,name=value"`
369+
// +optional
370+
Value *resource.Quantity `json:"value,omitempty" protobuf:"bytes,1,opt,name=value"`
368371
// averageValue is the current value of the average of the
369372
// metric across all relevant pods (as a quantity)
370-
AverageValue *resource.Quantity `json:"averageValue" protobuf:"bytes,2,name=averageValue"`
373+
// +optional
374+
AverageValue *resource.Quantity `json:"averageValue,omitempty" protobuf:"bytes,2,opt,name=averageValue"`
371375
// currentAverageUtilization is the current value of the average of the
372376
// resource metric across all relevant pods, represented as a percentage of
373377
// the requested value of the resource for the pods.
374-
AverageUtilization *int32 `json:"averageUtilization" protobuf:"bytes,3,name=averageUtilization"`
378+
// +optional
379+
AverageUtilization *int32 `json:"averageUtilization,omitempty" protobuf:"bytes,3,opt,name=averageUtilization"`
375380
}
376381

377382
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

staging/src/k8s.io/metrics/Godeps/Godeps.json

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/e2e/instrumentation/monitoring/BUILD

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,16 @@ go_library(
2222
"//staging/src/k8s.io/api/core/v1:go_default_library",
2323
"//staging/src/k8s.io/api/extensions/v1beta1:go_default_library",
2424
"//staging/src/k8s.io/api/rbac/v1:go_default_library",
25+
"//staging/src/k8s.io/apimachinery/pkg/api/meta:go_default_library",
2526
"//staging/src/k8s.io/apimachinery/pkg/api/resource:go_default_library",
2627
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
2728
"//staging/src/k8s.io/apimachinery/pkg/labels:go_default_library",
2829
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
2930
"//staging/src/k8s.io/apimachinery/pkg/selection:go_default_library",
3031
"//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library",
3132
"//staging/src/k8s.io/client-go/discovery:go_default_library",
32-
"//staging/src/k8s.io/client-go/discovery/cached:go_default_library",
3333
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
34+
"//staging/src/k8s.io/metrics/pkg/apis/custom_metrics/v1beta1:go_default_library",
3435
"//staging/src/k8s.io/metrics/pkg/client/custom_metrics:go_default_library",
3536
"//staging/src/k8s.io/metrics/pkg/client/external_metrics:go_default_library",
3637
"//test/e2e/common:go_default_library",

0 commit comments

Comments
 (0)