Skip to content

Commit

Permalink
Add E2E tests for modular upgrade for bare-metal provider
Browse files Browse the repository at this point in the history
Signed-off-by: Rahul Ganesh <[email protected]>
  • Loading branch information
Rahul Ganesh authored and eks-distro-pr-bot committed Oct 24, 2023
1 parent 90bb25a commit a577cd8
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 26 deletions.
16 changes: 11 additions & 5 deletions test/e2e/tinkerbell_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,20 @@ func TestTinkerbellKubernetes127UbuntuTo128Upgrade(t *testing.T) {
}

func TestTinkerbellKubernetes127UbuntuTo128UpgradeCPOnly(t *testing.T) {
provider := framework.NewTinkerbell(t, framework.WithUbuntu127TinkerbellForCP(), framework.WithUbuntu127TinkerbellForWorker())
provider := framework.NewTinkerbell(t)
kube127 := v1alpha1.Kube127
test := framework.NewClusterE2ETest(
t,
provider,
framework.WithClusterFiller(api.WithKubernetesVersion(kube127)),
framework.WithClusterFiller(api.WithControlPlaneCount(1)),
framework.WithClusterFiller(api.WithWorkerNodeCount(1)),
framework.WithClusterFiller(api.WithWorkerKubernetesVersion(worker0, &kube127)),
framework.WithClusterFiller(api.WithWorkerKubernetesVersion(nodeGroupLabel1, &kube127)),
framework.WithControlPlaneHardware(2),
framework.WithWorkerHardware(1),
).WithClusterConfig(
provider.WithCPKubeVersionAndOS(v1alpha1.Kube127, framework.Ubuntu2004),
provider.WithWorkerKubeVersionAndOS(v1alpha1.Kube127, framework.Ubuntu2004),
)
runSimpleUpgradeFlowWorkerNodeVersionForBareMetal(
test,
Expand All @@ -140,7 +143,7 @@ func TestTinkerbellKubernetes127UbuntuTo128UpgradeCPOnly(t *testing.T) {
}

func TestTinkerbellKubernetes127UbuntuTo128UpgradeWorkerOnly(t *testing.T) {
provider := framework.NewTinkerbell(t, framework.WithUbuntu128TinkerbellForCP(), framework.WithUbuntu127TinkerbellForWorker())
provider := framework.NewTinkerbell(t)
kube127 := v1alpha1.Kube127
kube128 := v1alpha1.Kube128
test := framework.NewClusterE2ETest(
Expand All @@ -150,13 +153,16 @@ func TestTinkerbellKubernetes127UbuntuTo128UpgradeWorkerOnly(t *testing.T) {
framework.WithClusterFiller(api.WithKubernetesVersion(kube128)),
framework.WithClusterFiller(api.WithControlPlaneCount(1)),
framework.WithClusterFiller(api.WithWorkerNodeCount(1)),
framework.WithClusterFiller(api.WithWorkerKubernetesVersion(worker0, &kube127)),
framework.WithClusterFiller(api.WithWorkerKubernetesVersion(nodeGroupLabel1, &kube127)),
framework.WithControlPlaneHardware(1),
framework.WithWorkerHardware(2),
).WithClusterConfig(
provider.WithCPKubeVersionAndOS(v1alpha1.Kube128, framework.Ubuntu2004),
provider.WithWorkerKubeVersionAndOS(v1alpha1.Kube127, framework.Ubuntu2004),
)
runSimpleUpgradeFlowWorkerNodeVersionForBareMetal(
test,
framework.WithClusterUpgrade(api.WithWorkerKubernetesVersion(worker0, &kube128)),
framework.WithClusterUpgrade(api.WithWorkerKubernetesVersion(nodeGroupLabel1, &kube128)),
provider.WithProviderUpgrade(framework.Ubuntu128ImageForWorker()),
)
}
Expand Down
1 change: 0 additions & 1 deletion test/e2e/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ func runSimpleUpgradeFlowForBareMetal(test *framework.ClusterE2ETest, updateVers
}

func runSimpleUpgradeFlowWorkerNodeVersionForBareMetal(test *framework.ClusterE2ETest, clusterOpts ...framework.ClusterE2ETestOpt) {
test.GenerateClusterConfig()
test.GenerateHardwareConfig()
test.PowerOffHardware()
test.CreateCluster(framework.WithControlPlaneWaitTimeout("20m"))
Expand Down
40 changes: 20 additions & 20 deletions test/framework/tinkerbell.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,26 @@ func (t *Tinkerbell) WithKubeVersionAndOS(kubeVersion anywherev1.KubernetesVersi
)
}

// WithCPKubeVersionAndOS returns a cluster config filler that sets the cluster kube version and the right image for CP
// tinkerbell machine configs.
func (t *Tinkerbell) WithCPKubeVersionAndOS(kubeVersion anywherev1.KubernetesVersion, os OS) api.ClusterConfigFiller {
return api.JoinClusterConfigFillers(
api.TinkerbellToConfigFiller(
imageForKubeVersionAndOS(kubeVersion, os, controlPlaneIdentifier),
),
)
}

// WithWorkerKubeVersionAndOS returns a cluster config filler that sets the cluster kube version and the right image for all
// Worker tinkerbell machine configs.
func (t *Tinkerbell) WithWorkerKubeVersionAndOS(kubeVersion anywherev1.KubernetesVersion, os OS) api.ClusterConfigFiller {
return api.JoinClusterConfigFillers(
api.TinkerbellToConfigFiller(
imageForKubeVersionAndOS(kubeVersion, os, workerIdentifier),
),
)
}

// WithNewWorkerNodeGroup returns an api.ClusterFiller that adds a new workerNodeGroupConfiguration and
// a corresponding TinkerbellMachineConfig to the cluster config.
func (t *Tinkerbell) WithNewWorkerNodeGroup(name string, workerNodeGroup *WorkerNodeGroup) api.ClusterConfigFiller {
Expand Down Expand Up @@ -211,26 +231,6 @@ func WithUbuntu128Tinkerbell() TinkerbellOpt {
return withKubeVersionAndOS(anywherev1.Kube128, Ubuntu2004, "", nil)
}

// WithUbuntu127TinkerbellForCP tink test with ubuntu 1.27 for Control Plane Machine Config.
func WithUbuntu127TinkerbellForCP() TinkerbellOpt {
return withKubeVersionAndOS(anywherev1.Kube127, Ubuntu2004, controlPlaneIdentifier, nil)
}

// WithUbuntu128TinkerbellForCP tink test with ubuntu 1.28 for Control Plane Machine Config.
func WithUbuntu128TinkerbellForCP() TinkerbellOpt {
return withKubeVersionAndOS(anywherev1.Kube128, Ubuntu2004, controlPlaneIdentifier, nil)
}

// WithUbuntu127TinkerbellForWorker tink test with ubuntu 1.27 for Worker Node Group Machine Config.
func WithUbuntu127TinkerbellForWorker() TinkerbellOpt {
return withKubeVersionAndOS(anywherev1.Kube127, Ubuntu2004, workerIdentifier, nil)
}

// WithUbuntu128TinkerbellForWorker tink test with ubuntu 1.28 for Worker Node Group Machine Config.
func WithUbuntu128TinkerbellForWorker() TinkerbellOpt {
return withKubeVersionAndOS(anywherev1.Kube128, Ubuntu2004, workerIdentifier, nil)
}

// WithRedHat124Tinkerbell tink test with redhat 1.24.
func WithRedHat124Tinkerbell() TinkerbellOpt {
return withKubeVersionAndOS(anywherev1.Kube124, RedHat8, "", nil)
Expand Down

0 comments on commit a577cd8

Please sign in to comment.