Skip to content

Commit 568ac33

Browse files
authored
🌱 Bump CAPI in tests to main (v1.11) (#3468)
* Bump CAPI in tests to main * Bump to Go 1.24 and CAPI Go dependencies * Use deprecated conditions and patch packages * rename clusterv1 v1beta1 imports to clusterv1beta1 * controllers: use deprecated paused pkg * part1: use clusterv1.Cluster and Machine * realias deprecated condition package imports * controlplanev1 update to v1beta2 except test-extension * migrate Cluster .status.infrastructureReady to .status.initialization.infrastructureProvisioned * migrate watches to v1beta2 cluster and machine and fixup predicate * controllers: fix check on cluster v1beta1 condition * test: vcsim: fixup clusterv1 to v1beta2 * some more cluster/machine to v1beta2 * fixes * fixup printf findings * fixes * fix using local replace for tests * Bump CAPI to 071d769879ff13ae358c82a6d267da97e13f05f6 * fixes * e2e: migrate main templates to v1beta2 * e2e: add v1.11 metadata.yaml * fixup capi metadata * fixup e2e capi metadata * vcsim: reconcile based on v1beta1 for compatibility to clusterctl upgrade tests * vsphere.yaml: fix contract for CAPI and bump to 19th may * e2e: fix scheme and target contract in upgrade tests * bump capi manifests for runtimesdk v1beta2 * Bump CAPI to main * sed s "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1beta2" "sigs.k8s.io/cluster-api/api/bootstrap/kubeadm/v1beta2" g * sed s "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1beta1" "sigs.k8s.io/cluster-api/api/bootstrap/kubeadm/v1beta1" g * sed s "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1beta2" "sigs.k8s.io/cluster-api/api/controlplane/kubeadm/v1beta2" g * sed s "sigs.k8s.io/cluster-api/api/v1beta2" "sigs.k8s.io/cluster-api/api/core/v1beta2" g * sed s "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/cluster-api/api/core/v1beta1" g * sed s "sigs.k8s.io/cluster-api/exp/ipam/api/v1beta1" "sigs.k8s.io/cluster-api/api/ipam/v1beta1" g * sed s "sigs.k8s.io/cluster-api/exp/api/v1beta2" "sigs.k8s.io/cluster-api/api/core/v1beta2" g * .golangci.yml adjustment and expv1 -> clusterv1 renaming * sed s "sigs.k8s.io/cluster-api/exp/ipam/api/v1alpha1" "sigs.k8s.io/cluster-api/api/ipam/v1alpha1" g * sed s "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1" "sigs.k8s.io/cluster-api/api/runtime/hooks/v1alpha1" g * sed s "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1beta1" "sigs.k8s.io/cluster-api/api/controlplane/kubeadm/v1beta1" g * make generate-modules * make lint-fix * test: bump to ipam v1beta1 * lint: exclude deprecation messages * make lint-fix * fixup cc.spec.class removal * fixup imports ipamv1beta1 * e2e: use ipam v1beta2 * run generate * test-extension: fail mutation on unknown objects * packaging: use addons v1beta2 * make exclude for controlplanev1beta1 more specific * make exclude for bootstrapv1beta1 more specific * make lint excludes more specific * Bump CAPI and manifests to nightly_main_20250526 * exclude corev1.Endpoints deprecation * make test extension fail on unknown types * use randfill instead of gofuzz * Fixup import * Bump controller-gen, setup-envtest and conversion-gen * fixes * fix * test-extension: patch v1beta2 * Bump CAPI manifests * fixup remove usage of sigs.k8s.io/cluster-api/util/conditions/deprecated/v1beta1 * review fixes * fixup .golangci.yml
1 parent b401904 commit 568ac33

File tree

184 files changed

+1726
-1561
lines changed

Some content is hidden

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

184 files changed

+1726
-1561
lines changed

‎.golangci.yml

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: "2"
22
run:
33
timeout: 10m
4-
go: "1.23"
4+
go: "1.24"
55
allow-parallel-runners: true
66
linters:
77
default: none
@@ -117,23 +117,30 @@ linters:
117117
- pkg: github.com/vmware-tanzu/nsx-operator/pkg/apis/vpc/v1alpha1
118118
alias: nsxvpcv1
119119
# CABPK
120-
- pkg: sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1beta1
120+
- pkg: sigs.k8s.io/cluster-api/api/bootstrap/kubeadm/v1beta2
121121
alias: bootstrapv1
122+
- pkg: sigs.k8s.io/cluster-api/api/bootstrap/kubeadm/v1beta1
123+
alias: bootstrapv1beta1
122124
# KCP
123-
- pkg: sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1beta1
125+
- pkg: sigs.k8s.io/cluster-api/api/controlplane/kubeadm/v1beta2
124126
alias: controlplanev1
125127
# CAPI
126-
- pkg: sigs.k8s.io/cluster-api/api/v1beta1
128+
- pkg: sigs.k8s.io/cluster-api/api/core/v1beta2
127129
alias: clusterv1
128-
# CAPI exp
129-
- pkg: sigs.k8s.io/cluster-api/exp/api/v1beta1
130-
alias: expv1
131-
# CAPI exp addons
132-
- pkg: sigs.k8s.io/cluster-api/api/addons/v1beta1
130+
- pkg: sigs.k8s.io/cluster-api/api/core/v1beta1
131+
alias: clusterv1beta1
132+
- pkg: sigs.k8s.io/cluster-api/util/deprecated/v1beta1/conditions
133+
alias: deprecatedconditions
134+
- pkg: sigs.k8s.io/cluster-api/util/deprecated/v1beta1/conditions/v1beta2
135+
alias: deprecatedv1beta2conditions
136+
# CAPI addons
137+
- pkg: sigs.k8s.io/cluster-api/api/addons/v1beta2
133138
alias: addonsv1
134139
# CAPI IPAM
135-
- pkg: sigs.k8s.io/cluster-api/exp/ipam/api/v1beta1
140+
- pkg: sigs.k8s.io/cluster-api/api/ipam/v1beta2
136141
alias: ipamv1
142+
- pkg: sigs.k8s.io/cluster-api/api/ipam/v1beta1
143+
alias: ipamv1beta1
137144
nolintlint:
138145
require-specific: true
139146
allow-unused: false
@@ -195,6 +202,22 @@ linters:
195202
- linters:
196203
- staticcheck
197204
text: 'SA1019: "sigs.k8s.io/cluster-api-provider-vsphere/apis/(v1alpha3|v1alpha4)" is deprecated: This package will be removed in one of the next releases.'
205+
- linters:
206+
- staticcheck
207+
text: 'SA1019: "sigs.k8s.io/cluster-api/api/core/v1beta1" is deprecated: This package is deprecated and is going to be removed when support for v1beta1 will be dropped.'
208+
# CAPV Govmomi aggregates from IPAddressClaims to v1beta1 conditions
209+
- linters:
210+
- staticcheck
211+
text: 'SA1019: "sigs.k8s.io/cluster-api/api/ipam/v1beta1" is deprecated: This package is deprecated and is going to be removed when support for v1beta1 will be dropped.'
212+
- linters:
213+
- staticcheck
214+
text: 'SA1019: "sigs.k8s.io/cluster-api/util/deprecated/v1beta1/.*" is deprecated'
215+
- linters:
216+
- staticcheck
217+
text: 'SA1019: corev1.Endpoints is deprecated: This API is deprecated in v1.33\+. Use discoveryv1.EndpointSlice.'
218+
- linters:
219+
- staticcheck
220+
text: 'SA1019: corev1.EndpointSubset is deprecated: This API is deprecated in v1.33\+.'
198221
- linters:
199222
- revive
200223
text: 'exported: exported method .*\.(Reconcile|SetupWithManager|SetupWebhookWithManager) should have comment or be unexported'
@@ -304,10 +327,6 @@ linters:
304327
- staticcheck
305328
path: ^(apis/(v1alpha3|v1alpha4)\/.*)\.go$
306329
text: ST1021|ST1020
307-
# Ignore non-constant format string in call to condition utils
308-
- linters:
309-
- govet
310-
text: non-constant format string in call to sigs\.k8s\.io\/cluster-api\/util\/conditions\.
311330
- linters:
312331
- goconst
313332
path: (.+)_test\.go

‎Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ SHELL:=/usr/bin/env bash
2323
#
2424
# Go.
2525
#
26-
GO_VERSION ?= 1.23.8
27-
GO_DIRECTIVE_VERSION ?= 1.23.0
26+
GO_VERSION ?= 1.24.3
27+
GO_DIRECTIVE_VERSION ?= 1.24.0
2828
GO_CONTAINER_IMAGE ?= docker.io/library/golang:$(GO_VERSION)
2929

3030
# Ensure correct toolchain is used
@@ -113,12 +113,12 @@ KUSTOMIZE_BIN := kustomize
113113
KUSTOMIZE := $(abspath $(TOOLS_BIN_DIR)/$(KUSTOMIZE_BIN)-$(KUSTOMIZE_VER))
114114
KUSTOMIZE_PKG := sigs.k8s.io/kustomize/kustomize/v4
115115

116-
SETUP_ENVTEST_VER := release-0.20
116+
SETUP_ENVTEST_VER := release-0.21
117117
SETUP_ENVTEST_BIN := setup-envtest
118118
SETUP_ENVTEST := $(abspath $(TOOLS_BIN_DIR)/$(SETUP_ENVTEST_BIN)-$(SETUP_ENVTEST_VER))
119119
SETUP_ENVTEST_PKG := sigs.k8s.io/controller-runtime/tools/setup-envtest
120120

121-
CONTROLLER_GEN_VER := v0.17.0
121+
CONTROLLER_GEN_VER := v0.18.0
122122
CONTROLLER_GEN_BIN := controller-gen
123123
CONTROLLER_GEN := $(abspath $(TOOLS_BIN_DIR)/$(CONTROLLER_GEN_BIN)-$(CONTROLLER_GEN_VER))
124124
CONTROLLER_GEN_PKG := sigs.k8s.io/controller-tools/cmd/controller-gen
@@ -128,7 +128,7 @@ GOTESTSUM_BIN := gotestsum
128128
GOTESTSUM := $(abspath $(TOOLS_BIN_DIR)/$(GOTESTSUM_BIN)-$(GOTESTSUM_VER))
129129
GOTESTSUM_PKG := gotest.tools/gotestsum
130130

131-
CONVERSION_GEN_VER := v0.32.0
131+
CONVERSION_GEN_VER := v0.33.0
132132
CONVERSION_GEN_BIN := conversion-gen
133133
# We are intentionally using the binary without version suffix, to avoid the version
134134
# in generated files.
@@ -190,7 +190,7 @@ IMPORT_BOSS_VER := v0.28.1
190190
IMPORT_BOSS := $(abspath $(TOOLS_BIN_DIR)/$(IMPORT_BOSS_BIN))
191191
IMPORT_BOSS_PKG := k8s.io/code-generator/cmd/import-boss
192192

193-
CAPI_HACK_TOOLS_VER := 647a1b741bc86dd759583a44b50a3ba8dbd326c4 # Note: this the commit ID of CAPI v1.10.1
193+
CAPI_HACK_TOOLS_VER := 071d769879ff13ae358c82a6d267da97e13f05f6 # Note: this the commit ID of CAPI on main at 19th May 2025
194194

195195
BOSKOSCTL_BIN := boskosctl
196196
BOSKOSCTL := $(abspath $(TOOLS_BIN_DIR)/$(BOSKOSCTL_BIN))

‎apis/v1alpha3/conversion_test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ package v1alpha3
1919
import (
2020
"testing"
2121

22-
fuzz "github.com/google/gofuzz"
2322
. "github.com/onsi/gomega"
2423
"k8s.io/apimachinery/pkg/api/apitesting/fuzzer"
2524
"k8s.io/apimachinery/pkg/runtime"
2625
runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer"
2726
utilconversion "sigs.k8s.io/cluster-api/util/conversion"
27+
"sigs.k8s.io/randfill"
2828

2929
infrav1 "sigs.k8s.io/cluster-api-provider-vsphere/apis/v1beta1"
3030
)
@@ -67,16 +67,16 @@ func TestFuzzyConversion(t *testing.T) {
6767

6868
func overrideVSphereClusterDeprecatedFieldsFuncs(runtimeserializer.CodecFactory) []interface{} {
6969
return []interface{}{
70-
func(vsphereClusterSpec *VSphereClusterSpec, _ fuzz.Continue) {
70+
func(vsphereClusterSpec *VSphereClusterSpec, _ randfill.Continue) {
7171
vsphereClusterSpec.CloudProviderConfiguration = CPIConfig{}
7272
},
7373
}
7474
}
7575

7676
func overrideVSphereClusterSpecFieldsFuncs(runtimeserializer.CodecFactory) []interface{} {
7777
return []interface{}{
78-
func(in *infrav1.VSphereClusterSpec, c fuzz.Continue) {
79-
c.FuzzNoCustom(in)
78+
func(in *infrav1.VSphereClusterSpec, c randfill.Continue) {
79+
c.FillNoCustom(in)
8080
in.ClusterModules = nil
8181
in.FailureDomainSelector = nil
8282
in.DisableClusterModule = false
@@ -86,8 +86,8 @@ func overrideVSphereClusterSpecFieldsFuncs(runtimeserializer.CodecFactory) []int
8686

8787
func overrideVSphereClusterStatusFieldsFuncs(runtimeserializer.CodecFactory) []interface{} {
8888
return []interface{}{
89-
func(in *infrav1.VSphereClusterStatus, c fuzz.Continue) {
90-
c.FuzzNoCustom(in)
89+
func(in *infrav1.VSphereClusterStatus, c randfill.Continue) {
90+
c.FillNoCustom(in)
9191
in.VCenterVersion = ""
9292
},
9393
}
@@ -99,8 +99,8 @@ func CustomObjectMetaFuzzFunc(runtimeserializer.CodecFactory) []interface{} {
9999
}
100100
}
101101

102-
func CustomObjectMetaFuzzer(in *ObjectMeta, c fuzz.Continue) {
103-
c.FuzzNoCustom(in)
102+
func CustomObjectMetaFuzzer(in *ObjectMeta, c randfill.Continue) {
103+
c.FillNoCustom(in)
104104

105105
// These fields have been removed in v1alpha4
106106
// data is going to be lost, so we're forcing zero values here.
@@ -117,17 +117,17 @@ func CustomNewFieldFuzzFunc(runtimeserializer.CodecFactory) []interface{} {
117117
}
118118
}
119119

120-
func CustomSpecNewFieldFuzzer(in *infrav1.VirtualMachineCloneSpec, c fuzz.Continue) {
121-
c.FuzzNoCustom(in)
120+
func CustomSpecNewFieldFuzzer(in *infrav1.VirtualMachineCloneSpec, c randfill.Continue) {
121+
c.FillNoCustom(in)
122122

123123
in.PciDevices = nil
124124
in.AdditionalDisksGiB = nil
125125
in.OS = ""
126126
in.HardwareVersion = ""
127127
}
128128

129-
func CustomStatusNewFieldFuzzer(in *infrav1.VSphereVMStatus, c fuzz.Continue) {
130-
c.FuzzNoCustom(in)
129+
func CustomStatusNewFieldFuzzer(in *infrav1.VSphereVMStatus, c randfill.Continue) {
130+
c.FillNoCustom(in)
131131

132132
in.Host = ""
133133
in.ModuleUUID = nil

‎apis/v1alpha3/vspheremachinetemplate_conversion.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"unsafe"
2121

2222
apiconversion "k8s.io/apimachinery/pkg/conversion"
23-
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
23+
clusterv1beta1 "sigs.k8s.io/cluster-api/api/core/v1beta1"
2424
utilconversion "sigs.k8s.io/cluster-api/util/conversion"
2525
"sigs.k8s.io/controller-runtime/pkg/conversion"
2626

@@ -79,14 +79,14 @@ func (dst *VSphereMachineTemplateList) ConvertFrom(srcRaw conversion.Hub) error
7979
return Convert_v1beta1_VSphereMachineTemplateList_To_v1alpha3_VSphereMachineTemplateList(src, dst, nil)
8080
}
8181

82-
func Convert_v1alpha3_ObjectMeta_To_v1beta1_ObjectMeta(in *ObjectMeta, out *clusterv1.ObjectMeta, s apiconversion.Scope) error {
82+
func Convert_v1alpha3_ObjectMeta_To_v1beta1_ObjectMeta(in *ObjectMeta, out *clusterv1beta1.ObjectMeta, s apiconversion.Scope) error {
8383
// wrapping the conversion func to avoid having compile errors due to compileErrorOnMissingConversion()
8484
// more details at https://github.com/kubernetes/kubernetes/issues/98380
8585
return autoConvert_v1alpha3_ObjectMeta_To_v1beta1_ObjectMeta(in, out, s)
8686
}
8787

8888
// autoConvert_v1alpha3_ObjectMeta_To_v1beta1_ObjectMeta was copied over from CAPI because it is now internal there.
89-
func autoConvert_v1alpha3_ObjectMeta_To_v1beta1_ObjectMeta(in *ObjectMeta, out *clusterv1.ObjectMeta, s apiconversion.Scope) error {
89+
func autoConvert_v1alpha3_ObjectMeta_To_v1beta1_ObjectMeta(in *ObjectMeta, out *clusterv1beta1.ObjectMeta, s apiconversion.Scope) error {
9090
// WARNING: in.Name requires manual conversion: does not exist in peer-type
9191
// WARNING: in.GenerateName requires manual conversion: does not exist in peer-type
9292
// WARNING: in.Namespace requires manual conversion: does not exist in peer-type
@@ -96,14 +96,14 @@ func autoConvert_v1alpha3_ObjectMeta_To_v1beta1_ObjectMeta(in *ObjectMeta, out *
9696
return nil
9797
}
9898

99-
func Convert_v1beta1_ObjectMeta_To_v1alpha3_ObjectMeta(in *clusterv1.ObjectMeta, out *ObjectMeta, s apiconversion.Scope) error {
99+
func Convert_v1beta1_ObjectMeta_To_v1alpha3_ObjectMeta(in *clusterv1beta1.ObjectMeta, out *ObjectMeta, s apiconversion.Scope) error {
100100
// wrapping the conversion func to avoid having compile errors due to compileErrorOnMissingConversion()
101101
// more details at https://github.com/kubernetes/kubernetes/issues/98380
102102
return autoConvert_v1beta1_ObjectMeta_To_v1alpha3_ObjectMeta(in, out, s)
103103
}
104104

105105
// autoConvert_v1beta1_ObjectMeta_To_v1alpha3_ObjectMeta was copied over from CAPI because it is now internal there.
106-
func autoConvert_v1beta1_ObjectMeta_To_v1alpha3_ObjectMeta(in *clusterv1.ObjectMeta, out *ObjectMeta, s apiconversion.Scope) error {
106+
func autoConvert_v1beta1_ObjectMeta_To_v1alpha3_ObjectMeta(in *clusterv1beta1.ObjectMeta, out *ObjectMeta, s apiconversion.Scope) error {
107107
out.Labels = *(*map[string]string)(unsafe.Pointer(&in.Labels))
108108
out.Annotations = *(*map[string]string)(unsafe.Pointer(&in.Annotations))
109109
return nil

‎apis/v1alpha3/zz_generated.conversion.go

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

‎apis/v1alpha4/conversion_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ package v1alpha4
1919
import (
2020
"testing"
2121

22-
fuzz "github.com/google/gofuzz"
2322
. "github.com/onsi/gomega"
2423
"k8s.io/apimachinery/pkg/api/apitesting/fuzzer"
2524
"k8s.io/apimachinery/pkg/runtime"
2625
runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer"
2726
utilconversion "sigs.k8s.io/cluster-api/util/conversion"
27+
"sigs.k8s.io/randfill"
2828

2929
infrav1 "sigs.k8s.io/cluster-api-provider-vsphere/apis/v1beta1"
3030
)
@@ -66,8 +66,8 @@ func TestFuzzyConversion(t *testing.T) {
6666

6767
func overrideVSphereClusterSpecFieldsFuncs(runtimeserializer.CodecFactory) []interface{} {
6868
return []interface{}{
69-
func(in *infrav1.VSphereClusterSpec, c fuzz.Continue) {
70-
c.FuzzNoCustom(in)
69+
func(in *infrav1.VSphereClusterSpec, c randfill.Continue) {
70+
c.FillNoCustom(in)
7171
in.ClusterModules = nil
7272
in.FailureDomainSelector = nil
7373
in.DisableClusterModule = false
@@ -77,8 +77,8 @@ func overrideVSphereClusterSpecFieldsFuncs(runtimeserializer.CodecFactory) []int
7777

7878
func overrideVSphereClusterStatusFieldsFuncs(runtimeserializer.CodecFactory) []interface{} {
7979
return []interface{}{
80-
func(in *infrav1.VSphereClusterStatus, c fuzz.Continue) {
81-
c.FuzzNoCustom(in)
80+
func(in *infrav1.VSphereClusterStatus, c randfill.Continue) {
81+
c.FillNoCustom(in)
8282
in.VCenterVersion = ""
8383
},
8484
}
@@ -91,17 +91,17 @@ func CustomNewFieldFuzzFunc(runtimeserializer.CodecFactory) []interface{} {
9191
}
9292
}
9393

94-
func CustomSpecNewFieldFuzzer(in *infrav1.VirtualMachineCloneSpec, c fuzz.Continue) {
95-
c.FuzzNoCustom(in)
94+
func CustomSpecNewFieldFuzzer(in *infrav1.VirtualMachineCloneSpec, c randfill.Continue) {
95+
c.FillNoCustom(in)
9696

9797
in.PciDevices = nil
9898
in.AdditionalDisksGiB = nil
9999
in.OS = ""
100100
in.HardwareVersion = ""
101101
}
102102

103-
func CustomStatusNewFieldFuzzer(in *infrav1.VSphereVMStatus, c fuzz.Continue) {
104-
c.FuzzNoCustom(in)
103+
func CustomStatusNewFieldFuzzer(in *infrav1.VSphereVMStatus, c randfill.Continue) {
104+
c.FillNoCustom(in)
105105

106106
in.Host = ""
107107
in.ModuleUUID = nil

0 commit comments

Comments
 (0)