Skip to content

Commit c30da38

Browse files
authored
Merge pull request kubernetes#90148 from deads2k/force-beta-to-have-tags
enforce prerelease-lifecycle generation for beta APIs
2 parents 4d813c1 + d9d6b58 commit c30da38

File tree

12 files changed

+58
-20
lines changed

12 files changed

+58
-20
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2020 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# This script verifies whether codes follow golang convention.
18+
# Usage: `hack/verify-prerelease-lifecycle-tags.sh`.
19+
20+
set -o errexit
21+
set -o nounset
22+
set -o pipefail
23+
24+
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
25+
source "${KUBE_ROOT}/hack/lib/init.sh"
26+
27+
kube::golang::verify_go_version
28+
29+
cd "${KUBE_ROOT}"
30+
if git --no-pager grep -L '// +k8s:prerelease-lifecycle-gen=true' -- 'staging/src/k8s.io/api/**/*beta*/doc.go'; then
31+
echo "!!! Some beta packages doc.go do not include prerelease-lifecycle tags."
32+
echo "To fix these errors, add '// +k8s:prerelease-lifecycle-gen=true' to doc.go and"
33+
echo "add '// +k8s:prerelease-lifecycle-gen:introduced=1.<release>' to every type that embeds metav1.TypeMeta"
34+
exit 1
35+
fi
36+
37+
if git --no-pager grep -L '// +k8s:prerelease-lifecycle-gen=true' -- 'staging/src/k8s.io/kube-aggregator/pkg/apis/**/*beta*/doc.go'; then
38+
echo "!!! Some beta packages doc.go do not include prerelease-lifecycle tags."
39+
echo "To fix these errors, add '// +k8s:prerelease-lifecycle-gen=true' to doc.go and"
40+
echo "add '// +k8s:prerelease-lifecycle-gen:introduced=1.<release>' to every type that embeds metav1.TypeMeta"
41+
exit 1
42+
fi
43+
44+
if git --no-pager grep -L '// +k8s:prerelease-lifecycle-gen=true' -- 'staging/src/k8s.io/apiextensions-apisever/pkg/apis/**/*beta*/doc.go'; then
45+
echo "!!! Some beta packages doc.go do not include prerelease-lifecycle tags."
46+
echo "To fix these errors, add '// +k8s:prerelease-lifecycle-gen=true' to doc.go and"
47+
echo "add '// +k8s:prerelease-lifecycle-gen:introduced=1.<release>' to every type that embeds metav1.TypeMeta"
48+
exit 1
49+
fi

staging/src/k8s.io/api/authentication/v1beta1/types.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
2929
// +k8s:prerelease-lifecycle-gen:introduced=1.4
3030
// +k8s:prerelease-lifecycle-gen:deprecated=1.19
31-
// +k8s:prerelease-lifecycle-gen:removed=1.22
3231
// +k8s:prerelease-lifecycle-gen:replacement=authentication.k8s.io,v1,TokenReview
3332

3433
// TokenReview attempts to authenticate a token to a known user.

staging/src/k8s.io/api/authorization/v1beta1/types.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
2929
// +k8s:prerelease-lifecycle-gen:introduced=1.2
3030
// +k8s:prerelease-lifecycle-gen:deprecated=1.19
31-
// +k8s:prerelease-lifecycle-gen:removed=1.22
3231
// +k8s:prerelease-lifecycle-gen:replacement=authorization.k8s.io,v1,SubjectAccessReview
3332

3433
// SubjectAccessReview checks whether or not a user or group can perform an action.
@@ -51,7 +50,6 @@ type SubjectAccessReview struct {
5150
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
5251
// +k8s:prerelease-lifecycle-gen:introduced=1.2
5352
// +k8s:prerelease-lifecycle-gen:deprecated=1.19
54-
// +k8s:prerelease-lifecycle-gen:removed=1.22
5553
// +k8s:prerelease-lifecycle-gen:replacement=authorization.k8s.io,v1,SelfSubjectAccessReview
5654

5755
// SelfSubjectAccessReview checks whether or the current user can perform an action. Not filling in a
@@ -75,7 +73,6 @@ type SelfSubjectAccessReview struct {
7573
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
7674
// +k8s:prerelease-lifecycle-gen:introduced=1.2
7775
// +k8s:prerelease-lifecycle-gen:deprecated=1.19
78-
// +k8s:prerelease-lifecycle-gen:removed=1.22
7976
// +k8s:prerelease-lifecycle-gen:replacement=authorization.k8s.io,v1,LocalSubjectAccessReview
8077

8178
// LocalSubjectAccessReview checks whether or not a user or group can perform an action in a given namespace.
@@ -205,7 +202,6 @@ type SubjectAccessReviewStatus struct {
205202
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
206203
// +k8s:prerelease-lifecycle-gen:introduced=1.8
207204
// +k8s:prerelease-lifecycle-gen:deprecated=1.19
208-
// +k8s:prerelease-lifecycle-gen:removed=1.22
209205
// +k8s:prerelease-lifecycle-gen:replacement=authorization.k8s.io,v1,SelfSubjectRulesReview
210206

211207
// SelfSubjectRulesReview enumerates the set of actions the current user can perform within a namespace.

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,6 @@ type ExternalMetricStatus struct {
375375
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
376376
// +k8s:prerelease-lifecycle-gen:introduced=1.8
377377
// +k8s:prerelease-lifecycle-gen:deprecated=1.22
378-
// +k8s:prerelease-lifecycle-gen:removed=1.25
379378
// +k8s:prerelease-lifecycle-gen:replacement=autoscaling,v2beta2,HorizontalPodAutoscaler
380379

381380
// HorizontalPodAutoscaler is the configuration for a horizontal pod
@@ -401,7 +400,6 @@ type HorizontalPodAutoscaler struct {
401400
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
402401
// +k8s:prerelease-lifecycle-gen:introduced=1.8
403402
// +k8s:prerelease-lifecycle-gen:deprecated=1.22
404-
// +k8s:prerelease-lifecycle-gen:removed=1.25
405403
// +k8s:prerelease-lifecycle-gen:replacement=autoscaling,v2beta2,HorizontalPodAutoscalerList
406404

407405
// HorizontalPodAutoscaler is a list of horizontal pod autoscaler objects.

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
2929
// +k8s:prerelease-lifecycle-gen:introduced=1.12
3030
// +k8s:prerelease-lifecycle-gen:deprecated=1.22
31-
// +k8s:prerelease-lifecycle-gen:removed=1.25
3231

3332
// HorizontalPodAutoscaler is the configuration for a horizontal pod
3433
// autoscaler, which automatically manages the replica count of any resource
@@ -472,7 +471,6 @@ type MetricValueStatus struct {
472471
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
473472
// +k8s:prerelease-lifecycle-gen:introduced=1.12
474473
// +k8s:prerelease-lifecycle-gen:deprecated=1.22
475-
// +k8s:prerelease-lifecycle-gen:removed=1.25
476474

477475
// HorizontalPodAutoscalerList is a list of horizontal pod autoscaler objects.
478476
type HorizontalPodAutoscalerList struct {

staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ go_library(
1414
"register.go",
1515
"types.go",
1616
"zz_generated.deepcopy.go",
17-
"zz_generated.prerelease-lifecycle.go",
1817
],
1918
importmap = "k8s.io/kubernetes/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration",
2019
importpath = "k8s.io/kube-aggregator/pkg/apis/apiregistration",

staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration/doc.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ limitations under the License.
1616

1717
// +k8s:deepcopy-gen=package
1818
// +groupName=apiregistration.k8s.io
19-
// +k8s:prerelease-lifecycle-gen=true
2019

2120
// Package apiregistration is the internal version of the API.
2221
package apiregistration // import "k8s.io/kube-aggregator/pkg/apis/apiregistration"

staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration/types.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ package apiregistration
1919
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2020

2121
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
22-
// +k8s:prerelease-lifecycle-gen:introduced=1.7
23-
// +k8s:prerelease-lifecycle-gen:deprecated=1.19
24-
// +k8s:prerelease-lifecycle-gen:removed=1.22
25-
// +k8s:prerelease-lifecycle-gen:replacement=apiregistration.k8s.io,v1,APIServiceList
2622

2723
// APIServiceList is a list of APIService objects.
2824
type APIServiceList struct {
@@ -133,10 +129,6 @@ type APIServiceStatus struct {
133129
// +genclient
134130
// +genclient:nonNamespaced
135131
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
136-
// +k8s:prerelease-lifecycle-gen:introduced=1.7
137-
// +k8s:prerelease-lifecycle-gen:deprecated=1.19
138-
// +k8s:prerelease-lifecycle-gen:removed=1.22
139-
// +k8s:prerelease-lifecycle-gen:replacement=apiregistration.k8s.io,v1,APIService
140132

141133
// APIService represents a server for a particular GroupVersion.
142134
// Name must be "version.group".

staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1beta1/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ go_library(
1616
"zz_generated.conversion.go",
1717
"zz_generated.deepcopy.go",
1818
"zz_generated.defaults.go",
19+
"zz_generated.prerelease-lifecycle.go",
1920
],
2021
importmap = "k8s.io/kubernetes/vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1beta1",
2122
importpath = "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1beta1",

staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1beta1/doc.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ limitations under the License.
2020
// +k8s:openapi-gen=true
2121
// +groupName=apiregistration.k8s.io
2222
// +k8s:defaulter-gen=TypeMeta
23+
// +k8s:prerelease-lifecycle-gen=true
2324

2425
// Package v1beta1 contains the API Registration API, which is responsible for
2526
// registering an API `Group`/`Version` with another kubernetes like API server.

0 commit comments

Comments
 (0)