Skip to content

Commit a1918aa

Browse files
authored
✨ Bump CAPI to v1.6.x (#4739)
* use k8s.io/utils/ptr instead of pointer * reference local copy of noderefutil following the deprecation of noderefutil, the package has now been removed from cluster-api * bump deps for capi v1.6.1, fix changes * e2e: fix pointer panic in RefreshVPCState * fix: remove unnecessary fmt * wip: set patch version Go 1.21.5 for netlify * wip: add debugging on VPC creation failure
1 parent 370a1f0 commit a1918aa

File tree

99 files changed

+885
-774
lines changed

Some content is hidden

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

99 files changed

+885
-774
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ E2E_SKIP_EKS_UPGRADE ?= "false"
142142
EKS_SOURCE_TEMPLATE ?= eks/cluster-template-eks-control-plane-only.yaml
143143

144144
# set up `setup-envtest` to install kubebuilder dependency
145-
export KUBEBUILDER_ENVTEST_KUBERNETES_VERSION ?= 1.24.2
145+
export KUBEBUILDER_ENVTEST_KUBERNETES_VERSION ?= 1.28.3
146146
SETUP_ENVTEST_VER := v0.0.0-20230131074648-f5014c077fc3
147147
SETUP_ENVTEST_BIN := setup-envtest
148148
SETUP_ENVTEST := $(abspath $(TOOLS_BIN_DIR)/$(SETUP_ENVTEST_BIN)-$(SETUP_ENVTEST_VER))
@@ -219,6 +219,7 @@ generate-go-apis: ## Alias for .build/generate-go-apis
219219

220220
.build/generate-go-apis: .build $(API_FILES) $(CONTROLLER_GEN) $(DEFAULTER_GEN) $(CONVERSION_GEN) ## Generate all Go api files
221221
$(CONTROLLER_GEN) \
222+
paths=./ \
222223
paths=./api/... \
223224
paths=./$(EXP_DIR)/api/... \
224225
paths=./bootstrap/eks/api/... \

api/v1beta1/zz_generated.deepcopy.go

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

api/v1beta2/awsmachine_webhook_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"github.com/aws/aws-sdk-go/aws"
2525
. "github.com/onsi/gomega"
2626
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
27-
"k8s.io/utils/pointer"
27+
"k8s.io/utils/ptr"
2828

2929
utildefaulting "sigs.k8s.io/cluster-api/util/defaulting"
3030
)
@@ -284,14 +284,14 @@ func TestAWSMachineUpdate(t *testing.T) {
284284
},
285285
newMachine: &AWSMachine{
286286
Spec: AWSMachineSpec{
287-
ProviderID: pointer.String("ID"),
287+
ProviderID: ptr.To[string]("ID"),
288288
InstanceType: "test",
289289
AdditionalTags: Tags{
290290
"key-1": "value-1",
291291
},
292292
AdditionalSecurityGroups: []AWSResourceReference{
293293
{
294-
ID: pointer.String("ID"),
294+
ID: ptr.To[string]("ID"),
295295
},
296296
},
297297
CloudInit: CloudInit{
@@ -316,13 +316,13 @@ func TestAWSMachineUpdate(t *testing.T) {
316316
Spec: AWSMachineSpec{
317317
ImageLookupOrg: "test",
318318
InstanceType: "test",
319-
ProviderID: pointer.String("ID"),
319+
ProviderID: ptr.To[string]("ID"),
320320
AdditionalTags: Tags{
321321
"key-1": "value-1",
322322
},
323323
AdditionalSecurityGroups: []AWSResourceReference{
324324
{
325-
ID: pointer.String("ID"),
325+
ID: ptr.To[string]("ID"),
326326
},
327327
},
328328
},

api/v1beta2/awsmachinetemplate_webhook_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222

2323
"github.com/aws/aws-sdk-go/aws"
2424
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
25-
"k8s.io/utils/pointer"
25+
"k8s.io/utils/ptr"
2626
)
2727

2828
func TestAWSMachineTemplateValidateCreate(t *testing.T) {
@@ -38,7 +38,7 @@ func TestAWSMachineTemplateValidateCreate(t *testing.T) {
3838
Spec: AWSMachineTemplateSpec{
3939
Template: AWSMachineTemplateResource{
4040
Spec: AWSMachineSpec{
41-
ProviderID: pointer.String("something"),
41+
ProviderID: ptr.To[string]("something"),
4242
},
4343
},
4444
},

api/v1beta2/zz_generated.deepcopy.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: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

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

bootstrap/eks/controllers/eksconfig_controller.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
"k8s.io/apimachinery/pkg/runtime"
2929
"k8s.io/apimachinery/pkg/types"
3030
"k8s.io/klog/v2"
31-
"k8s.io/utils/pointer"
31+
"k8s.io/utils/ptr"
3232
ctrl "sigs.k8s.io/controller-runtime"
3333
"sigs.k8s.io/controller-runtime/pkg/client"
3434
"sigs.k8s.io/controller-runtime/pkg/controller"
@@ -261,14 +261,14 @@ func (r *EKSConfigReconciler) joinWorker(ctx context.Context, cluster *clusterv1
261261
// If not, we also check if the cluster is ipv6 based.
262262
if config.Spec.ServiceIPV6Cidr != nil && *config.Spec.ServiceIPV6Cidr != "" {
263263
nodeInput.ServiceIPV6Cidr = config.Spec.ServiceIPV6Cidr
264-
nodeInput.IPFamily = pointer.String("ipv6")
264+
nodeInput.IPFamily = ptr.To[string]("ipv6")
265265
}
266266

267267
// we don't want to override any manually set configuration options.
268268
if config.Spec.ServiceIPV6Cidr == nil && controlPlane.Spec.NetworkSpec.VPC.IsIPv6Enabled() {
269269
log.Info("Adding ipv6 data to userdata....")
270-
nodeInput.ServiceIPV6Cidr = pointer.String(controlPlane.Spec.NetworkSpec.VPC.IPv6.CidrBlock)
271-
nodeInput.IPFamily = pointer.String("ipv6")
270+
nodeInput.ServiceIPV6Cidr = ptr.To[string](controlPlane.Spec.NetworkSpec.VPC.IPv6.CidrBlock)
271+
nodeInput.IPFamily = ptr.To[string]("ipv6")
272272
}
273273

274274
// generate userdata
@@ -355,7 +355,7 @@ func (r *EKSConfigReconciler) storeBootstrapData(ctx context.Context, cluster *c
355355
}
356356
}
357357

358-
config.Status.DataSecretName = pointer.String(secret.Name)
358+
config.Status.DataSecretName = ptr.To[string](secret.Name)
359359
config.Status.Ready = true
360360
conditions.MarkTrue(config, eksbootstrapv1.DataSecretAvailableCondition)
361361
return nil
@@ -443,7 +443,7 @@ func (r *EKSConfigReconciler) createBootstrapSecret(ctx context.Context, cluster
443443
Kind: "EKSConfig",
444444
Name: config.Name,
445445
UID: config.UID,
446-
Controller: pointer.Bool(true),
446+
Controller: ptr.To[bool](true),
447447
},
448448
},
449449
},

bootstrap/eks/internal/userdata/node_test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"github.com/aws/aws-sdk-go/aws"
2323
. "github.com/onsi/gomega"
2424
"github.com/onsi/gomega/format"
25-
"k8s.io/utils/pointer"
25+
"k8s.io/utils/ptr"
2626

2727
eksbootstrapv1 "sigs.k8s.io/cluster-api-provider-aws/v2/bootstrap/eks/api/v1beta2"
2828
)
@@ -77,7 +77,7 @@ runcmd:
7777
args: args{
7878
input: &NodeInput{
7979
ClusterName: "test-cluster",
80-
ContainerRuntime: pointer.String("containerd"),
80+
ContainerRuntime: ptr.To[string]("containerd"),
8181
},
8282
},
8383
expectedBytes: []byte(`#cloud-config
@@ -95,7 +95,7 @@ runcmd:
9595
"node-labels": "node-role.undistro.io/infra=true",
9696
"register-with-taints": "dedicated=infra:NoSchedule",
9797
},
98-
ContainerRuntime: pointer.String("containerd"),
98+
ContainerRuntime: ptr.To[string]("containerd"),
9999
},
100100
},
101101
expectedBytes: []byte(`#cloud-config
@@ -109,8 +109,8 @@ runcmd:
109109
args: args{
110110
input: &NodeInput{
111111
ClusterName: "test-cluster",
112-
ServiceIPV6Cidr: pointer.String("fe80:0000:0000:0000:0204:61ff:fe9d:f156/24"),
113-
IPFamily: pointer.String("ipv6"),
112+
ServiceIPV6Cidr: ptr.To[string]("fe80:0000:0000:0000:0204:61ff:fe9d:f156/24"),
113+
IPFamily: ptr.To[string]("ipv6"),
114114
},
115115
},
116116
expectedBytes: []byte(`#cloud-config
@@ -124,7 +124,7 @@ runcmd:
124124
args: args{
125125
input: &NodeInput{
126126
ClusterName: "test-cluster",
127-
UseMaxPods: pointer.Bool(false),
127+
UseMaxPods: ptr.To[bool](false),
128128
},
129129
},
130130
expectedBytes: []byte(`#cloud-config
@@ -138,7 +138,7 @@ runcmd:
138138
args: args{
139139
input: &NodeInput{
140140
ClusterName: "test-cluster",
141-
APIRetryAttempts: pointer.Int(5),
141+
APIRetryAttempts: ptr.To[int](5),
142142
},
143143
},
144144
expectedBytes: []byte(`#cloud-config
@@ -152,8 +152,8 @@ runcmd:
152152
args: args{
153153
input: &NodeInput{
154154
ClusterName: "test-cluster",
155-
PauseContainerAccount: pointer.String("12345678"),
156-
PauseContainerVersion: pointer.String("v1"),
155+
PauseContainerAccount: ptr.To[string]("12345678"),
156+
PauseContainerVersion: ptr.To[string]("v1"),
157157
},
158158
},
159159
expectedBytes: []byte(`#cloud-config
@@ -167,7 +167,7 @@ runcmd:
167167
args: args{
168168
input: &NodeInput{
169169
ClusterName: "test-cluster",
170-
DNSClusterIP: pointer.String("192.168.0.1"),
170+
DNSClusterIP: ptr.To[string]("192.168.0.1"),
171171
},
172172
},
173173
expectedBytes: []byte(`#cloud-config
@@ -181,7 +181,7 @@ runcmd:
181181
args: args{
182182
input: &NodeInput{
183183
ClusterName: "test-cluster",
184-
DockerConfigJSON: pointer.String("{\"debug\":true}"),
184+
DockerConfigJSON: ptr.To[string]("{\"debug\":true}"),
185185
},
186186
},
187187
expectedBytes: []byte(`#cloud-config
@@ -244,7 +244,7 @@ runcmd:
244244
args: args{
245245
input: &NodeInput{
246246
ClusterName: "test-cluster",
247-
BootstrapCommandOverride: pointer.String("/custom/mybootstrap.sh"),
247+
BootstrapCommandOverride: ptr.To[string]("/custom/mybootstrap.sh"),
248248
},
249249
},
250250
expectedBytes: []byte(`#cloud-config

cmd/clusterawsadm/api/ami/v1beta1/zz_generated.deepcopy.go

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

cmd/clusterawsadm/api/bootstrap/v1alpha1/defaults.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ package v1alpha1
1818

1919
import (
2020
runtime "k8s.io/apimachinery/pkg/runtime"
21-
utilpointer "k8s.io/utils/pointer"
21+
utilpointer "k8s.io/utils/ptr"
2222

2323
infrav1 "sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2"
2424
iamv1 "sigs.k8s.io/cluster-api-provider-aws/v2/iam/api/v1beta1"
@@ -49,7 +49,7 @@ func SetDefaults_BootstrapUser(obj *BootstrapUser) { //nolint:golint,stylecheck
4949
// SetDefaults_AWSIAMConfigurationSpec is used by defaulter-gen.
5050
func SetDefaults_AWSIAMConfigurationSpec(obj *AWSIAMConfigurationSpec) { //nolint:golint,stylecheck
5151
if obj.NameSuffix == nil {
52-
obj.NameSuffix = utilpointer.String(iamv1.DefaultNameSuffix)
52+
obj.NameSuffix = utilpointer.To[string](iamv1.DefaultNameSuffix)
5353
}
5454
if obj.Partition == "" {
5555
obj.Partition = DefaultPartitionName
@@ -98,7 +98,7 @@ func SetDefaults_AWSIAMConfiguration(obj *AWSIAMConfiguration) { //nolint:golint
9898
obj.APIVersion = SchemeGroupVersion.String()
9999
obj.Kind = "AWSIAMConfiguration"
100100
if obj.Spec.NameSuffix == nil {
101-
obj.Spec.NameSuffix = utilpointer.String(iamv1.DefaultNameSuffix)
101+
obj.Spec.NameSuffix = utilpointer.To[string](iamv1.DefaultNameSuffix)
102102
}
103103
if obj.Spec.StackName == "" {
104104
obj.Spec.StackName = DefaultStackName

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

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

cmd/clusterawsadm/api/bootstrap/v1beta1/defaults.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ package v1beta1
1818

1919
import (
2020
"k8s.io/apimachinery/pkg/runtime"
21-
"k8s.io/utils/pointer"
21+
"k8s.io/utils/ptr"
2222

2323
infrav1 "sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2"
2424
iamv1 "sigs.k8s.io/cluster-api-provider-aws/v2/iam/api/v1beta1"
@@ -60,7 +60,7 @@ func SetDefaults_BootstrapUser(obj *BootstrapUser) { //nolint:golint,stylecheck
6060
// SetDefaults_AWSIAMConfigurationSpec is used by defaulter-gen.
6161
func SetDefaults_AWSIAMConfigurationSpec(obj *AWSIAMConfigurationSpec) { //nolint:golint,stylecheck
6262
if obj.NameSuffix == nil {
63-
obj.NameSuffix = pointer.String(iamv1.DefaultNameSuffix)
63+
obj.NameSuffix = ptr.To[string](iamv1.DefaultNameSuffix)
6464
}
6565
if obj.Partition == "" {
6666
obj.Partition = DefaultPartitionName
@@ -113,7 +113,7 @@ func SetDefaults_AWSIAMConfiguration(obj *AWSIAMConfiguration) { //nolint:golint
113113
obj.APIVersion = SchemeGroupVersion.String()
114114
obj.Kind = "AWSIAMConfiguration"
115115
if obj.Spec.NameSuffix == nil {
116-
obj.Spec.NameSuffix = pointer.String(iamv1.DefaultNameSuffix)
116+
obj.Spec.NameSuffix = ptr.To[string](iamv1.DefaultNameSuffix)
117117
}
118118
if obj.Spec.StackName == "" {
119119
obj.Spec.StackName = DefaultStackName

cmd/clusterawsadm/api/bootstrap/v1beta1/zz_generated.deepcopy.go

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

cmd/clusterawsadm/cloudformation/bootstrap/template_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424

2525
"github.com/awslabs/goformation/v4/cloudformation"
2626
"github.com/sergi/go-diff/diffmatchpatch"
27-
"k8s.io/utils/pointer"
27+
"k8s.io/utils/ptr"
2828
"sigs.k8s.io/yaml"
2929

3030
infrav1 "sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2"
@@ -73,7 +73,7 @@ func TestRenderCloudformation(t *testing.T) {
7373
fixture: "customsuffix",
7474
template: func() Template {
7575
t := NewTemplate()
76-
t.Spec.NameSuffix = pointer.String(".custom-suffix.com")
76+
t.Spec.NameSuffix = ptr.To[string](".custom-suffix.com")
7777
return t
7878
},
7979
},

cmd/clusterawsadm/cloudformation/service/service.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
go_cfn "github.com/awslabs/goformation/v4/cloudformation"
3030
"github.com/pkg/errors"
3131
"k8s.io/klog/v2"
32-
"k8s.io/utils/pointer"
32+
"k8s.io/utils/ptr"
3333

3434
"sigs.k8s.io/cluster-api-provider-aws/v2/pkg/cloud/awserrors"
3535
)
@@ -59,8 +59,8 @@ func (s *Service) ReconcileBootstrapStack(stackName string, t go_cfn.Template, t
5959
stackTags := []*cfn.Tag{}
6060
for k, v := range tags {
6161
stackTags = append(stackTags, &cfn.Tag{
62-
Key: pointer.String(k),
63-
Value: pointer.String(v),
62+
Key: ptr.To[string](k),
63+
Value: ptr.To[string](v),
6464
})
6565
}
6666
//nolint:nestif

config/crd/bases/bootstrap.cluster.x-k8s.io_eksconfigs.yaml

Lines changed: 1 addition & 1 deletion
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.12.1
6+
controller-gen.kubebuilder.io/version: v0.13.0
77
name: eksconfigs.bootstrap.cluster.x-k8s.io
88
spec:
99
group: bootstrap.cluster.x-k8s.io

config/crd/bases/bootstrap.cluster.x-k8s.io_eksconfigtemplates.yaml

Lines changed: 1 addition & 1 deletion
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.12.1
6+
controller-gen.kubebuilder.io/version: v0.13.0
77
name: eksconfigtemplates.bootstrap.cluster.x-k8s.io
88
spec:
99
group: bootstrap.cluster.x-k8s.io

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

Lines changed: 1 addition & 1 deletion
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.12.1
6+
controller-gen.kubebuilder.io/version: v0.13.0
77
name: awsmanagedcontrolplanes.controlplane.cluster.x-k8s.io
88
spec:
99
group: controlplane.cluster.x-k8s.io

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

Lines changed: 1 addition & 1 deletion
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.12.1
6+
controller-gen.kubebuilder.io/version: v0.13.0
77
name: rosacontrolplanes.controlplane.cluster.x-k8s.io
88
spec:
99
group: controlplane.cluster.x-k8s.io

0 commit comments

Comments
 (0)