Skip to content

Commit 29258d3

Browse files
ABNER-1furykerry
authored andcommitted
fix controller-gen gen crd bugs
Signed-off-by: Abner-1 <[email protected]>
1 parent 6d2f3f5 commit 29258d3

19 files changed

+99
-70
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and
3636
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./apis/..."
3737

3838
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
39-
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./pkg/..." output:crd:artifacts:config=config/crd/bases
39+
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./apis/..." output:crd:artifacts:config=config/crd/bases
4040

4141
fmt: go_check ## Run go fmt against code.
4242
go fmt $(shell go list ./... | grep -v /vendor/)

config/crd/bases/apps.kruise.io_advancedcronjobs.yaml

+3-20
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.14.0
6+
controller-gen.kubebuilder.io/version: v0.16.5
77
name: advancedcronjobs.apps.kruise.io
88
spec:
99
group: apps.kruise.io
@@ -202,24 +202,8 @@ spec:
202202
active:
203203
description: A list of pointers to currently running jobs.
204204
items:
205-
description: |-
206-
ObjectReference contains enough information to let you inspect or modify the referred object.
207-
---
208-
New uses of this type are discouraged because of difficulty describing its usage when embedded in APIs.
209-
1. Ignored fields. It includes many fields which are not generally honored. For instance, ResourceVersion and FieldPath are both very rarely valid in actual usage.
210-
2. Invalid usage help. It is impossible to add specific help for individual usage. In most embedded usages, there are particular
211-
restrictions like, "must refer only to types A and B" or "UID not honored" or "name must be restricted".
212-
Those cannot be well described when embedded.
213-
3. Inconsistent validation. Because the usages are different, the validation rules are different by usage, which makes it hard for users to predict what will happen.
214-
4. The fields are both imprecise and overly precise. Kind is not a precise mapping to a URL. This can produce ambiguity
215-
during interpretation and require a REST mapping. In most cases, the dependency is on the group,resource tuple
216-
and the version of the actual struct is irrelevant.
217-
5. We cannot easily change it. Because this type is embedded in many locations, updates to this type
218-
will affect numerous schemas. Don't make new APIs embed an underspecified API type they do not control.
219-
220-
221-
Instead of using this type, create a locally provided and used type that is well-focused on your reference.
222-
For example, ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533 .
205+
description: ObjectReference contains enough information to let
206+
you inspect or modify the referred object.
223207
properties:
224208
apiVersion:
225209
description: API version of the referent.
@@ -233,7 +217,6 @@ spec:
233217
the event) or if no container name is specified "spec.containers[2]" (container with
234218
index 2 in this pod). This syntax is chosen only to have some well-defined way of
235219
referencing a part of an object.
236-
TODO: this design is not final and this field is subject to change in the future.
237220
type: string
238221
kind:
239222
description: |-

config/crd/bases/apps.kruise.io_broadcastjobs.yaml

+1-1
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.14.0
6+
controller-gen.kubebuilder.io/version: v0.16.5
77
name: broadcastjobs.apps.kruise.io
88
spec:
99
group: apps.kruise.io

config/crd/bases/apps.kruise.io_clonesets.yaml

+5-1
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.14.0
6+
controller-gen.kubebuilder.io/version: v0.16.5
77
name: clonesets.apps.kruise.io
88
spec:
99
group: apps.kruise.io
@@ -238,11 +238,13 @@ spec:
238238
items:
239239
type: string
240240
type: array
241+
x-kubernetes-list-type: atomic
241242
required:
242243
- key
243244
- operator
244245
type: object
245246
type: array
247+
x-kubernetes-list-type: atomic
246248
matchLabels:
247249
additionalProperties:
248250
type: string
@@ -375,11 +377,13 @@ spec:
375377
items:
376378
type: string
377379
type: array
380+
x-kubernetes-list-type: atomic
378381
required:
379382
- key
380383
- operator
381384
type: object
382385
type: array
386+
x-kubernetes-list-type: atomic
383387
matchLabels:
384388
additionalProperties:
385389
type: string

config/crd/bases/apps.kruise.io_containerrecreaterequests.yaml

+3-2
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.14.0
6+
controller-gen.kubebuilder.io/version: v0.16.5
77
name: containerrecreaterequests.apps.kruise.io
88
spec:
99
group: apps.kruise.io
@@ -143,6 +143,7 @@ spec:
143143
items:
144144
type: string
145145
type: array
146+
x-kubernetes-list-type: atomic
146147
type: object
147148
httpGet:
148149
description: HTTPGet specifies the http request to perform.
@@ -172,6 +173,7 @@ spec:
172173
- value
173174
type: object
174175
type: array
176+
x-kubernetes-list-type: atomic
175177
path:
176178
description: Path to access on the HTTP server.
177179
type: string
@@ -196,7 +198,6 @@ spec:
196198
description: |-
197199
TCPSocket specifies an action involving a TCP port.
198200
TCP hooks not yet supported
199-
TODO: implement a realistic TCP lifecycle hook
200201
properties:
201202
host:
202203
description: 'Optional: Host name to connect to, defaults

config/crd/bases/apps.kruise.io_daemonsets.yaml

+5-1
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.14.0
6+
controller-gen.kubebuilder.io/version: v0.16.5
77
name: daemonsets.apps.kruise.io
88
spec:
99
group: apps.kruise.io
@@ -204,11 +204,13 @@ spec:
204204
items:
205205
type: string
206206
type: array
207+
x-kubernetes-list-type: atomic
207208
required:
208209
- key
209210
- operator
210211
type: object
211212
type: array
213+
x-kubernetes-list-type: atomic
212214
matchLabels:
213215
additionalProperties:
214216
type: string
@@ -327,11 +329,13 @@ spec:
327329
items:
328330
type: string
329331
type: array
332+
x-kubernetes-list-type: atomic
330333
required:
331334
- key
332335
- operator
333336
type: object
334337
type: array
338+
x-kubernetes-list-type: atomic
335339
matchLabels:
336340
additionalProperties:
337341
type: string

config/crd/bases/apps.kruise.io_ephemeraljobs.yaml

+3-1
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.14.0
6+
controller-gen.kubebuilder.io/version: v0.16.5
77
name: ephemeraljobs.apps.kruise.io
88
spec:
99
group: apps.kruise.io
@@ -127,11 +127,13 @@ spec:
127127
items:
128128
type: string
129129
type: array
130+
x-kubernetes-list-type: atomic
130131
required:
131132
- key
132133
- operator
133134
type: object
134135
type: array
136+
x-kubernetes-list-type: atomic
135137
matchLabels:
136138
additionalProperties:
137139
type: string

config/crd/bases/apps.kruise.io_imagelistpulljobs.yaml

+5-1
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.14.0
6+
controller-gen.kubebuilder.io/version: v0.16.5
77
name: imagelistpulljobs.apps.kruise.io
88
spec:
99
group: apps.kruise.io
@@ -140,11 +140,13 @@ spec:
140140
items:
141141
type: string
142142
type: array
143+
x-kubernetes-list-type: atomic
143144
required:
144145
- key
145146
- operator
146147
type: object
147148
type: array
149+
x-kubernetes-list-type: atomic
148150
matchLabels:
149151
additionalProperties:
150152
type: string
@@ -225,11 +227,13 @@ spec:
225227
items:
226228
type: string
227229
type: array
230+
x-kubernetes-list-type: atomic
228231
required:
229232
- key
230233
- operator
231234
type: object
232235
type: array
236+
x-kubernetes-list-type: atomic
233237
matchLabels:
234238
additionalProperties:
235239
type: string

config/crd/bases/apps.kruise.io_imagepulljobs.yaml

+5-1
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.14.0
6+
controller-gen.kubebuilder.io/version: v0.16.5
77
name: imagepulljobs.apps.kruise.io
88
spec:
99
group: apps.kruise.io
@@ -146,11 +146,13 @@ spec:
146146
items:
147147
type: string
148148
type: array
149+
x-kubernetes-list-type: atomic
149150
required:
150151
- key
151152
- operator
152153
type: object
153154
type: array
155+
x-kubernetes-list-type: atomic
154156
matchLabels:
155157
additionalProperties:
156158
type: string
@@ -231,11 +233,13 @@ spec:
231233
items:
232234
type: string
233235
type: array
236+
x-kubernetes-list-type: atomic
234237
required:
235238
- key
236239
- operator
237240
type: object
238241
type: array
242+
x-kubernetes-list-type: atomic
239243
matchLabels:
240244
additionalProperties:
241245
type: string

config/crd/bases/apps.kruise.io_nodeimages.yaml

+3-21
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.14.0
6+
controller-gen.kubebuilder.io/version: v0.16.5
77
name: nodeimages.apps.kruise.io
88
spec:
99
group: apps.kruise.io
@@ -116,24 +116,8 @@ spec:
116116
List of objects depended by this object. If this image is managed by a controller,
117117
then an entry in this list will point to this controller.
118118
items:
119-
description: |-
120-
ObjectReference contains enough information to let you inspect or modify the referred object.
121-
---
122-
New uses of this type are discouraged because of difficulty describing its usage when embedded in APIs.
123-
1. Ignored fields. It includes many fields which are not generally honored. For instance, ResourceVersion and FieldPath are both very rarely valid in actual usage.
124-
2. Invalid usage help. It is impossible to add specific help for individual usage. In most embedded usages, there are particular
125-
restrictions like, "must refer only to types A and B" or "UID not honored" or "name must be restricted".
126-
Those cannot be well described when embedded.
127-
3. Inconsistent validation. Because the usages are different, the validation rules are different by usage, which makes it hard for users to predict what will happen.
128-
4. The fields are both imprecise and overly precise. Kind is not a precise mapping to a URL. This can produce ambiguity
129-
during interpretation and require a REST mapping. In most cases, the dependency is on the group,resource tuple
130-
and the version of the actual struct is irrelevant.
131-
5. We cannot easily change it. Because this type is embedded in many locations, updates to this type
132-
will affect numerous schemas. Don't make new APIs embed an underspecified API type they do not control.
133-
134-
135-
Instead of using this type, create a locally provided and used type that is well-focused on your reference.
136-
For example, ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533 .
119+
description: ObjectReference contains enough information
120+
to let you inspect or modify the referred object.
137121
properties:
138122
apiVersion:
139123
description: API version of the referent.
@@ -147,7 +131,6 @@ spec:
147131
the event) or if no container name is specified "spec.containers[2]" (container with
148132
index 2 in this pod). This syntax is chosen only to have some well-defined way of
149133
referencing a part of an object.
150-
TODO: this design is not final and this field is subject to change in the future.
151134
type: string
152135
kind:
153136
description: |-
@@ -220,7 +203,6 @@ spec:
220203
concurrency, change detection, and the watch operation on a resource or set of resources.
221204
Clients must treat these values as opaque and passed unmodified back to the server.
222205
223-
224206
Populated by the system.
225207
Read-only.
226208
Value must be treated as opaque by clients and .

config/crd/bases/apps.kruise.io_nodepodprobes.yaml

+4-2
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.14.0
6+
controller-gen.kubebuilder.io/version: v0.16.5
77
name: nodepodprobes.apps.kruise.io
88
spec:
99
group: apps.kruise.io
@@ -78,6 +78,7 @@ spec:
7878
items:
7979
type: string
8080
type: array
81+
x-kubernetes-list-type: atomic
8182
type: object
8283
failureThreshold:
8384
description: |-
@@ -95,11 +96,11 @@ spec:
9596
format: int32
9697
type: integer
9798
service:
99+
default: ""
98100
description: |-
99101
Service is the name of the service to place in the gRPC HealthCheckRequest
100102
(see https://github.com/grpc/grpc/blob/master/doc/health-checking.md).
101103
102-
103104
If this is not specified, the default behavior is defined by gRPC.
104105
type: string
105106
required:
@@ -134,6 +135,7 @@ spec:
134135
- value
135136
type: object
136137
type: array
138+
x-kubernetes-list-type: atomic
137139
path:
138140
description: Path to access on the HTTP server.
139141
type: string

config/crd/bases/apps.kruise.io_persistentpodstates.yaml

+1-1
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.14.0
6+
controller-gen.kubebuilder.io/version: v0.16.5
77
name: persistentpodstates.apps.kruise.io
88
spec:
99
group: apps.kruise.io

0 commit comments

Comments
 (0)