Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move autoscaling/v2 from alpha1 to beta1 #50708

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
250 changes: 97 additions & 153 deletions api/openapi-spec/swagger.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions api/swagger-spec/resourceListing.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
"description": "API at /apis/autoscaling/v1"
},
{
"path": "/apis/autoscaling/v2alpha1",
"description": "API at /apis/autoscaling/v2alpha1"
"path": "/apis/autoscaling/v2beta1",
"description": "API at /apis/autoscaling/v2beta1"
},
{
"path": "/apis/autoscaling",
Expand Down
2 changes: 1 addition & 1 deletion cmd/kube-apiserver/app/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ var apiVersionPriorities = map[schema.GroupVersion]priority{
{Group: "authorization.k8s.io", Version: "v1"}: {group: 17600, version: 15},
{Group: "authorization.k8s.io", Version: "v1beta1"}: {group: 17600, version: 9},
{Group: "autoscaling", Version: "v1"}: {group: 17500, version: 15},
{Group: "autoscaling", Version: "v2alpha1"}: {group: 17500, version: 9},
{Group: "autoscaling", Version: "v2beta1"}: {group: 17500, version: 9},
{Group: "batch", Version: "v1"}: {group: 17400, version: 15},
{Group: "batch", Version: "v1beta1"}: {group: 17400, version: 9},
{Group: "batch", Version: "v2alpha1"}: {group: 17400, version: 9},
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions federation/apis/openapi-spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -14099,7 +14099,7 @@
},
{
"group": "autoscaling",
"version": "v2alpha1",
"version": "v2beta1",
"kind": "DeleteOptions"
},
{
Expand Down Expand Up @@ -14613,7 +14613,7 @@
},
{
"group": "autoscaling",
"version": "v2alpha1",
"version": "v2beta1",
"kind": "WatchEvent"
},
{
Expand Down
6 changes: 3 additions & 3 deletions hack/.golint_failures
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ staging/src/k8s.io/api/authentication/v1beta1
staging/src/k8s.io/api/authorization/v1
staging/src/k8s.io/api/authorization/v1beta1
staging/src/k8s.io/api/autoscaling/v1
staging/src/k8s.io/api/autoscaling/v2alpha1
staging/src/k8s.io/api/autoscaling/v2beta1
staging/src/k8s.io/api/batch/v1
staging/src/k8s.io/api/batch/v1beta1
staging/src/k8s.io/api/batch/v2alpha1
Expand Down Expand Up @@ -697,8 +697,8 @@ staging/src/k8s.io/client-go/kubernetes/typed/authorization/v1beta1
staging/src/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/fake
staging/src/k8s.io/client-go/kubernetes/typed/autoscaling/v1
staging/src/k8s.io/client-go/kubernetes/typed/autoscaling/v1/fake
staging/src/k8s.io/client-go/kubernetes/typed/autoscaling/v2alpha1
staging/src/k8s.io/client-go/kubernetes/typed/autoscaling/v2alpha1/fake
staging/src/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1
staging/src/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/fake
staging/src/k8s.io/client-go/kubernetes/typed/batch/v1
staging/src/k8s.io/client-go/kubernetes/typed/batch/v1/fake
staging/src/k8s.io/client-go/kubernetes/typed/batch/v1beta1
Expand Down
2 changes: 1 addition & 1 deletion hack/lib/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ authentication.k8s.io/v1beta1 \
authorization.k8s.io/v1 \
authorization.k8s.io/v1beta1 \
autoscaling/v1 \
autoscaling/v2alpha1 \
autoscaling/v2beta1 \
batch/v1 \
batch/v1beta1 \
batch/v2alpha1 \
Expand Down
4 changes: 2 additions & 2 deletions pkg/api/defaulting_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ func TestDefaulting(t *testing.T) {
{Group: "apps", Version: "v1beta2", Kind: "StatefulSetList"}: {},
{Group: "autoscaling", Version: "v1", Kind: "HorizontalPodAutoscaler"}: {},
{Group: "autoscaling", Version: "v1", Kind: "HorizontalPodAutoscalerList"}: {},
{Group: "autoscaling", Version: "v2alpha1", Kind: "HorizontalPodAutoscaler"}: {},
{Group: "autoscaling", Version: "v2alpha1", Kind: "HorizontalPodAutoscalerList"}: {},
{Group: "autoscaling", Version: "v2beta1", Kind: "HorizontalPodAutoscaler"}: {},
{Group: "autoscaling", Version: "v2beta1", Kind: "HorizontalPodAutoscalerList"}: {},
{Group: "batch", Version: "v1", Kind: "Job"}: {},
{Group: "batch", Version: "v1", Kind: "JobList"}: {},
{Group: "batch", Version: "v1beta1", Kind: "CronJob"}: {},
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/autoscaling/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ filegroup(
"//pkg/apis/autoscaling/fuzzer:all-srcs",
"//pkg/apis/autoscaling/install:all-srcs",
"//pkg/apis/autoscaling/v1:all-srcs",
"//pkg/apis/autoscaling/v2alpha1:all-srcs",
"//pkg/apis/autoscaling/v2beta1:all-srcs",
"//pkg/apis/autoscaling/validation:all-srcs",
],
tags = ["automanaged"],
Expand Down
8 changes: 4 additions & 4 deletions pkg/apis/autoscaling/annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ limitations under the License.
package autoscaling

// MetricSpecsAnnotation is the annotation which holds non-CPU-utilization HPA metric
// specs when converting the `Metrics` field from autoscaling/v2alpha1
// specs when converting the `Metrics` field from autoscaling/v2beta1
const MetricSpecsAnnotation = "autoscaling.alpha.kubernetes.io/metrics"

// MetricStatusesAnnotation is the annotation which holds non-CPU-utilization HPA metric
// statuses when converting the `CurrentMetrics` field from autoscaling/v2alpha1
// statuses when converting the `CurrentMetrics` field from autoscaling/v2beta1
const MetricStatusesAnnotation = "autoscaling.alpha.kubernetes.io/current-metrics"

// HorizontalPodAutoscalerConditionsAnnotation is the annotation which holds the conditions
// of an HPA when converting the `Conditions` field from autoscaling/v2alpha1
// of an HPA when converting the `Conditions` field from autoscaling/v2beta1
const HorizontalPodAutoscalerConditionsAnnotation = "autoscaling.alpha.kubernetes.io/conditions"

// DefaultCPUUtilization is the default value for CPU utilization, provided no other
// metrics are present. This is here because it's used by both the v2alpha1 defaulting
// metrics are present. This is here because it's used by both the v2beta1 defaulting
// logic, and the pseudo-defaulting done in v1 conversion.
const DefaultCPUUtilization = 80
2 changes: 1 addition & 1 deletion pkg/apis/autoscaling/install/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ go_library(
"//pkg/api:go_default_library",
"//pkg/apis/autoscaling:go_default_library",
"//pkg/apis/autoscaling/v1:go_default_library",
"//pkg/apis/autoscaling/v2alpha1:go_default_library",
"//pkg/apis/autoscaling/v2beta1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apimachinery/announced:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apimachinery/registered:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
Expand Down
8 changes: 4 additions & 4 deletions pkg/apis/autoscaling/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/autoscaling"
"k8s.io/kubernetes/pkg/apis/autoscaling/v1"
"k8s.io/kubernetes/pkg/apis/autoscaling/v2alpha1"
"k8s.io/kubernetes/pkg/apis/autoscaling/v2beta1"
)

func init() {
Expand All @@ -37,12 +37,12 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
if err := announced.NewGroupMetaFactory(
&announced.GroupMetaFactoryArgs{
GroupName: autoscaling.GroupName,
VersionPreferenceOrder: []string{v1.SchemeGroupVersion.Version, v2alpha1.SchemeGroupVersion.Version},
VersionPreferenceOrder: []string{v1.SchemeGroupVersion.Version, v2beta1.SchemeGroupVersion.Version},
AddInternalObjectsToScheme: autoscaling.AddToScheme,
},
announced.VersionToSchemeFunc{
v1.SchemeGroupVersion.Version: v1.AddToScheme,
v2alpha1.SchemeGroupVersion.Version: v2alpha1.AddToScheme,
v1.SchemeGroupVersion.Version: v1.AddToScheme,
v2beta1.SchemeGroupVersion.Version: v2beta1.AddToScheme,
},
).Announce(groupFactoryRegistry).RegisterAndEnable(registry, scheme); err != nil {
panic(err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/autoscaling/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ type HorizontalPodAutoscaler struct {

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

// HorizontalPodAutoscaler is a list of horizontal pod autoscaler objects.
// HorizontalPodAutoscalerList is a list of horizontal pod autoscaler objects.
type HorizontalPodAutoscalerList struct {
metav1.TypeMeta
// Metadata is the standard list metadata.
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/autoscaling/v1/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func Convert_v1_HorizontalPodAutoscaler_To_autoscaling_HorizontalPodAutoscaler(i
delete(out.Annotations, autoscaling.MetricStatusesAnnotation)
}

// autoscaling/v1 formerly had an implicit default applied in the controller. In v2alpha1, we apply it explicitly.
// autoscaling/v1 formerly had an implicit default applied in the controller. In v2beta1, we apply it explicitly.
// We apply it here, explicitly, since we have access to the full set of metrics from the annotation.
if len(out.Spec.Metrics) == 0 {
// no other metrics, no explicit CPU value set
Expand Down