From fe902f7384aa3abbeb74373950f16fae4fe22576 Mon Sep 17 00:00:00 2001 From: Tim Hockin Date: Sun, 12 Nov 2023 15:12:40 -0800 Subject: [PATCH] Fix list_type_missing in api/autoscaling --- api/api-rules/violation_exceptions.list | 7 ---- pkg/generated/openapi/zz_generated.openapi.go | 35 +++++++++++++++++++ .../api/autoscaling/v2beta1/generated.proto | 3 ++ .../k8s.io/api/autoscaling/v2beta1/types.go | 3 ++ .../api/autoscaling/v2beta2/generated.proto | 4 +++ .../k8s.io/api/autoscaling/v2beta2/types.go | 4 +++ 6 files changed, 49 insertions(+), 7 deletions(-) diff --git a/api/api-rules/violation_exceptions.list b/api/api-rules/violation_exceptions.list index 2be956e7d3a..70f63598428 100644 --- a/api/api-rules/violation_exceptions.list +++ b/api/api-rules/violation_exceptions.list @@ -1,10 +1,3 @@ -API rule violation: list_type_missing,k8s.io/api/autoscaling/v2beta1,HorizontalPodAutoscalerSpec,Metrics -API rule violation: list_type_missing,k8s.io/api/autoscaling/v2beta1,HorizontalPodAutoscalerStatus,Conditions -API rule violation: list_type_missing,k8s.io/api/autoscaling/v2beta1,HorizontalPodAutoscalerStatus,CurrentMetrics -API rule violation: list_type_missing,k8s.io/api/autoscaling/v2beta2,HPAScalingRules,Policies -API rule violation: list_type_missing,k8s.io/api/autoscaling/v2beta2,HorizontalPodAutoscalerSpec,Metrics -API rule violation: list_type_missing,k8s.io/api/autoscaling/v2beta2,HorizontalPodAutoscalerStatus,Conditions -API rule violation: list_type_missing,k8s.io/api/autoscaling/v2beta2,HorizontalPodAutoscalerStatus,CurrentMetrics API rule violation: list_type_missing,k8s.io/api/core/v1,AvoidPods,PreferAvoidPods API rule violation: list_type_missing,k8s.io/api/core/v1,Capabilities,Add API rule violation: list_type_missing,k8s.io/api/core/v1,Capabilities,Drop diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/pkg/generated/openapi/zz_generated.openapi.go index 4650a0eadce..de81d1f5873 100644 --- a/pkg/generated/openapi/zz_generated.openapi.go +++ b/pkg/generated/openapi/zz_generated.openapi.go @@ -13919,6 +13919,11 @@ func schema_k8sio_api_autoscaling_v2beta1_HorizontalPodAutoscalerSpec(ref common }, }, "metrics": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "metrics contains the specifications for which to use to calculate the desired replica count (the maximum replica count across all metrics will be used). The desired replica count is calculated multiplying the ratio between the target value and the current value by the current number of pods. Ergo, metrics used must decrease as the pod count is increased, and vice-versa. See the individual metric source types for more information about how each type of metric must respond.", Type: []string{"array"}, @@ -13978,6 +13983,11 @@ func schema_k8sio_api_autoscaling_v2beta1_HorizontalPodAutoscalerStatus(ref comm }, }, "currentMetrics": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "currentMetrics is the last read state of the metrics used by this autoscaler.", Type: []string{"array"}, @@ -13992,6 +14002,11 @@ func schema_k8sio_api_autoscaling_v2beta1_HorizontalPodAutoscalerStatus(ref comm }, }, "conditions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "conditions is the set of conditions required for this autoscaler to scale its target, and indicates whether or not those conditions are met.", Type: []string{"array"}, @@ -14601,6 +14616,11 @@ func schema_k8sio_api_autoscaling_v2beta2_HPAScalingRules(ref common.ReferenceCa }, }, "policies": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "policies is a list of potential scaling polices which can be used during scaling. At least one policy must be specified, otherwise the HPAScalingRules will be discarded as invalid", Type: []string{"array"}, @@ -14832,6 +14852,11 @@ func schema_k8sio_api_autoscaling_v2beta2_HorizontalPodAutoscalerSpec(ref common }, }, "metrics": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "metrics contains the specifications for which to use to calculate the desired replica count (the maximum replica count across all metrics will be used). The desired replica count is calculated multiplying the ratio between the target value and the current value by the current number of pods. Ergo, metrics used must decrease as the pod count is increased, and vice-versa. See the individual metric source types for more information about how each type of metric must respond. If not set, the default metric will be set to 80% average CPU utilization.", Type: []string{"array"}, @@ -14897,6 +14922,11 @@ func schema_k8sio_api_autoscaling_v2beta2_HorizontalPodAutoscalerStatus(ref comm }, }, "currentMetrics": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "currentMetrics is the last read state of the metrics used by this autoscaler.", Type: []string{"array"}, @@ -14911,6 +14941,11 @@ func schema_k8sio_api_autoscaling_v2beta2_HorizontalPodAutoscalerStatus(ref comm }, }, "conditions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "conditions is the set of conditions required for this autoscaler to scale its target, and indicates whether or not those conditions are met.", Type: []string{"array"}, diff --git a/staging/src/k8s.io/api/autoscaling/v2beta1/generated.proto b/staging/src/k8s.io/api/autoscaling/v2beta1/generated.proto index 6b3d4152126..e2119d5550d 100644 --- a/staging/src/k8s.io/api/autoscaling/v2beta1/generated.proto +++ b/staging/src/k8s.io/api/autoscaling/v2beta1/generated.proto @@ -220,6 +220,7 @@ message HorizontalPodAutoscalerSpec { // increased, and vice-versa. See the individual metric source types for // more information about how each type of metric must respond. // +optional + // +listType=atomic repeated MetricSpec metrics = 4; } @@ -244,11 +245,13 @@ message HorizontalPodAutoscalerStatus { // currentMetrics is the last read state of the metrics used by this autoscaler. // +optional + // +listType=atomic repeated MetricStatus currentMetrics = 5; // conditions is the set of conditions required for this autoscaler to scale its target, // and indicates whether or not those conditions are met. // +optional + // +listType=atomic repeated HorizontalPodAutoscalerCondition conditions = 6; } diff --git a/staging/src/k8s.io/api/autoscaling/v2beta1/types.go b/staging/src/k8s.io/api/autoscaling/v2beta1/types.go index 842284072d9..193cc43549d 100644 --- a/staging/src/k8s.io/api/autoscaling/v2beta1/types.go +++ b/staging/src/k8s.io/api/autoscaling/v2beta1/types.go @@ -56,6 +56,7 @@ type HorizontalPodAutoscalerSpec struct { // increased, and vice-versa. See the individual metric source types for // more information about how each type of metric must respond. // +optional + // +listType=atomic Metrics []MetricSpec `json:"metrics,omitempty" protobuf:"bytes,4,rep,name=metrics"` } @@ -260,11 +261,13 @@ type HorizontalPodAutoscalerStatus struct { // currentMetrics is the last read state of the metrics used by this autoscaler. // +optional + // +listType=atomic CurrentMetrics []MetricStatus `json:"currentMetrics" protobuf:"bytes,5,rep,name=currentMetrics"` // conditions is the set of conditions required for this autoscaler to scale its target, // and indicates whether or not those conditions are met. // +optional + // +listType=atomic Conditions []HorizontalPodAutoscalerCondition `json:"conditions" protobuf:"bytes,6,rep,name=conditions"` } diff --git a/staging/src/k8s.io/api/autoscaling/v2beta2/generated.proto b/staging/src/k8s.io/api/autoscaling/v2beta2/generated.proto index 5b2fe9442aa..41f7a16ea12 100644 --- a/staging/src/k8s.io/api/autoscaling/v2beta2/generated.proto +++ b/staging/src/k8s.io/api/autoscaling/v2beta2/generated.proto @@ -136,6 +136,7 @@ message HPAScalingRules { // policies is a list of potential scaling polices which can be used during scaling. // At least one policy must be specified, otherwise the HPAScalingRules will be discarded as invalid // +optional + // +listType=atomic repeated HPAScalingPolicy policies = 2; } @@ -238,6 +239,7 @@ message HorizontalPodAutoscalerSpec { // more information about how each type of metric must respond. // If not set, the default metric will be set to 80% average CPU utilization. // +optional + // +listType=atomic repeated MetricSpec metrics = 4; // behavior configures the scaling behavior of the target @@ -268,11 +270,13 @@ message HorizontalPodAutoscalerStatus { // currentMetrics is the last read state of the metrics used by this autoscaler. // +optional + // +listType=atomic repeated MetricStatus currentMetrics = 5; // conditions is the set of conditions required for this autoscaler to scale its target, // and indicates whether or not those conditions are met. // +optional + // +listType=atomic repeated HorizontalPodAutoscalerCondition conditions = 6; } diff --git a/staging/src/k8s.io/api/autoscaling/v2beta2/types.go b/staging/src/k8s.io/api/autoscaling/v2beta2/types.go index b0b7681c0eb..2fee0b8a0f0 100644 --- a/staging/src/k8s.io/api/autoscaling/v2beta2/types.go +++ b/staging/src/k8s.io/api/autoscaling/v2beta2/types.go @@ -76,6 +76,7 @@ type HorizontalPodAutoscalerSpec struct { // more information about how each type of metric must respond. // If not set, the default metric will be set to 80% average CPU utilization. // +optional + // +listType=atomic Metrics []MetricSpec `json:"metrics,omitempty" protobuf:"bytes,4,rep,name=metrics"` // behavior configures the scaling behavior of the target @@ -199,6 +200,7 @@ type HPAScalingRules struct { // policies is a list of potential scaling polices which can be used during scaling. // At least one policy must be specified, otherwise the HPAScalingRules will be discarded as invalid // +optional + // +listType=atomic Policies []HPAScalingPolicy `json:"policies,omitempty" protobuf:"bytes,2,rep,name=policies"` } @@ -393,11 +395,13 @@ type HorizontalPodAutoscalerStatus struct { // currentMetrics is the last read state of the metrics used by this autoscaler. // +optional + // +listType=atomic CurrentMetrics []MetricStatus `json:"currentMetrics" protobuf:"bytes,5,rep,name=currentMetrics"` // conditions is the set of conditions required for this autoscaler to scale its target, // and indicates whether or not those conditions are met. // +optional + // +listType=atomic Conditions []HorizontalPodAutoscalerCondition `json:"conditions" protobuf:"bytes,6,rep,name=conditions"` }