@@ -130,6 +130,9 @@ type ClusterctlUpgradeSpecInput struct {
130
130
// If not set, the test will upgrade once to the v1beta1 contract.
131
131
// For some examples see clusterctl_upgrade_test.go
132
132
Upgrades []ClusterctlUpgradeSpecInputUpgrade
133
+
134
+ // ControlPlaneMachineCount specifies the number of control plane machines to create in the workload cluster.
135
+ ControlPlaneMachineCount * int64
133
136
}
134
137
135
138
// ClusterctlUpgradeSpecInputUpgrade defines an upgrade.
@@ -388,6 +391,11 @@ func ClusterctlUpgradeSpec(ctx context.Context, inputGetter func() ClusterctlUpg
388
391
kubernetesVersion = input .E2EConfig .GetVariable (KubernetesVersion )
389
392
}
390
393
controlPlaneMachineCount := ptr.To [int64 ](1 )
394
+
395
+ // Don't set controlPlaneMachineCount to 0 to satisfy the validation in the cluster template.
396
+ if input .ControlPlaneMachineCount != nil && * input .ControlPlaneMachineCount != int64 (0 ) {
397
+ controlPlaneMachineCount = input .ControlPlaneMachineCount
398
+ }
391
399
workerMachineCount := ptr.To [int64 ](1 )
392
400
393
401
log .Logf ("Creating the workload cluster with name %q using the %q template (Kubernetes %s, %d control-plane machines, %d worker machines)" ,
@@ -436,6 +444,11 @@ func ClusterctlUpgradeSpec(ctx context.Context, inputGetter func() ClusterctlUpg
436
444
expectedMachinePoolNodeCount := calculateExpectedMachinePoolNodeCount (ctx , managementClusterProxy .GetClient (), workloadClusterUnstructured , coreCAPIStorageVersion )
437
445
expectedMachinePoolMachineCount , err := calculateExpectedMachinePoolMachineCount (ctx , managementClusterProxy .GetClient (), workloadClusterNamespace , workloadClusterName )
438
446
Expect (err ).ToNot (HaveOccurred ())
447
+
448
+ // Account for clusters that have a control plane count of 0.
449
+ if input .ControlPlaneMachineCount != nil && * input .ControlPlaneMachineCount == int64 (0 ) {
450
+ controlPlaneMachineCount = input .ControlPlaneMachineCount
451
+ }
439
452
expectedMachineCount := * controlPlaneMachineCount + expectedMachineDeploymentMachineCount + expectedMachinePoolMachineCount
440
453
441
454
Byf ("Expect %d Machines and %d MachinePool replicas to exist" , expectedMachineCount , expectedMachinePoolNodeCount )
0 commit comments