Skip to content

Commit d33c29e

Browse files
damdonrb
authored andcommitted
🌱 Bump CAPI to v1.8.4 (kubernetes-sigs#5061)
* capi v1.8.0-beta.0 * use source.Kind generics * update e2e testing versions * set terminationMessagePolicy to FallbackToLogsOnError for manager * bump go version to 1.22 * Update metrics options for new types Signed-off-by: Nolan Brubaker <nolan@nbrubaker.com> * Update to CAPI 1.8.3 Signed-off-by: Nolan Brubaker <nolan@nbrubaker.com> * Fix test linting Signed-off-by: Nolan Brubaker <nolan@nbrubaker.com> * Use latest versions of setup-envtest Signed-off-by: Nolan Brubaker <nolan@nbrubaker.com> * 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 <nolan@nbrubaker.com> * Update to CAPI 1.8.4 --------- Signed-off-by: Nolan Brubaker <nolan@nbrubaker.com> Co-authored-by: Nolan Brubaker <nolan@nbrubaker.com>
1 parent b398f11 commit d33c29e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+571
-529
lines changed

Makefile

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ E2E_SKIP_EKS_UPGRADE ?= "false"
148148
EKS_SOURCE_TEMPLATE ?= eks/cluster-template-eks-control-plane-only.yaml
149149

150150
# set up `setup-envtest` to install kubebuilder dependency
151-
export KUBEBUILDER_ENVTEST_KUBERNETES_VERSION ?= 1.28.3
152-
SETUP_ENVTEST_VER := v0.0.0-20240531134648-6636df17d67b
151+
export KUBEBUILDER_ENVTEST_KUBERNETES_VERSION ?= 1.30.2
152+
SETUP_ENVTEST_VER := v0.0.0-20240923090159-236e448db12c
153153
SETUP_ENVTEST_BIN := setup-envtest
154154
SETUP_ENVTEST := $(abspath $(TOOLS_BIN_DIR)/$(SETUP_ENVTEST_BIN)-$(SETUP_ENVTEST_VER))
155155
SETUP_ENVTEST_PKG := sigs.k8s.io/controller-runtime/tools/setup-envtest
@@ -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

bootstrap/eks/controllers/eksconfig_controller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,9 @@ func (r *EKSConfigReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Man
313313
}
314314

315315
err = c.Watch(
316-
source.Kind(mgr.GetCache(), &clusterv1.Cluster{}),
317-
handler.EnqueueRequestsFromMapFunc((r.ClusterToEKSConfigs)),
318-
predicates.ClusterUnpausedAndInfrastructureReady(logger.FromContext(ctx).GetLogger()),
316+
source.Kind[client.Object](mgr.GetCache(), &clusterv1.Cluster{},
317+
handler.EnqueueRequestsFromMapFunc((r.ClusterToEKSConfigs)),
318+
predicates.ClusterUnpausedAndInfrastructureReady(logger.FromContext(ctx).GetLogger())),
319319
)
320320
if err != nil {
321321
return errors.Wrap(err, "failed adding watch for Clusters to controller manager")

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
@@ -174,10 +174,15 @@ spec:
174174
- ocmApiUrl: Optional, defaults to 'https://api.openshift.com'
175175
properties:
176176
name:
177+
default: ""
177178
description: |-
178179
Name of the referent.
179-
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
180+
This field is effectively required, but due to backwards compatibility is
181+
allowed to be empty. Instances of this type with an empty value here are
182+
almost certainly wrong.
180183
TODO: Add other useful fields. apiVersion, kind, uid?
184+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
185+
TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
181186
type: string
182187
type: object
183188
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

config/crd/bases/infrastructure.cluster.x-k8s.io_awsclusterroleidentities.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
@@ -245,11 +247,13 @@ spec:
245247
items:
246248
type: string
247249
type: array
250+
x-kubernetes-list-type: atomic
248251
required:
249252
- key
250253
- operator
251254
type: object
252255
type: array
256+
x-kubernetes-list-type: atomic
253257
matchLabels:
254258
additionalProperties:
255259
type: string

config/crd/bases/infrastructure.cluster.x-k8s.io_awsclusterstaticidentities.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
@@ -196,11 +198,13 @@ spec:
196198
items:
197199
type: string
198200
type: array
201+
x-kubernetes-list-type: atomic
199202
required:
200203
- key
201204
- operator
202205
type: object
203206
type: array
207+
x-kubernetes-list-type: atomic
204208
matchLabels:
205209
additionalProperties:
206210
type: string

config/manager/manager.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ spec:
4848
- ALL
4949
runAsUser: 65532
5050
runAsGroup: 65532
51+
terminationMessagePolicy: FallbackToLogsOnError
5152
securityContext:
5253
runAsNonRoot: true
5354
seccompProfile:

controllers/awscluster_controller.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -413,10 +413,10 @@ func (r *AWSClusterReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Ma
413413
}
414414

415415
return controller.Watch(
416-
source.Kind(mgr.GetCache(), &clusterv1.Cluster{}),
417-
handler.EnqueueRequestsFromMapFunc(r.requeueAWSClusterForUnpausedCluster(ctx, log)),
418-
predicates.ClusterUnpaused(log.GetLogger()),
419-
)
416+
source.Kind[client.Object](mgr.GetCache(), &clusterv1.Cluster{},
417+
handler.EnqueueRequestsFromMapFunc(r.requeueAWSClusterForUnpausedCluster(ctx, log)),
418+
predicates.ClusterUnpaused(log.GetLogger()),
419+
))
420420
}
421421

422422
func (r *AWSClusterReconciler) requeueAWSClusterForUnpausedCluster(_ context.Context, log logger.Wrapper) handler.MapFunc {

controllers/awsmachine_controller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,9 @@ func (r *AWSMachineReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Ma
292292

293293
requeueAWSMachinesForUnpausedCluster := r.requeueAWSMachinesForUnpausedCluster(log)
294294
return controller.Watch(
295-
source.Kind(mgr.GetCache(), &clusterv1.Cluster{}),
296-
handler.EnqueueRequestsFromMapFunc(requeueAWSMachinesForUnpausedCluster),
297-
predicates.ClusterUnpausedAndInfrastructureReady(log.GetLogger()),
295+
source.Kind[client.Object](mgr.GetCache(), &clusterv1.Cluster{},
296+
handler.EnqueueRequestsFromMapFunc(requeueAWSMachinesForUnpausedCluster),
297+
predicates.ClusterUnpausedAndInfrastructureReady(log.GetLogger())),
298298
)
299299
}
300300

controllers/awsmanagedcluster_controller.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,17 +134,17 @@ func (r *AWSManagedClusterReconciler) SetupWithManager(ctx context.Context, mgr
134134

135135
// Add a watch for clusterv1.Cluster unpaise
136136
if err = controller.Watch(
137-
source.Kind(mgr.GetCache(), &clusterv1.Cluster{}),
138-
handler.EnqueueRequestsFromMapFunc(util.ClusterToInfrastructureMapFunc(ctx, infrav1.GroupVersion.WithKind("AWSManagedCluster"), mgr.GetClient(), &infrav1.AWSManagedCluster{})),
139-
predicates.ClusterUnpaused(log.GetLogger()),
137+
source.Kind[client.Object](mgr.GetCache(), &clusterv1.Cluster{},
138+
handler.EnqueueRequestsFromMapFunc(util.ClusterToInfrastructureMapFunc(ctx, infrav1.GroupVersion.WithKind("AWSManagedCluster"), mgr.GetClient(), &infrav1.AWSManagedCluster{})),
139+
predicates.ClusterUnpaused(log.GetLogger())),
140140
); err != nil {
141141
return fmt.Errorf("failed adding a watch for ready clusters: %w", err)
142142
}
143143

144144
// Add a watch for AWSManagedControlPlane
145145
if err = controller.Watch(
146-
source.Kind(mgr.GetCache(), &ekscontrolplanev1.AWSManagedControlPlane{}),
147-
handler.EnqueueRequestsFromMapFunc(r.managedControlPlaneToManagedCluster(ctx, log)),
146+
source.Kind[client.Object](mgr.GetCache(), &ekscontrolplanev1.AWSManagedControlPlane{},
147+
handler.EnqueueRequestsFromMapFunc(r.managedControlPlaneToManagedCluster(ctx, log))),
148148
); err != nil {
149149
return fmt.Errorf("failed adding watch on AWSManagedControlPlane: %w", err)
150150
}

0 commit comments

Comments
 (0)