Skip to content

Commit eecabe4

Browse files
authored
Merge pull request #6201 from cpanato/upgrade-k8s-update
🌱 e2e: add option to configure both control-plane and workers machine template for k8s upgrade tests
2 parents 72cd893 + 04b1e36 commit eecabe4

File tree

2 files changed

+25
-15
lines changed

2 files changed

+25
-15
lines changed

test/e2e/cluster_upgrade.go

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,18 +154,27 @@ func ClusterUpgradeConformanceSpec(ctx context.Context, inputGetter func() Clust
154154
} else {
155155
// Cluster is not using ClusterClass, upgrade via individual resources.
156156
By("Upgrading the Kubernetes control-plane")
157-
var upgradeMachineTemplateTo *string
158-
if input.E2EConfig.HasVariable(MachineTemplateUpgradeTo) {
159-
upgradeMachineTemplateTo = pointer.StringPtr(input.E2EConfig.GetVariable(MachineTemplateUpgradeTo))
157+
var (
158+
upgradeCPMachineTemplateTo *string
159+
upgradeWorkersMachineTemplateTo *string
160+
)
161+
162+
if input.E2EConfig.HasVariable(CPMachineTemplateUpgradeTo) {
163+
upgradeCPMachineTemplateTo = pointer.StringPtr(input.E2EConfig.GetVariable(CPMachineTemplateUpgradeTo))
160164
}
165+
166+
if input.E2EConfig.HasVariable(WorkersMachineTemplateUpgradeTo) {
167+
upgradeWorkersMachineTemplateTo = pointer.StringPtr(input.E2EConfig.GetVariable(WorkersMachineTemplateUpgradeTo))
168+
}
169+
161170
framework.UpgradeControlPlaneAndWaitForUpgrade(ctx, framework.UpgradeControlPlaneAndWaitForUpgradeInput{
162171
ClusterProxy: input.BootstrapClusterProxy,
163172
Cluster: clusterResources.Cluster,
164173
ControlPlane: clusterResources.ControlPlane,
165174
EtcdImageTag: input.E2EConfig.GetVariable(EtcdVersionUpgradeTo),
166175
DNSImageTag: input.E2EConfig.GetVariable(CoreDNSVersionUpgradeTo),
167176
KubernetesUpgradeVersion: input.E2EConfig.GetVariable(KubernetesVersionUpgradeTo),
168-
UpgradeMachineTemplate: upgradeMachineTemplateTo,
177+
UpgradeMachineTemplate: upgradeCPMachineTemplateTo,
169178
WaitForMachinesToBeUpgraded: input.E2EConfig.GetIntervals(specName, "wait-machine-upgrade"),
170179
WaitForKubeProxyUpgrade: input.E2EConfig.GetIntervals(specName, "wait-machine-upgrade"),
171180
WaitForDNSUpgrade: input.E2EConfig.GetIntervals(specName, "wait-machine-upgrade"),
@@ -178,7 +187,7 @@ func ClusterUpgradeConformanceSpec(ctx context.Context, inputGetter func() Clust
178187
ClusterProxy: input.BootstrapClusterProxy,
179188
Cluster: clusterResources.Cluster,
180189
UpgradeVersion: input.E2EConfig.GetVariable(KubernetesVersionUpgradeTo),
181-
UpgradeMachineTemplate: upgradeMachineTemplateTo,
190+
UpgradeMachineTemplate: upgradeWorkersMachineTemplateTo,
182191
MachineDeployments: clusterResources.MachineDeployments,
183192
WaitForMachinesToBeUpgraded: input.E2EConfig.GetIntervals(specName, "wait-worker-nodes"),
184193
})

test/e2e/common.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,17 @@ import (
3333

3434
// Test suite constants for e2e config variables.
3535
const (
36-
KubernetesVersionManagement = "KUBERNETES_VERSION_MANAGEMENT"
37-
KubernetesVersion = "KUBERNETES_VERSION"
38-
CNIPath = "CNI"
39-
CNIResources = "CNI_RESOURCES"
40-
KubernetesVersionUpgradeFrom = "KUBERNETES_VERSION_UPGRADE_FROM"
41-
KubernetesVersionUpgradeTo = "KUBERNETES_VERSION_UPGRADE_TO"
42-
MachineTemplateUpgradeTo = "MACHINE_TEMPLATE_UPGRADE_TO"
43-
EtcdVersionUpgradeTo = "ETCD_VERSION_UPGRADE_TO"
44-
CoreDNSVersionUpgradeTo = "COREDNS_VERSION_UPGRADE_TO"
45-
IPFamily = "IP_FAMILY"
36+
KubernetesVersionManagement = "KUBERNETES_VERSION_MANAGEMENT"
37+
KubernetesVersion = "KUBERNETES_VERSION"
38+
CNIPath = "CNI"
39+
CNIResources = "CNI_RESOURCES"
40+
KubernetesVersionUpgradeFrom = "KUBERNETES_VERSION_UPGRADE_FROM"
41+
KubernetesVersionUpgradeTo = "KUBERNETES_VERSION_UPGRADE_TO"
42+
CPMachineTemplateUpgradeTo = "CONTROL_PLANE_MACHINE_TEMPLATE_UPGRADE_TO"
43+
WorkersMachineTemplateUpgradeTo = "WORKERS_MACHINE_TEMPLATE_UPGRADE_TO"
44+
EtcdVersionUpgradeTo = "ETCD_VERSION_UPGRADE_TO"
45+
CoreDNSVersionUpgradeTo = "COREDNS_VERSION_UPGRADE_TO"
46+
IPFamily = "IP_FAMILY"
4647
)
4748

4849
func Byf(format string, a ...interface{}) {

0 commit comments

Comments
 (0)