Skip to content

Commit

Permalink
✨ Bump CAPI to v1.6.x (#4739)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
damdo committed Jan 18, 2024
1 parent 370a1f0 commit a1918aa
Show file tree
Hide file tree
Showing 99 changed files with 885 additions and 774 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ E2E_SKIP_EKS_UPGRADE ?= "false"
EKS_SOURCE_TEMPLATE ?= eks/cluster-template-eks-control-plane-only.yaml

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

.build/generate-go-apis: .build $(API_FILES) $(CONTROLLER_GEN) $(DEFAULTER_GEN) $(CONVERSION_GEN) ## Generate all Go api files
$(CONTROLLER_GEN) \
paths=./ \
paths=./api/... \
paths=./$(EXP_DIR)/api/... \
paths=./bootstrap/eks/api/... \
Expand Down
1 change: 0 additions & 1 deletion api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions api/v1beta2/awsmachine_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/aws/aws-sdk-go/aws"
. "github.com/onsi/gomega"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"

utildefaulting "sigs.k8s.io/cluster-api/util/defaulting"
)
Expand Down Expand Up @@ -284,14 +284,14 @@ func TestAWSMachineUpdate(t *testing.T) {
},
newMachine: &AWSMachine{
Spec: AWSMachineSpec{
ProviderID: pointer.String("ID"),
ProviderID: ptr.To[string]("ID"),
InstanceType: "test",
AdditionalTags: Tags{
"key-1": "value-1",
},
AdditionalSecurityGroups: []AWSResourceReference{
{
ID: pointer.String("ID"),
ID: ptr.To[string]("ID"),
},
},
CloudInit: CloudInit{
Expand All @@ -316,13 +316,13 @@ func TestAWSMachineUpdate(t *testing.T) {
Spec: AWSMachineSpec{
ImageLookupOrg: "test",
InstanceType: "test",
ProviderID: pointer.String("ID"),
ProviderID: ptr.To[string]("ID"),
AdditionalTags: Tags{
"key-1": "value-1",
},
AdditionalSecurityGroups: []AWSResourceReference{
{
ID: pointer.String("ID"),
ID: ptr.To[string]("ID"),
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions api/v1beta2/awsmachinetemplate_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

"github.com/aws/aws-sdk-go/aws"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
)

func TestAWSMachineTemplateValidateCreate(t *testing.T) {
Expand All @@ -38,7 +38,7 @@ func TestAWSMachineTemplateValidateCreate(t *testing.T) {
Spec: AWSMachineTemplateSpec{
Template: AWSMachineTemplateResource{
Spec: AWSMachineSpec{
ProviderID: pointer.String("something"),
ProviderID: ptr.To[string]("something"),
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions api/v1beta2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion bootstrap/eks/api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion bootstrap/eks/api/v1beta2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions bootstrap/eks/controllers/eksconfig_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
"k8s.io/klog/v2"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/controller"
Expand Down Expand Up @@ -261,14 +261,14 @@ func (r *EKSConfigReconciler) joinWorker(ctx context.Context, cluster *clusterv1
// If not, we also check if the cluster is ipv6 based.
if config.Spec.ServiceIPV6Cidr != nil && *config.Spec.ServiceIPV6Cidr != "" {
nodeInput.ServiceIPV6Cidr = config.Spec.ServiceIPV6Cidr
nodeInput.IPFamily = pointer.String("ipv6")
nodeInput.IPFamily = ptr.To[string]("ipv6")
}

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

// generate userdata
Expand Down Expand Up @@ -355,7 +355,7 @@ func (r *EKSConfigReconciler) storeBootstrapData(ctx context.Context, cluster *c
}
}

config.Status.DataSecretName = pointer.String(secret.Name)
config.Status.DataSecretName = ptr.To[string](secret.Name)
config.Status.Ready = true
conditions.MarkTrue(config, eksbootstrapv1.DataSecretAvailableCondition)
return nil
Expand Down Expand Up @@ -443,7 +443,7 @@ func (r *EKSConfigReconciler) createBootstrapSecret(ctx context.Context, cluster
Kind: "EKSConfig",
Name: config.Name,
UID: config.UID,
Controller: pointer.Bool(true),
Controller: ptr.To[bool](true),
},
},
},
Expand Down
24 changes: 12 additions & 12 deletions bootstrap/eks/internal/userdata/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/aws/aws-sdk-go/aws"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/format"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"

eksbootstrapv1 "sigs.k8s.io/cluster-api-provider-aws/v2/bootstrap/eks/api/v1beta2"
)
Expand Down Expand Up @@ -77,7 +77,7 @@ runcmd:
args: args{
input: &NodeInput{
ClusterName: "test-cluster",
ContainerRuntime: pointer.String("containerd"),
ContainerRuntime: ptr.To[string]("containerd"),
},
},
expectedBytes: []byte(`#cloud-config
Expand All @@ -95,7 +95,7 @@ runcmd:
"node-labels": "node-role.undistro.io/infra=true",
"register-with-taints": "dedicated=infra:NoSchedule",
},
ContainerRuntime: pointer.String("containerd"),
ContainerRuntime: ptr.To[string]("containerd"),
},
},
expectedBytes: []byte(`#cloud-config
Expand All @@ -109,8 +109,8 @@ runcmd:
args: args{
input: &NodeInput{
ClusterName: "test-cluster",
ServiceIPV6Cidr: pointer.String("fe80:0000:0000:0000:0204:61ff:fe9d:f156/24"),
IPFamily: pointer.String("ipv6"),
ServiceIPV6Cidr: ptr.To[string]("fe80:0000:0000:0000:0204:61ff:fe9d:f156/24"),
IPFamily: ptr.To[string]("ipv6"),
},
},
expectedBytes: []byte(`#cloud-config
Expand All @@ -124,7 +124,7 @@ runcmd:
args: args{
input: &NodeInput{
ClusterName: "test-cluster",
UseMaxPods: pointer.Bool(false),
UseMaxPods: ptr.To[bool](false),
},
},
expectedBytes: []byte(`#cloud-config
Expand All @@ -138,7 +138,7 @@ runcmd:
args: args{
input: &NodeInput{
ClusterName: "test-cluster",
APIRetryAttempts: pointer.Int(5),
APIRetryAttempts: ptr.To[int](5),
},
},
expectedBytes: []byte(`#cloud-config
Expand All @@ -152,8 +152,8 @@ runcmd:
args: args{
input: &NodeInput{
ClusterName: "test-cluster",
PauseContainerAccount: pointer.String("12345678"),
PauseContainerVersion: pointer.String("v1"),
PauseContainerAccount: ptr.To[string]("12345678"),
PauseContainerVersion: ptr.To[string]("v1"),
},
},
expectedBytes: []byte(`#cloud-config
Expand All @@ -167,7 +167,7 @@ runcmd:
args: args{
input: &NodeInput{
ClusterName: "test-cluster",
DNSClusterIP: pointer.String("192.168.0.1"),
DNSClusterIP: ptr.To[string]("192.168.0.1"),
},
},
expectedBytes: []byte(`#cloud-config
Expand All @@ -181,7 +181,7 @@ runcmd:
args: args{
input: &NodeInput{
ClusterName: "test-cluster",
DockerConfigJSON: pointer.String("{\"debug\":true}"),
DockerConfigJSON: ptr.To[string]("{\"debug\":true}"),
},
},
expectedBytes: []byte(`#cloud-config
Expand Down Expand Up @@ -244,7 +244,7 @@ runcmd:
args: args{
input: &NodeInput{
ClusterName: "test-cluster",
BootstrapCommandOverride: pointer.String("/custom/mybootstrap.sh"),
BootstrapCommandOverride: ptr.To[string]("/custom/mybootstrap.sh"),
},
},
expectedBytes: []byte(`#cloud-config
Expand Down
1 change: 0 additions & 1 deletion cmd/clusterawsadm/api/ami/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions cmd/clusterawsadm/api/bootstrap/v1alpha1/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package v1alpha1

import (
runtime "k8s.io/apimachinery/pkg/runtime"
utilpointer "k8s.io/utils/pointer"
utilpointer "k8s.io/utils/ptr"

infrav1 "sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2"
iamv1 "sigs.k8s.io/cluster-api-provider-aws/v2/iam/api/v1beta1"
Expand Down Expand Up @@ -49,7 +49,7 @@ func SetDefaults_BootstrapUser(obj *BootstrapUser) { //nolint:golint,stylecheck
// SetDefaults_AWSIAMConfigurationSpec is used by defaulter-gen.
func SetDefaults_AWSIAMConfigurationSpec(obj *AWSIAMConfigurationSpec) { //nolint:golint,stylecheck
if obj.NameSuffix == nil {
obj.NameSuffix = utilpointer.String(iamv1.DefaultNameSuffix)
obj.NameSuffix = utilpointer.To[string](iamv1.DefaultNameSuffix)
}
if obj.Partition == "" {
obj.Partition = DefaultPartitionName
Expand Down Expand Up @@ -98,7 +98,7 @@ func SetDefaults_AWSIAMConfiguration(obj *AWSIAMConfiguration) { //nolint:golint
obj.APIVersion = SchemeGroupVersion.String()
obj.Kind = "AWSIAMConfiguration"
if obj.Spec.NameSuffix == nil {
obj.Spec.NameSuffix = utilpointer.String(iamv1.DefaultNameSuffix)
obj.Spec.NameSuffix = utilpointer.To[string](iamv1.DefaultNameSuffix)
}
if obj.Spec.StackName == "" {
obj.Spec.StackName = DefaultStackName
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions cmd/clusterawsadm/api/bootstrap/v1beta1/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package v1beta1

import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"

infrav1 "sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2"
iamv1 "sigs.k8s.io/cluster-api-provider-aws/v2/iam/api/v1beta1"
Expand Down Expand Up @@ -60,7 +60,7 @@ func SetDefaults_BootstrapUser(obj *BootstrapUser) { //nolint:golint,stylecheck
// SetDefaults_AWSIAMConfigurationSpec is used by defaulter-gen.
func SetDefaults_AWSIAMConfigurationSpec(obj *AWSIAMConfigurationSpec) { //nolint:golint,stylecheck
if obj.NameSuffix == nil {
obj.NameSuffix = pointer.String(iamv1.DefaultNameSuffix)
obj.NameSuffix = ptr.To[string](iamv1.DefaultNameSuffix)
}
if obj.Partition == "" {
obj.Partition = DefaultPartitionName
Expand Down Expand Up @@ -113,7 +113,7 @@ func SetDefaults_AWSIAMConfiguration(obj *AWSIAMConfiguration) { //nolint:golint
obj.APIVersion = SchemeGroupVersion.String()
obj.Kind = "AWSIAMConfiguration"
if obj.Spec.NameSuffix == nil {
obj.Spec.NameSuffix = pointer.String(iamv1.DefaultNameSuffix)
obj.Spec.NameSuffix = ptr.To[string](iamv1.DefaultNameSuffix)
}
if obj.Spec.StackName == "" {
obj.Spec.StackName = DefaultStackName
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions cmd/clusterawsadm/cloudformation/bootstrap/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

"github.com/awslabs/goformation/v4/cloudformation"
"github.com/sergi/go-diff/diffmatchpatch"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
"sigs.k8s.io/yaml"

infrav1 "sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2"
Expand Down Expand Up @@ -73,7 +73,7 @@ func TestRenderCloudformation(t *testing.T) {
fixture: "customsuffix",
template: func() Template {
t := NewTemplate()
t.Spec.NameSuffix = pointer.String(".custom-suffix.com")
t.Spec.NameSuffix = ptr.To[string](".custom-suffix.com")
return t
},
},
Expand Down
6 changes: 3 additions & 3 deletions cmd/clusterawsadm/cloudformation/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
go_cfn "github.com/awslabs/goformation/v4/cloudformation"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"

"sigs.k8s.io/cluster-api-provider-aws/v2/pkg/cloud/awserrors"
)
Expand Down Expand Up @@ -59,8 +59,8 @@ func (s *Service) ReconcileBootstrapStack(stackName string, t go_cfn.Template, t
stackTags := []*cfn.Tag{}
for k, v := range tags {
stackTags = append(stackTags, &cfn.Tag{
Key: pointer.String(k),
Value: pointer.String(v),
Key: ptr.To[string](k),
Value: ptr.To[string](v),
})
}
//nolint:nestif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.1
controller-gen.kubebuilder.io/version: v0.13.0
name: eksconfigs.bootstrap.cluster.x-k8s.io
spec:
group: bootstrap.cluster.x-k8s.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.1
controller-gen.kubebuilder.io/version: v0.13.0
name: eksconfigtemplates.bootstrap.cluster.x-k8s.io
spec:
group: bootstrap.cluster.x-k8s.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.1
controller-gen.kubebuilder.io/version: v0.13.0
name: awsmanagedcontrolplanes.controlplane.cluster.x-k8s.io
spec:
group: controlplane.cluster.x-k8s.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.1
controller-gen.kubebuilder.io/version: v0.13.0
name: rosacontrolplanes.controlplane.cluster.x-k8s.io
spec:
group: controlplane.cluster.x-k8s.io
Expand Down
Loading

0 comments on commit a1918aa

Please sign in to comment.