Skip to content

Commit ad7f185

Browse files
nrbdamdo
authored andcommitted
Update generation tools for Kube 1.30
We carry a very small patch for the conversion-gen tool so that we can support having types of the same name in both the standard and experimental APIs. During the v1.30 timeframe, the Kubernetes code generation tools were refactored to more modern Go module standards, while also cleaning up the code. This commit carries the v1.30 (specifically, commit 304c1999892b41b6a3ff5dae260253f39cf53660) changes for the main.go and conversion.go files, alongside our patch. This commit also includes the updated conversion code output by our vendored/forked conversion_gen tool. Signed-off-by: Nolan Brubaker <[email protected]>
1 parent b893cb5 commit ad7f185

20 files changed

+248
-209
lines changed

Makefile

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -194,14 +194,15 @@ endif
194194
.PHONY: defaulters
195195
defaulters: $(DEFAULTER_GEN) ## Generate all Go types
196196
$(DEFAULTER_GEN) \
197-
--input-dirs=./api/v1beta2 \
198-
--input-dirs=./$(EXP_DIR)/api/v1beta2 \
199-
--input-dirs=./controlplane/rosa/api/v1beta2 \
200-
--input-dirs=./cmd/clusterawsadm/api/bootstrap/v1beta1 \
201-
--input-dirs=./cmd/clusterawsadm/api/bootstrap/v1alpha1 \
202197
--extra-peer-dirs=sigs.k8s.io/cluster-api/api/v1beta1 \
203-
--v=0 $(GEN_OUTPUT_BASE) \
204-
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt
198+
--v=0 \
199+
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt \
200+
--output-file=zz_generated.defaults.go \
201+
./api/v1beta2 \
202+
./$(EXP_DIR)/api/v1beta2 \
203+
./controlplane/rosa/api/v1beta2 \
204+
./cmd/clusterawsadm/api/bootstrap/v1beta1 \
205+
./cmd/clusterawsadm/api/bootstrap/v1alpha1
205206

206207
.PHONY: generate
207208
generate: ## Generate code
@@ -251,44 +252,39 @@ generate-go-apis: ## Alias for .build/generate-go-apis
251252
$(MAKE) defaulters
252253

253254
$(CONVERSION_GEN) \
254-
--input-dirs=./api/v1beta1 \
255-
--input-dirs=./cmd/clusterawsadm/api/bootstrap/v1alpha1 \
256255
--extra-peer-dirs=sigs.k8s.io/cluster-api/api/v1beta1 \
257-
--build-tag=ignore_autogenerated_conversions \
258-
--output-file-base=zz_generated.conversion $(GEN_OUTPUT_BASE) \
259-
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt
256+
--output-file=zz_generated.conversion.go \
257+
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt \
258+
./api/v1beta1 \
259+
./cmd/clusterawsadm/api/bootstrap/v1alpha1
260260

261261
$(CONVERSION_GEN) \
262-
--input-dirs=./$(EXP_DIR)/api/v1beta1 \
263262
--extra-peer-dirs=sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta1 \
264263
--extra-peer-dirs=sigs.k8s.io/cluster-api/api/v1beta1 \
265-
--build-tag=ignore_autogenerated_conversions \
266-
--output-file-base=zz_generated.conversion $(GEN_OUTPUT_BASE) \
267-
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt
264+
--output-file=zz_generated.conversion.go \
265+
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt \
266+
./$(EXP_DIR)/api/v1beta1
268267

269268
$(CONVERSION_GEN) \
270-
--input-dirs=./bootstrap/eks/api/v1beta1 \
271269
--extra-peer-dirs=sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta1 \
272270
--extra-peer-dirs=sigs.k8s.io/cluster-api/api/v1beta1 \
273-
--build-tag=ignore_autogenerated_conversions \
274-
--output-file-base=zz_generated.conversion $(GEN_OUTPUT_BASE) \
275-
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt
271+
--output-file=zz_generated.conversion.go \
272+
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt \
273+
./bootstrap/eks/api/v1beta1
276274

277275
$(CONVERSION_GEN) \
278-
--input-dirs=./controlplane/eks/api/v1beta1 \
279276
--extra-peer-dirs=sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta1 \
280277
--extra-peer-dirs=sigs.k8s.io/cluster-api/api/v1beta1 \
281-
--build-tag=ignore_autogenerated_conversions \
282-
--output-file-base=zz_generated.conversion $(GEN_OUTPUT_BASE) \
283-
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt
278+
--output-file=zz_generated.conversion.go \
279+
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt \
280+
./controlplane/eks/api/v1beta1
284281

285282
$(CONVERSION_GEN) \
286-
--input-dirs=./controlplane/rosa/api/v1beta2 \
287283
--extra-peer-dirs=sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta1 \
288284
--extra-peer-dirs=sigs.k8s.io/cluster-api/api/v1beta1 \
289-
--build-tag=ignore_autogenerated_conversions \
290-
--output-file-base=zz_generated.conversion $(GEN_OUTPUT_BASE) \
291-
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt
285+
--output-file=zz_generated.conversion.go \
286+
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt \
287+
./controlplane/rosa/api/v1beta2
292288

293289
touch $@
294290

api/v1beta1/zz_generated.conversion.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bootstrap/eks/api/v1beta1/zz_generated.conversion.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bootstrap/eks/api/v1beta1/zz_generated.deepcopy.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bootstrap/eks/api/v1beta2/doc.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ limitations under the License.
1717
// Package v1beta2 contains API Schema definitions for the Amazon EKS Bootstrap v1beta2 API group.
1818
// +gencrdrefdocs:force //nolint: revive
1919
// +groupName=bootstrap.cluster.x-k8s.io
20+
// +k8s:conversion-gen=sigs.k8s.io/cluster-api-provider-aws/v2/bootstrap/eks/api/v1beta1
2021
package v1beta2

cmd/clusterawsadm/api/bootstrap/v1alpha1/zz_generated.conversion.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/controlplane.cluster.x-k8s.io_awsmanagedcontrolplanes.yaml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -959,10 +959,15 @@ spec:
959959
description: The key to select.
960960
type: string
961961
name:
962+
default: ""
962963
description: |-
963964
Name of the referent.
964-
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
965+
This field is effectively required, but due to backwards compatibility is
966+
allowed to be empty. Instances of this type with an empty value here are
967+
almost certainly wrong.
965968
TODO: Add other useful fields. apiVersion, kind, uid?
969+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
970+
TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
966971
type: string
967972
optional:
968973
description: Specify whether the ConfigMap or its
@@ -1022,10 +1027,15 @@ spec:
10221027
be a valid secret key.
10231028
type: string
10241029
name:
1030+
default: ""
10251031
description: |-
10261032
Name of the referent.
1027-
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
1033+
This field is effectively required, but due to backwards compatibility is
1034+
allowed to be empty. Instances of this type with an empty value here are
1035+
almost certainly wrong.
10281036
TODO: Add other useful fields. apiVersion, kind, uid?
1037+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
1038+
TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
10291039
type: string
10301040
optional:
10311041
description: Specify whether the Secret or its key
@@ -3010,10 +3020,15 @@ spec:
30103020
description: The key to select.
30113021
type: string
30123022
name:
3023+
default: ""
30133024
description: |-
30143025
Name of the referent.
3015-
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
3026+
This field is effectively required, but due to backwards compatibility is
3027+
allowed to be empty. Instances of this type with an empty value here are
3028+
almost certainly wrong.
30163029
TODO: Add other useful fields. apiVersion, kind, uid?
3030+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
3031+
TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
30173032
type: string
30183033
optional:
30193034
description: Specify whether the ConfigMap or its
@@ -3073,10 +3088,15 @@ spec:
30733088
be a valid secret key.
30743089
type: string
30753090
name:
3091+
default: ""
30763092
description: |-
30773093
Name of the referent.
3078-
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
3094+
This field is effectively required, but due to backwards compatibility is
3095+
allowed to be empty. Instances of this type with an empty value here are
3096+
almost certainly wrong.
30793097
TODO: Add other useful fields. apiVersion, kind, uid?
3098+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
3099+
TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
30803100
type: string
30813101
optional:
30823102
description: Specify whether the Secret or its key

config/crd/bases/controlplane.cluster.x-k8s.io_rosacontrolplanes.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,15 @@ spec:
105105
- ocmApiUrl: Optional, defaults to 'https://api.openshift.com'
106106
properties:
107107
name:
108+
default: ""
108109
description: |-
109110
Name of the referent.
110-
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
111+
This field is effectively required, but due to backwards compatibility is
112+
allowed to be empty. Instances of this type with an empty value here are
113+
almost certainly wrong.
111114
TODO: Add other useful fields. apiVersion, kind, uid?
115+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
116+
TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
112117
type: string
113118
type: object
114119
x-kubernetes-map-type: atomic

config/crd/bases/infrastructure.cluster.x-k8s.io_awsclustercontrolleridentities.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,13 @@ spec:
9292
items:
9393
type: string
9494
type: array
95+
x-kubernetes-list-type: atomic
9596
required:
9697
- key
9798
- operator
9899
type: object
99100
type: array
101+
x-kubernetes-list-type: atomic
100102
matchLabels:
101103
additionalProperties:
102104
type: string
@@ -186,11 +188,13 @@ spec:
186188
items:
187189
type: string
188190
type: array
191+
x-kubernetes-list-type: atomic
189192
required:
190193
- key
191194
- operator
192195
type: object
193196
type: array
197+
x-kubernetes-list-type: atomic
194198
matchLabels:
195199
additionalProperties:
196200
type: string

0 commit comments

Comments
 (0)