Skip to content

Commit 52680fb

Browse files
committed
Bump to Cluster API 07.07.2025
Signed-off-by: Stefan Büringer [email protected]
1 parent 69db4aa commit 52680fb

29 files changed

+131
-124
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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 := 890d16f24287718d96252affa702ff5857114079 # Note: this the commit ID for CAPI v1.11.0-alpha.2
193+
CAPI_HACK_TOOLS_VER := afb1afee283a959e0a633198517422351f77b0e4 # Note: this the commit ID for CAPI main 07.07.2025.
194194

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

controllers/vmware/test/controllers_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,11 @@ func deployCluster(namespace string, k8sClient client.Client) (client.ObjectKey,
137137
Namespace: namespace,
138138
Finalizers: []string{"test"},
139139
},
140-
Spec: clusterv1.ClusterSpec{},
140+
Spec: clusterv1.ClusterSpec{
141+
ClusterNetwork: &clusterv1.ClusterNetwork{
142+
ServiceDomain: "service.domain",
143+
},
144+
},
141145
}
142146
Expect(k8sClient.Create(ctx, cluster)).To(Succeed())
143147

@@ -187,6 +191,7 @@ func deployCAPIMachine(namespace string, cluster *clusterv1.Cluster, k8sClient c
187191
},
188192
Spec: clusterv1.MachineSpec{
189193
ClusterName: cluster.Name,
194+
Bootstrap: clusterv1.Bootstrap{DataSecretName: ptr.To("data")},
190195
InfrastructureRef: clusterv1.ContractVersionedObjectReference{
191196
Kind: "VSphereMachine",
192197
Name: name, // We know that the infra machine is going to be called like the machine.
@@ -567,6 +572,7 @@ var _ = Describe("Reconciliation tests", func() {
567572
},
568573
Spec: clusterv1.MachineSpec{
569574
ClusterName: "crud",
575+
Bootstrap: clusterv1.Bootstrap{DataSecretName: ptr.To("data")},
570576
InfrastructureRef: clusterv1.ContractVersionedObjectReference{
571577
Kind: "VSphereMachine",
572578
Name: name, // We know that the infra machine is going to be called like the machine.
@@ -638,7 +644,7 @@ var _ = Describe("Reconciliation tests", func() {
638644
}
639645
Expect(k8sClient.Create(ctx, secret)).To(Succeed())
640646

641-
machine.Spec.Version = &version
647+
machine.Spec.Version = version
642648
machine.Spec.Bootstrap.DataSecretName = &secretName
643649
Expect(k8sClient.Update(ctx, machine)).To(Succeed())
644650

controllers/vspherecluster_reconciler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ func (r *clusterReconciler) patch(ctx context.Context, clusterCtx *capvcontext.C
141141
if err := v1beta2conditions.SetSummaryCondition(clusterCtx.VSphereCluster, clusterCtx.VSphereCluster, infrav1.VSphereClusterReadyV1Beta2Condition,
142142
v1beta2conditions.ForConditionTypes{
143143
infrav1.VSphereClusterVCenterAvailableV1Beta2Condition,
144-
// FailureDomainsReady and ClusterModuelsReady may not be always set.
144+
// FailureDomainsReady and ClusterModulesReady may not be always set.
145145
infrav1.VSphereClusterFailureDomainsReadyV1Beta2Condition,
146146
infrav1.VSphereClusterClusterModulesReadyV1Beta2Condition,
147147
},

controllers/vspheredeploymentzone_controller.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,10 +325,7 @@ func (r vsphereDeploymentZoneReconciler) reconcileDelete(ctx context.Context, de
325325
}
326326

327327
machinesUsingDeploymentZone := collections.FromMachineList(machines).Filter(collections.ActiveMachines, func(machine *clusterv1.Machine) bool {
328-
if machine.Spec.FailureDomain != nil {
329-
return *machine.Spec.FailureDomain == deploymentZoneCtx.VSphereDeploymentZone.Name
330-
}
331-
return false
328+
return machine.Spec.FailureDomain == deploymentZoneCtx.VSphereDeploymentZone.Name
332329
})
333330
if len(machinesUsingDeploymentZone) > 0 {
334331
machineNamesStr := util.MachinesAsString(machinesUsingDeploymentZone.SortedByCreationTimestamp())

controllers/vspheredeploymentzone_controller_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ var _ = Describe("VSphereDeploymentZoneReconciler", func() {
250250
Context("when machines are using Deployment Zone", func() {
251251
It("should block deletion", func() {
252252
machineUsingDeplZone := createMachine("machine-using-zone", "cluster-using-zone", machineNamespace.Name, false)
253-
machineUsingDeplZone.Spec.FailureDomain = ptr.To(vsphereDeploymentZone.Name)
253+
machineUsingDeplZone.Spec.FailureDomain = vsphereDeploymentZone.Name
254254
Expect(testEnv.Create(ctx, machineUsingDeplZone)).To(Succeed())
255255

256256
Expect(testEnv.Delete(ctx, vsphereDeploymentZone)).To(Succeed())
@@ -266,7 +266,7 @@ var _ = Describe("VSphereDeploymentZoneReconciler", func() {
266266

267267
It("should not block deletion if machines are being deleted", func() {
268268
machineBeingDeleted := createMachine("machine-deleted", "cluster-deleted", machineNamespace.Name, false)
269-
machineBeingDeleted.Spec.FailureDomain = ptr.To(vsphereDeploymentZone.Name)
269+
machineBeingDeleted.Spec.FailureDomain = vsphereDeploymentZone.Name
270270
machineBeingDeleted.Finalizers = []string{clusterv1.MachineFinalizer}
271271
Expect(testEnv.Create(ctx, machineBeingDeleted)).To(Succeed())
272272

@@ -545,7 +545,7 @@ func createMachine(machineName, clusterName, namespace string, isControlPlane bo
545545
},
546546
},
547547
Spec: clusterv1.MachineSpec{
548-
Version: ptr.To("v1.22.0"),
548+
Version: "v1.22.0",
549549
Bootstrap: clusterv1.Bootstrap{
550550
ConfigRef: &clusterv1.ContractVersionedObjectReference{
551551
APIGroup: bootstrapv1.GroupVersion.Group,
@@ -669,7 +669,7 @@ func TestVSphereDeploymentZoneReconciler_ReconcileDelete(t *testing.T) {
669669

670670
t.Run("when machines are using deployment zone", func(t *testing.T) {
671671
machineUsingDeplZone := createMachine("machine-1", "cluster-1", "ns", false)
672-
machineUsingDeplZone.Spec.FailureDomain = ptr.To("blah")
672+
machineUsingDeplZone.Spec.FailureDomain = "blah"
673673

674674
t.Run("should block deletion", func(t *testing.T) {
675675
controllerManagerContext := fake.NewControllerManagerContext(machineUsingDeplZone, vsphereFailureDomain)

controllers/vspheremachine_controller.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232
"k8s.io/apimachinery/pkg/util/validation"
3333
"k8s.io/client-go/tools/record"
3434
"k8s.io/klog/v2"
35+
"k8s.io/utils/ptr"
3536
clusterv1beta1 "sigs.k8s.io/cluster-api/api/core/v1beta1"
3637
clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2"
3738
clusterutilv1 "sigs.k8s.io/cluster-api/util"
@@ -400,7 +401,7 @@ func (r *machineReconciler) reconcileNormal(ctx context.Context, machineCtx capv
400401
// 2) If the Cluster is supervisor-based continue to reconcile as InfrastructureProvisioned is not set to true until after the kube apiserver is available.
401402
if !r.supervisorBased {
402403
// vmwarev1.VSphereCluster doesn't set Cluster.Status.Ready until the API endpoint is available.
403-
if machineCtx.GetCluster().Status.Initialization == nil || !machineCtx.GetCluster().Status.Initialization.InfrastructureProvisioned {
404+
if machineCtx.GetCluster().Status.Initialization == nil || !ptr.Deref(machineCtx.GetCluster().Status.Initialization.InfrastructureProvisioned, false) {
404405
log.Info("Cluster infrastructure is not ready yet, skipping reconciliation")
405406
v1beta1conditions.MarkFalse(machineCtx.GetVSphereMachine(), infrav1.VMProvisionedCondition, infrav1.WaitingForClusterInfrastructureReason, clusterv1beta1.ConditionSeverityInfo, "")
406407
v1beta2conditions.Set(machineCtx.GetVSphereMachine(), metav1.Condition{

controllers/vspheremachine_controller_test.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,13 @@ var _ = Describe("VsphereMachineReconciler", func() {
105105
},
106106
Spec: clusterv1.MachineSpec{
107107
ClusterName: capiCluster.Name,
108+
Bootstrap: clusterv1.Bootstrap{
109+
ConfigRef: &clusterv1.ContractVersionedObjectReference{
110+
APIGroup: "bootstrap.cluster.x-k8s.io",
111+
Kind: "BootstrapConfig",
112+
Name: "does-no-ext", // Does not have to exist for these tests.
113+
},
114+
},
108115
InfrastructureRef: clusterv1.ContractVersionedObjectReference{
109116
APIGroup: "infrastructure.cluster.x-k8s.io",
110117
Kind: "VSphereMachine",
@@ -168,7 +175,7 @@ var _ = Describe("VsphereMachineReconciler", func() {
168175
if capiCluster.Status.Initialization == nil {
169176
capiCluster.Status.Initialization = &clusterv1.ClusterInitializationStatus{}
170177
}
171-
capiCluster.Status.Initialization.InfrastructureProvisioned = true
178+
capiCluster.Status.Initialization.InfrastructureProvisioned = ptr.To(true)
172179
return ph.Patch(ctx, capiCluster, patch.WithStatusObservedGeneration{})
173180
}, timeout).Should(Succeed())
174181

@@ -184,7 +191,7 @@ var _ = Describe("VsphereMachineReconciler", func() {
184191
if capiCluster.Status.Initialization == nil {
185192
capiCluster.Status.Initialization = &clusterv1.ClusterInitializationStatus{}
186193
}
187-
capiCluster.Status.Initialization.InfrastructureProvisioned = true
194+
capiCluster.Status.Initialization.InfrastructureProvisioned = ptr.To(true)
188195
Expect(ph.Patch(ctx, capiCluster, patch.WithStatusObservedGeneration{})).To(Succeed())
189196
})
190197

@@ -280,6 +287,7 @@ func Test_machineReconciler_Metadata(t *testing.T) {
280287
},
281288
Spec: clusterv1.MachineSpec{
282289
ClusterName: capiCluster.Name,
290+
Bootstrap: clusterv1.Bootstrap{DataSecretName: ptr.To("data")},
283291
InfrastructureRef: clusterv1.ContractVersionedObjectReference{
284292
APIGroup: "infrastructure.cluster.x-k8s.io",
285293
Kind: "VSphereMachine",

controllers/vspherevm_controller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,10 @@ func (r vmReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.R
234234
}
235235

236236
var vsphereFailureDomain *infrav1.VSphereFailureDomain
237-
if failureDomain := machine.Spec.FailureDomain; failureDomain != nil {
237+
if failureDomain := machine.Spec.FailureDomain; failureDomain != "" {
238238
vsphereDeploymentZone := &infrav1.VSphereDeploymentZone{}
239-
if err := r.Client.Get(ctx, apitypes.NamespacedName{Name: *failureDomain}, vsphereDeploymentZone); err != nil {
240-
return reconcile.Result{}, errors.Wrapf(err, "failed to get VSphereDeploymentZone %s", *failureDomain)
239+
if err := r.Client.Get(ctx, apitypes.NamespacedName{Name: failureDomain}, vsphereDeploymentZone); err != nil {
240+
return reconcile.Result{}, errors.Wrapf(err, "failed to get VSphereDeploymentZone %s", failureDomain)
241241
}
242242

243243
vsphereFailureDomain = &infrav1.VSphereFailureDomain{}

controllers/vspherevm_controller_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
apierrors "k8s.io/apimachinery/pkg/api/errors"
3030
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3131
apirecord "k8s.io/client-go/tools/record"
32+
"k8s.io/utils/ptr"
3233
clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2"
3334
ipamv1beta1 "sigs.k8s.io/cluster-api/api/ipam/v1beta1"
3435
"sigs.k8s.io/cluster-api/controllers/clustercache"
@@ -93,7 +94,7 @@ func TestReconcileNormal_WaitingForIPAddrAllocation(t *testing.T) {
9394
},
9495
Status: clusterv1.ClusterStatus{
9596
Initialization: &clusterv1.ClusterInitializationStatus{
96-
InfrastructureProvisioned: true,
97+
InfrastructureProvisioned: ptr.To(true),
9798
},
9899
},
99100
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module sigs.k8s.io/cluster-api-provider-vsphere
22

33
go 1.24.0
44

5-
replace sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.11.0-alpha.2
5+
replace sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.11.0-alpha.2.0.20250707091926-afb1afee283a
66

77
replace github.com/vmware-tanzu/vm-operator/pkg/constants/testlabels => github.com/vmware-tanzu/vm-operator/pkg/constants/testlabels v0.0.0-20240404200847-de75746a9505
88

0 commit comments

Comments
 (0)