Skip to content

Commit 1e13f44

Browse files
authored
Merge pull request #5926 from sbueringer/pr-fix-upgrade-test
🐛 test/e2e/cluster-upgrade: skip worker upgrades if worker count is 0
2 parents ad2be66 + d3ac6d0 commit 1e13f44

File tree

2 files changed

+23
-20
lines changed

2 files changed

+23
-20
lines changed

test/e2e/cluster_upgrade.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -167,19 +167,20 @@ func ClusterUpgradeConformanceSpec(ctx context.Context, inputGetter func() Clust
167167
WaitForEtcdUpgrade: input.E2EConfig.GetIntervals(specName, "wait-machine-upgrade"),
168168
})
169169

170-
By("Upgrading the machine deployment")
171-
framework.UpgradeMachineDeploymentsAndWait(ctx, framework.UpgradeMachineDeploymentsAndWaitInput{
172-
ClusterProxy: input.BootstrapClusterProxy,
173-
Cluster: clusterResources.Cluster,
174-
UpgradeVersion: input.E2EConfig.GetVariable(KubernetesVersionUpgradeTo),
175-
MachineDeployments: clusterResources.MachineDeployments,
176-
WaitForMachinesToBeUpgraded: input.E2EConfig.GetIntervals(specName, "wait-worker-nodes"),
177-
})
170+
if workerMachineCount > 0 {
171+
By("Upgrading the machine deployment")
172+
framework.UpgradeMachineDeploymentsAndWait(ctx, framework.UpgradeMachineDeploymentsAndWaitInput{
173+
ClusterProxy: input.BootstrapClusterProxy,
174+
Cluster: clusterResources.Cluster,
175+
UpgradeVersion: input.E2EConfig.GetVariable(KubernetesVersionUpgradeTo),
176+
MachineDeployments: clusterResources.MachineDeployments,
177+
WaitForMachinesToBeUpgraded: input.E2EConfig.GetIntervals(specName, "wait-worker-nodes"),
178+
})
179+
}
178180
}
179181

180-
// Only attempt to upgrade MachinePools if they were provided in the template,
181-
// also adjust the expected workerMachineCount if we have MachinePools
182-
if len(clusterResources.MachinePools) > 0 {
182+
// Only attempt to upgrade MachinePools if they were provided in the template.
183+
if len(clusterResources.MachinePools) > 0 && workerMachineCount > 0 {
183184
By("Upgrading the machinepool instances")
184185
framework.UpgradeMachinePoolAndWait(ctx, framework.UpgradeMachinePoolAndWaitInput{
185186
ClusterProxy: input.BootstrapClusterProxy,

test/framework/cluster_topology_helpers.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,16 @@ func UpgradeClusterTopologyAndWaitForUpgrade(ctx context.Context, input UpgradeC
130130
}, input.WaitForEtcdUpgrade...)
131131

132132
for _, deployment := range input.MachineDeployments {
133-
log.Logf("Waiting for Kubernetes versions of machines in MachineDeployment %s/%s to be upgraded to %s",
134-
deployment.Namespace, deployment.Name, input.KubernetesUpgradeVersion)
135-
WaitForMachineDeploymentMachinesToBeUpgraded(ctx, WaitForMachineDeploymentMachinesToBeUpgradedInput{
136-
Lister: mgmtClient,
137-
Cluster: input.Cluster,
138-
MachineCount: int(*deployment.Spec.Replicas),
139-
KubernetesUpgradeVersion: input.KubernetesUpgradeVersion,
140-
MachineDeployment: *deployment,
141-
}, input.WaitForMachinesToBeUpgraded...)
133+
if *deployment.Spec.Replicas > 0 {
134+
log.Logf("Waiting for Kubernetes versions of machines in MachineDeployment %s/%s to be upgraded to %s",
135+
deployment.Namespace, deployment.Name, input.KubernetesUpgradeVersion)
136+
WaitForMachineDeploymentMachinesToBeUpgraded(ctx, WaitForMachineDeploymentMachinesToBeUpgradedInput{
137+
Lister: mgmtClient,
138+
Cluster: input.Cluster,
139+
MachineCount: int(*deployment.Spec.Replicas),
140+
KubernetesUpgradeVersion: input.KubernetesUpgradeVersion,
141+
MachineDeployment: *deployment,
142+
}, input.WaitForMachinesToBeUpgraded...)
143+
}
142144
}
143145
}

0 commit comments

Comments
 (0)