Skip to content

Commit a3e2696

Browse files
committed
update hack/update-codegen
Signed-off-by: Iceber Gu <[email protected]>
1 parent 33febe6 commit a3e2696

27 files changed

+3588
-155
lines changed

hack/tools.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
//+build tools
1+
//go:build tools
2+
// +build tools
23

34
package hack
45

56
import (
67
_ "k8s.io/code-generator"
8+
_ "k8s.io/kube-openapi/cmd/openapi-gen"
79
_ "k8s.io/kubernetes/cmd/preferredimports"
810
_ "sigs.k8s.io/controller-tools/cmd/controller-gen"
911
)

hack/update-codegen.sh

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ GO111MODULE=on go install k8s.io/code-generator/cmd/conversion-gen
1313
GO111MODULE=on go install k8s.io/code-generator/cmd/client-gen
1414
GO111MODULE=on go install k8s.io/code-generator/cmd/lister-gen
1515
GO111MODULE=on go install k8s.io/code-generator/cmd/informer-gen
16-
GO111MODULE=on go install k8s.io/code-generator/cmd/openapi-gen
16+
GO111MODULE=on go install k8s.io/kube-openapi/cmd/openapi-gen
1717

1818
GOPATH=$(go env GOPATH | awk -F ':' '{print $1}')
1919
export PATH=$PATH:$GOPATH/bin
@@ -29,26 +29,26 @@ cd "${API_ROOT}"
2929
echo "Generating with deepcopy-gen"
3030
deepcopy-gen \
3131
--go-header-file="${REPO_ROOT}/hack/boilerplate.go.txt" \
32-
--input-dirs="./cluster/v1alpha2" \
33-
--output-file-base="zz_generated.deepcopy"
32+
--bounding-dirs="cluster/v1alpha2" \
33+
--output-file="zz_generated.deepcopy.go"
3434
deepcopy-gen \
3535
--go-header-file="${REPO_ROOT}/hack/boilerplate.go.txt" \
36-
--input-dirs="./policy/v1alpha1" \
37-
--output-file-base="zz_generated.deepcopy"
36+
--bounding-dirs="policy/v1alpha1" \
37+
--output-file="zz_generated.deepcopy.go"
3838
deepcopy-gen \
3939
--go-header-file="${REPO_ROOT}/hack/boilerplate.go.txt" \
40-
--input-dirs="./clusterpedia/v1beta1" \
41-
--output-file-base="zz_generated.deepcopy"
40+
--bounding-dirs="clusterpedia/v1beta1" \
41+
--output-file="zz_generated.deepcopy.go"
4242
deepcopy-gen \
4343
--go-header-file="${REPO_ROOT}/hack/boilerplate.go.txt" \
44-
--input-dirs="./clusterpedia" \
45-
--output-file-base="zz_generated.deepcopy"
44+
--bounding-dirs="clusterpedia" \
45+
--output-file="zz_generated.deepcopy.go"
4646

4747
echo "Generating with conversion-gen"
4848
conversion-gen \
4949
--go-header-file="${REPO_ROOT}/hack/boilerplate.go.txt" \
50-
--input-dirs="./clusterpedia/v1beta1" \
51-
--output-file-base="zz_generated.conversion"
50+
--base-peer-dirs="./clusterpedia/v1beta1" \
51+
--output-file="zz_generated.conversion.go"
5252

5353
echo "change directory: ${REPO_ROOT}"
5454
cd "${REPO_ROOT}"
@@ -74,30 +74,35 @@ client-gen \
7474
--go-header-file="hack/boilerplate.go.txt" \
7575
--input-base="github.com/clusterpedia-io/api" \
7676
--input="cluster/v1alpha2,policy/v1alpha1" \
77-
--output-package="github.com/clusterpedia-io/clusterpedia/pkg/generated/clientset" \
77+
--output-dir="pkg/generated/clientset" \
78+
--output-pkg="github.com/clusterpedia-io/clusterpedia/pkg/generated/clientset" \
7879
--clientset-name="versioned" \
7980
--plural-exceptions="ClusterSyncResources:ClusterSyncResources"
8081

8182
echo "Generating with lister-gen"
8283
lister-gen \
8384
--go-header-file="hack/boilerplate.go.txt" \
84-
--input-dirs="github.com/clusterpedia-io/api/cluster/v1alpha2,github.com/clusterpedia-io/api/policy/v1alpha1" \
85-
--output-package="github.com/clusterpedia-io/clusterpedia/pkg/generated/listers" \
86-
--plural-exceptions="ClusterSyncResources:ClusterSyncResources"
85+
--output-dir="pkg/generated/listers" \
86+
--output-pkg="github.com/clusterpedia-io/clusterpedia/pkg/generated/listers" \
87+
--plural-exceptions="ClusterSyncResources:ClusterSyncResources" \
88+
github.com/clusterpedia-io/api/cluster/v1alpha2 github.com/clusterpedia-io/api/policy/v1alpha1
89+
8790

8891
echo "Generating with informer-gen"
8992
informer-gen \
9093
--go-header-file="hack/boilerplate.go.txt" \
91-
--input-dirs="github.com/clusterpedia-io/api/cluster/v1alpha2,github.com/clusterpedia-io/api/policy/v1alpha1" \
9294
--versioned-clientset-package="github.com/clusterpedia-io/clusterpedia/pkg/generated/clientset/versioned" \
9395
--listers-package="github.com/clusterpedia-io/clusterpedia/pkg/generated/listers" \
94-
--output-package="github.com/clusterpedia-io/clusterpedia/pkg/generated/informers" \
95-
--plural-exceptions="ClusterSyncResources:ClusterSyncResources"
96+
--output-dir="pkg/generated/informers" \
97+
--output-pkg="github.com/clusterpedia-io/clusterpedia/pkg/generated/informers" \
98+
--plural-exceptions="ClusterSyncResources:ClusterSyncResources" \
99+
github.com/clusterpedia-io/api/cluster/v1alpha2 github.com/clusterpedia-io/api/policy/v1alpha1
96100

97101
echo "Generating with openapi-gen"
98102
openapi-gen \
99-
--go-header-file hack/boilerplate.go.txt \
100-
--input-dirs="github.com/clusterpedia-io/clusterpedia/pkg/apis/pedia/v1alpha1,github.com/clusterpedia-io/api/cluster/v1alpha2,github.com/clusterpedia-io/api/policy/v1alpha1,github.com/clusterpedia-io/api/clusterpedia/v1beta1" \
101-
--input-dirs "k8s.io/apimachinery/pkg/apis/meta/v1,k8s.io/apimachinery/pkg/runtime,k8s.io/apimachinery/pkg/version" \
102-
--output-package=github.com/clusterpedia-io/clusterpedia/pkg/generated/openapi \
103-
-O zz_generated.openapi
103+
--go-header-file="hack/boilerplate.go.txt" \
104+
--output-dir="pkg/generated/openapi" \
105+
--output-pkg="github.com/clusterpedia-io/clusterpedia/pkg/generated/openapi" \
106+
--output-file="zz_generated.openapi.go" \
107+
github.com/clusterpedia-io/api/cluster/v1alpha2 github.com/clusterpedia-io/api/policy/v1alpha1 github.com/clusterpedia-io/api/clusterpedia/v1beta1 \
108+
k8s.io/apimachinery/pkg/apis/meta/v1 k8s.io/apimachinery/pkg/runtime k8s.io/apimachinery/pkg/version

kustomize/crds/cluster.clusterpedia.io_clustersyncresources.yaml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.13.0
6+
controller-gen.kubebuilder.io/version: v0.15.0
77
name: clustersyncresources.cluster.clusterpedia.io
88
spec:
99
group: cluster.clusterpedia.io
@@ -19,14 +19,19 @@ spec:
1919
openAPIV3Schema:
2020
properties:
2121
apiVersion:
22-
description: 'APIVersion defines the versioned schema of this representation
23-
of an object. Servers should convert recognized schemas to the latest
24-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
22+
description: |-
23+
APIVersion defines the versioned schema of this representation of an object.
24+
Servers should convert recognized schemas to the latest internal value, and
25+
may reject unrecognized values.
26+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
2527
type: string
2628
kind:
27-
description: 'Kind is a string value representing the REST resource this
28-
object represents. Servers may infer this from the endpoint the client
29-
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
29+
description: |-
30+
Kind is a string value representing the REST resource this object represents.
31+
Servers may infer this from the endpoint the client submits requests to.
32+
Cannot be updated.
33+
In CamelCase.
34+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
3035
type: string
3136
metadata:
3237
type: object

kustomize/crds/cluster.clusterpedia.io_pediaclusters.yaml

Lines changed: 42 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.13.0
6+
controller-gen.kubebuilder.io/version: v0.15.0
77
name: pediaclusters.cluster.clusterpedia.io
88
spec:
99
group: cluster.clusterpedia.io
@@ -45,14 +45,19 @@ spec:
4545
openAPIV3Schema:
4646
properties:
4747
apiVersion:
48-
description: 'APIVersion defines the versioned schema of this representation
49-
of an object. Servers should convert recognized schemas to the latest
50-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
48+
description: |-
49+
APIVersion defines the versioned schema of this representation of an object.
50+
Servers should convert recognized schemas to the latest internal value, and
51+
may reject unrecognized values.
52+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
5153
type: string
5254
kind:
53-
description: 'Kind is a string value representing the REST resource this
54-
object represents. Servers may infer this from the endpoint the client
55-
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
55+
description: |-
56+
Kind is a string value representing the REST resource this object represents.
57+
Servers may infer this from the endpoint the client submits requests to.
58+
Cannot be updated.
59+
In CamelCase.
60+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
5661
type: string
5762
metadata:
5863
type: object
@@ -110,42 +115,42 @@ spec:
110115
conditions:
111116
items:
112117
description: "Condition contains details for one aspect of the current
113-
state of this API Resource. --- This struct is intended for direct
114-
use as an array at the field path .status.conditions. For example,
115-
\n type FooStatus struct{ // Represents the observations of a
116-
foo's current state. // Known .status.conditions.type are: \"Available\",
117-
\"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge
118-
// +listType=map // +listMapKey=type Conditions []metav1.Condition
119-
`json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\"
120-
protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
118+
state of this API Resource.\n---\nThis struct is intended for
119+
direct use as an array at the field path .status.conditions. For
120+
example,\n\n\n\ttype FooStatus struct{\n\t // Represents the
121+
observations of a foo's current state.\n\t // Known .status.conditions.type
122+
are: \"Available\", \"Progressing\", and \"Degraded\"\n\t //
123+
+patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t
124+
\ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\"
125+
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t
126+
\ // other fields\n\t}"
121127
properties:
122128
lastTransitionTime:
123-
description: lastTransitionTime is the last time the condition
124-
transitioned from one status to another. This should be when
125-
the underlying condition changed. If that is not known, then
126-
using the time when the API field changed is acceptable.
129+
description: |-
130+
lastTransitionTime is the last time the condition transitioned from one status to another.
131+
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
127132
format: date-time
128133
type: string
129134
message:
130-
description: message is a human readable message indicating
131-
details about the transition. This may be an empty string.
135+
description: |-
136+
message is a human readable message indicating details about the transition.
137+
This may be an empty string.
132138
maxLength: 32768
133139
type: string
134140
observedGeneration:
135-
description: observedGeneration represents the .metadata.generation
136-
that the condition was set based upon. For instance, if .metadata.generation
137-
is currently 12, but the .status.conditions[x].observedGeneration
138-
is 9, the condition is out of date with respect to the current
139-
state of the instance.
141+
description: |-
142+
observedGeneration represents the .metadata.generation that the condition was set based upon.
143+
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
144+
with respect to the current state of the instance.
140145
format: int64
141146
minimum: 0
142147
type: integer
143148
reason:
144-
description: reason contains a programmatic identifier indicating
145-
the reason for the condition's last transition. Producers
146-
of specific condition types may define expected values and
147-
meanings for this field, and whether the values are considered
148-
a guaranteed API. The value should be a CamelCase string.
149+
description: |-
150+
reason contains a programmatic identifier indicating the reason for the condition's last transition.
151+
Producers of specific condition types may define expected values and meanings for this field,
152+
and whether the values are considered a guaranteed API.
153+
The value should be a CamelCase string.
149154
This field may not be empty.
150155
maxLength: 1024
151156
minLength: 1
@@ -159,11 +164,12 @@ spec:
159164
- Unknown
160165
type: string
161166
type:
162-
description: type of condition in CamelCase or in foo.example.com/CamelCase.
163-
--- Many .condition.type values are consistent across resources
164-
like Available, but because arbitrary conditions can be useful
165-
(see .node.status.conditions), the ability to deconflict is
166-
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
167+
description: |-
168+
type of condition in CamelCase or in foo.example.com/CamelCase.
169+
---
170+
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
171+
useful (see .node.status.conditions), the ability to deconflict is important.
172+
The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
167173
maxLength: 316
168174
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
169175
type: string

0 commit comments

Comments
 (0)