Skip to content

Commit

Permalink
Fix up potentially empty fields in HPA v2beta2
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
DirectXMan12 authored and damemi committed Sep 6, 2018
1 parent 364afe4 commit 76bd48b
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 25 deletions.
5 changes: 0 additions & 5 deletions api/openapi-spec/swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions api/swagger-spec/autoscaling_v2beta2.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions docs/api-reference/autoscaling/v2beta2/definitions.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions staging/src/k8s.io/api/autoscaling/v2beta2/generated.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 12 additions & 7 deletions staging/src/k8s.io/api/autoscaling/v2beta2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,16 +200,18 @@ type MetricTarget struct {
// type represents whether the metric type is Utilization, Value, or AverageValue
Type MetricTargetType `json:"type" protobuf:"bytes,1,name=type"`
// 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
// 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
// resource metric across all relevant pods, represented as a percentage of
// the requested value of the resource for the pods.
// 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
Expand Down Expand Up @@ -364,14 +366,17 @@ type ExternalMetricStatus struct {
// MetricValueStatus holds the current value for a metric
type MetricValueStatus struct {
// 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
// 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
// resource metric across all relevant pods, represented as a percentage of
// 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
Expand Down
4 changes: 0 additions & 4 deletions staging/src/k8s.io/metrics/Godeps/Godeps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion test/e2e/instrumentation/monitoring/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@ go_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/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/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/labels:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema: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/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/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/external_metrics:go_default_library",
"//test/e2e/common:go_default_library",
Expand Down

0 comments on commit 76bd48b

Please sign in to comment.