Skip to content

Commit

Permalink
Merge pull request kubernetes-sigs#6201 from cpanato/upgrade-k8s-update
Browse files Browse the repository at this point in the history
🌱 e2e: add option to configure both control-plane and workers machine template for k8s upgrade tests
  • Loading branch information
k8s-ci-robot authored Mar 2, 2022
2 parents 72cd893 + 04b1e36 commit eecabe4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
19 changes: 14 additions & 5 deletions test/e2e/cluster_upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,18 +154,27 @@ func ClusterUpgradeConformanceSpec(ctx context.Context, inputGetter func() Clust
} else {
// Cluster is not using ClusterClass, upgrade via individual resources.
By("Upgrading the Kubernetes control-plane")
var upgradeMachineTemplateTo *string
if input.E2EConfig.HasVariable(MachineTemplateUpgradeTo) {
upgradeMachineTemplateTo = pointer.StringPtr(input.E2EConfig.GetVariable(MachineTemplateUpgradeTo))
var (
upgradeCPMachineTemplateTo *string
upgradeWorkersMachineTemplateTo *string
)

if input.E2EConfig.HasVariable(CPMachineTemplateUpgradeTo) {
upgradeCPMachineTemplateTo = pointer.StringPtr(input.E2EConfig.GetVariable(CPMachineTemplateUpgradeTo))
}

if input.E2EConfig.HasVariable(WorkersMachineTemplateUpgradeTo) {
upgradeWorkersMachineTemplateTo = pointer.StringPtr(input.E2EConfig.GetVariable(WorkersMachineTemplateUpgradeTo))
}

framework.UpgradeControlPlaneAndWaitForUpgrade(ctx, framework.UpgradeControlPlaneAndWaitForUpgradeInput{
ClusterProxy: input.BootstrapClusterProxy,
Cluster: clusterResources.Cluster,
ControlPlane: clusterResources.ControlPlane,
EtcdImageTag: input.E2EConfig.GetVariable(EtcdVersionUpgradeTo),
DNSImageTag: input.E2EConfig.GetVariable(CoreDNSVersionUpgradeTo),
KubernetesUpgradeVersion: input.E2EConfig.GetVariable(KubernetesVersionUpgradeTo),
UpgradeMachineTemplate: upgradeMachineTemplateTo,
UpgradeMachineTemplate: upgradeCPMachineTemplateTo,
WaitForMachinesToBeUpgraded: input.E2EConfig.GetIntervals(specName, "wait-machine-upgrade"),
WaitForKubeProxyUpgrade: input.E2EConfig.GetIntervals(specName, "wait-machine-upgrade"),
WaitForDNSUpgrade: input.E2EConfig.GetIntervals(specName, "wait-machine-upgrade"),
Expand All @@ -178,7 +187,7 @@ func ClusterUpgradeConformanceSpec(ctx context.Context, inputGetter func() Clust
ClusterProxy: input.BootstrapClusterProxy,
Cluster: clusterResources.Cluster,
UpgradeVersion: input.E2EConfig.GetVariable(KubernetesVersionUpgradeTo),
UpgradeMachineTemplate: upgradeMachineTemplateTo,
UpgradeMachineTemplate: upgradeWorkersMachineTemplateTo,
MachineDeployments: clusterResources.MachineDeployments,
WaitForMachinesToBeUpgraded: input.E2EConfig.GetIntervals(specName, "wait-worker-nodes"),
})
Expand Down
21 changes: 11 additions & 10 deletions test/e2e/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,17 @@ import (

// Test suite constants for e2e config variables.
const (
KubernetesVersionManagement = "KUBERNETES_VERSION_MANAGEMENT"
KubernetesVersion = "KUBERNETES_VERSION"
CNIPath = "CNI"
CNIResources = "CNI_RESOURCES"
KubernetesVersionUpgradeFrom = "KUBERNETES_VERSION_UPGRADE_FROM"
KubernetesVersionUpgradeTo = "KUBERNETES_VERSION_UPGRADE_TO"
MachineTemplateUpgradeTo = "MACHINE_TEMPLATE_UPGRADE_TO"
EtcdVersionUpgradeTo = "ETCD_VERSION_UPGRADE_TO"
CoreDNSVersionUpgradeTo = "COREDNS_VERSION_UPGRADE_TO"
IPFamily = "IP_FAMILY"
KubernetesVersionManagement = "KUBERNETES_VERSION_MANAGEMENT"
KubernetesVersion = "KUBERNETES_VERSION"
CNIPath = "CNI"
CNIResources = "CNI_RESOURCES"
KubernetesVersionUpgradeFrom = "KUBERNETES_VERSION_UPGRADE_FROM"
KubernetesVersionUpgradeTo = "KUBERNETES_VERSION_UPGRADE_TO"
CPMachineTemplateUpgradeTo = "CONTROL_PLANE_MACHINE_TEMPLATE_UPGRADE_TO"
WorkersMachineTemplateUpgradeTo = "WORKERS_MACHINE_TEMPLATE_UPGRADE_TO"
EtcdVersionUpgradeTo = "ETCD_VERSION_UPGRADE_TO"
CoreDNSVersionUpgradeTo = "COREDNS_VERSION_UPGRADE_TO"
IPFamily = "IP_FAMILY"
)

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

0 comments on commit eecabe4

Please sign in to comment.