From 934c0ac5cc070ef71446e22f9a974b883ebc0bd2 Mon Sep 17 00:00:00 2001 From: Christian Schlotter Date: Fri, 7 Nov 2025 09:35:55 +0100 Subject: [PATCH 1/2] Bump Go to 1.24.10 --- .github/workflows/pr-golangci-lint.yaml | 2 +- Makefile | 2 +- go.mod | 2 ++ packaging/go.mod | 2 ++ test/go.mod | 2 ++ 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-golangci-lint.yaml b/.github/workflows/pr-golangci-lint.yaml index e2fa5b4e4b..34311b918e 100644 --- a/.github/workflows/pr-golangci-lint.yaml +++ b/.github/workflows/pr-golangci-lint.yaml @@ -29,6 +29,6 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # tag=v6.1.1 with: - version: v1.60.2 + version: v1.64.3 args: --out-format=colored-line-number working-directory: ${{matrix.working-directory}} diff --git a/Makefile b/Makefile index d20163962e..de093bbe7c 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ SHELL:=/usr/bin/env bash # # Go. # -GO_VERSION ?= 1.23.12 +GO_VERSION ?= 1.24.10 GO_DIRECTIVE_VERSION ?= 1.22.0 GO_CONTAINER_IMAGE ?= docker.io/library/golang:$(GO_VERSION) diff --git a/go.mod b/go.mod index 19ffa92e6b..43649c133a 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,8 @@ module sigs.k8s.io/cluster-api-provider-vsphere go 1.22.0 +godebug default=go1.22 + replace sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.9.1 replace github.com/vmware-tanzu/vm-operator/pkg/constants/testlabels => github.com/vmware-tanzu/vm-operator/pkg/constants/testlabels v0.0.0-20240404200847-de75746a9505 diff --git a/packaging/go.mod b/packaging/go.mod index 4031fbd95f..452dc94284 100644 --- a/packaging/go.mod +++ b/packaging/go.mod @@ -2,6 +2,8 @@ module sigs.k8s.io/cluster-api-provider-vsphere/packaging go 1.22.7 +godebug default=go1.22 + replace sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.9.1 replace sigs.k8s.io/cluster-api-provider-vsphere => ../ diff --git a/test/go.mod b/test/go.mod index 1eb91cab06..bd027c1112 100644 --- a/test/go.mod +++ b/test/go.mod @@ -2,6 +2,8 @@ module sigs.k8s.io/cluster-api-provider-vsphere/test go 1.22.0 +godebug default=go1.22 + replace sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.9.1 replace sigs.k8s.io/cluster-api/test => sigs.k8s.io/cluster-api/test v1.9.1 From 30f5314bfb0cb729d5079a57aeb6c630194311a6 Mon Sep 17 00:00:00 2001 From: Christian Schlotter Date: Fri, 7 Nov 2025 09:40:53 +0100 Subject: [PATCH 2/2] make lint-fix + manual lint fixes --- .golangci.yml | 1 - controllers/vspherecluster_reconciler.go | 5 +---- controllers/vspherecluster_reconciler_test.go | 8 ++++---- controllers/vspheremachine_controller_test.go | 4 ++-- pkg/services/govmomi/ipam/status_test.go | 4 ++-- test/e2e/multivc_test.go | 4 ++-- 6 files changed, 11 insertions(+), 15 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index c22845804d..858c02373d 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -21,7 +21,6 @@ linters: - durationcheck - errcheck - errchkjson - - exportloopref - gci - ginkgolinter - goconst diff --git a/controllers/vspherecluster_reconciler.go b/controllers/vspherecluster_reconciler.go index 198f287564..cea162a8b4 100644 --- a/controllers/vspherecluster_reconciler.go +++ b/controllers/vspherecluster_reconciler.go @@ -443,10 +443,7 @@ func (r *clusterReconciler) controlPlaneMachineToCluster(ctx context.Context, o } return []ctrl.Request{{ - NamespacedName: types.NamespacedName{ - Namespace: vsphereClusterKey.Namespace, - Name: vsphereClusterKey.Name, - }, + NamespacedName: vsphereClusterKey, }} } diff --git a/controllers/vspherecluster_reconciler_test.go b/controllers/vspherecluster_reconciler_test.go index 0b230b0a05..6fc2407d09 100644 --- a/controllers/vspherecluster_reconciler_test.go +++ b/controllers/vspherecluster_reconciler_test.go @@ -119,7 +119,7 @@ var _ = Describe("VIM based VSphere ClusterReconciler", func() { // Make sure the VSphereCluster exists. Eventually(func() error { return testEnv.Get(ctx, key, instance) - }, timeout).Should(BeNil()) + }, timeout).Should(Succeed()) By("setting the OwnerRef on the VSphereCluster") Eventually(func() error { @@ -132,7 +132,7 @@ var _ = Describe("VIM based VSphere ClusterReconciler", func() { UID: "blah", }) return ph.Patch(ctx, instance, patch.WithStatusObservedGeneration{}) - }, timeout).Should(BeNil()) + }, timeout).Should(Succeed()) Eventually(func() bool { if err := testEnv.Get(ctx, key, instance); err != nil { @@ -395,7 +395,7 @@ var _ = Describe("VIM based VSphere ClusterReconciler", func() { Expect(err).ShouldNot(HaveOccurred()) zoneOne.Status.Ready = ptr.To(true) return ph.Patch(ctx, zoneOne, patch.WithStatusObservedGeneration{}) - }, timeout).Should(BeNil()) + }, timeout).Should(Succeed()) Eventually(func() bool { if err := testEnv.Get(ctx, key, instance); err != nil { @@ -414,7 +414,7 @@ var _ = Describe("VIM based VSphere ClusterReconciler", func() { Expect(err).ShouldNot(HaveOccurred()) zoneOne.Status.Ready = ptr.To(true) return ph.Patch(ctx, zoneOne, patch.WithStatusObservedGeneration{}) - }, timeout).Should(BeNil()) + }, timeout).Should(Succeed()) }) It("should remove the FailureDomainsAvailable condition from the cluster", func() { diff --git a/controllers/vspheremachine_controller_test.go b/controllers/vspheremachine_controller_test.go index 79ab407b3f..d83a9c5393 100644 --- a/controllers/vspheremachine_controller_test.go +++ b/controllers/vspheremachine_controller_test.go @@ -166,7 +166,7 @@ var _ = Describe("VsphereMachineReconciler", func() { Expect(err).ShouldNot(HaveOccurred()) capiCluster.Status.InfrastructureReady = true return ph.Patch(ctx, capiCluster, patch.WithStatusObservedGeneration{}) - }, timeout).Should(BeNil()) + }, timeout).Should(Succeed()) Eventually(func() bool { return isPresentAndFalseWithReason(infraMachine, infrav1.VMProvisionedCondition, infrav1.WaitingForClusterInfrastructureReason) @@ -199,7 +199,7 @@ var _ = Describe("VsphereMachineReconciler", func() { DataSecretName: ptr.To("some-secret"), } return ph.Patch(ctx, capiMachine, patch.WithStatusObservedGeneration{}) - }, timeout).Should(BeNil()) + }, timeout).Should(Succeed()) Eventually(func() int { vms := infrav1.VSphereVMList{} diff --git a/pkg/services/govmomi/ipam/status_test.go b/pkg/services/govmomi/ipam/status_test.go index 860ca20b9b..28e3777fa9 100644 --- a/pkg/services/govmomi/ipam/status_test.go +++ b/pkg/services/govmomi/ipam/status_test.go @@ -218,7 +218,7 @@ func Test_buildIPAMDeviceConfigs(t *testing.T) { // The IPAddressClaimed condition should not be added config, err := buildIPAMDeviceConfigs(ctx, vmCtx, networkStatus) g.Expect(err).NotTo(gomega.HaveOccurred()) - g.Expect(config[0].IPAMAddresses).To(gomega.HaveLen(0)) + g.Expect(config[0].IPAMAddresses).To(gomega.BeEmpty()) }) } @@ -435,7 +435,7 @@ func Test_BuildState(t *testing.T) { state, err := BuildState(ctx, vmCtx, networkStatus) g.Expect(err).NotTo(gomega.HaveOccurred()) - g.Expect(state).To(gomega.HaveLen(0)) + g.Expect(state).To(gomega.BeEmpty()) }) t.Run("when one device has no pool and is DHCP true, and one device has a IPAddressPool", func(_ *testing.T) { diff --git a/test/e2e/multivc_test.go b/test/e2e/multivc_test.go index 77b360ab43..f12aa6a360 100644 --- a/test/e2e/multivc_test.go +++ b/test/e2e/multivc_test.go @@ -138,11 +138,11 @@ func VerifyMultiVC(ctx context.Context, input MultiVCenterSpecInput) { Consistently(func() error { kubeSystem := &corev1.Namespace{} return input.Global.BootstrapClusterProxy.GetClient().Get(ctx, client.ObjectKey{Name: "kube-system"}, kubeSystem) - }, "5s", "100ms").Should(BeNil(), "Failed to assert bootstrap API server stability") + }, "5s", "100ms").Should(Succeed(), "Failed to assert bootstrap API server stability") Consistently(func() error { kubeSystem := &corev1.Namespace{} return mgmtClusterProxy.GetClient().Get(ctx, client.ObjectKey{Name: "kube-system"}, kubeSystem) - }, "5s", "100ms").Should(BeNil(), "Failed to assert self-hosted API server stability") + }, "5s", "100ms").Should(Succeed(), "Failed to assert self-hosted API server stability") // Get the machines of the workloadCluster before it is moved to become self-hosted to make sure that the move did not trigger // any unexpected rollouts.