diff --git a/test/e2e/airgap.go b/test/e2e/airgap.go index 875198733b01..f153d840b09e 100644 --- a/test/e2e/airgap.go +++ b/test/e2e/airgap.go @@ -15,7 +15,7 @@ import ( ) const ( - bottlerocketOSFileName = "bottlerocket.img.gz" + bottlerocketOSFileName = "bottlerocket" airgapUsername = "airgap" bundleReleasePathFromArtifacts = "./eks-anywhere-downloads/bundle-release.yaml" ) @@ -37,7 +37,7 @@ func runAirgapConfigFlow(test *framework.ClusterE2ETest, localCIDRs string) { test.DeleteCluster() } -func runTinkerbellAirgapConfigFlow(test *framework.ClusterE2ETest, localCIDRs string) { +func runTinkerbellAirgapConfigFlow(test *framework.ClusterE2ETest, localCIDRs, kubeVersion string) { test.DownloadArtifacts() test.ExtractDownloadedArtifacts() @@ -46,7 +46,7 @@ func runTinkerbellAirgapConfigFlow(test *framework.ClusterE2ETest, localCIDRs st test.T.Fatalf("Cannot read bundleRelease file: %v", err) } - server := downloadAndServeTinkerbellArtifacts(test.T, brContent) + server := downloadAndServeTinkerbellArtifacts(test.T, brContent, kubeVersion) defer server.Shutdown(context.Background()) test.GenerateClusterConfig() @@ -69,7 +69,7 @@ func runTinkerbellAirgapConfigFlow(test *framework.ClusterE2ETest, localCIDRs st test.ValidateHardwareDecommissioned() } -func runTinkerbellAirgapConfigProxyFlow(test *framework.ClusterE2ETest, localCIDRs string) { +func runTinkerbellAirgapConfigProxyFlow(test *framework.ClusterE2ETest, localCIDRs, kubeVersion string) { test.DownloadArtifacts() test.ExtractDownloadedArtifacts() // for testing proxy feature in an air gapped env @@ -79,7 +79,7 @@ func runTinkerbellAirgapConfigProxyFlow(test *framework.ClusterE2ETest, localCID test.T.Fatalf("Cannot read bundleRelease file: %v", err) } - server := downloadAndServeTinkerbellArtifacts(test.T, brContent) + server := downloadAndServeTinkerbellArtifacts(test.T, brContent, kubeVersion) defer server.Shutdown(context.Background()) test.GenerateClusterConfig() @@ -123,7 +123,7 @@ func downloadFile(url string, output string) error { return nil } -func downloadAndServeTinkerbellArtifacts(t framework.T, bundleRelease []byte) *http.Server { +func downloadAndServeTinkerbellArtifacts(t framework.T, bundleRelease []byte, kubeVersion string) *http.Server { initramfsUrl := regexp.MustCompile(`https://.*/hook/.*initramfs-x86_64`).Find(bundleRelease) if initramfsUrl == nil { t.Fatalf("Cannot find initramfsUrl from release bundle") @@ -134,7 +134,7 @@ func downloadAndServeTinkerbellArtifacts(t framework.T, bundleRelease []byte) *h t.Fatalf("Cannot find vmlinuzUrl from release bundle") } - brOsUrl := regexp.MustCompile(`https://.*/raw/1-24/.*bottlerocket.*amd64.img.gz`).Find(bundleRelease) + brOsUrl := regexp.MustCompile(fmt.Sprintf("https://.*/raw/%s/.*bottlerocket.*amd64.img.gz", kubeVersion)).Find(bundleRelease) if brOsUrl == nil { t.Fatalf("Cannot find bottlerocketOS url from release bundle") } @@ -158,7 +158,8 @@ func downloadAndServeTinkerbellArtifacts(t framework.T, bundleRelease []byte) *h } t.Logf("Download bottlerocket OS from %s", brOsUrl) - err = downloadFile(string(brOsUrl), dir+"/"+bottlerocketOSFileName) + // Save image file with kube version in the image name to satisfy condition to have kube version in the template name. + err = downloadFile(string(brOsUrl), dir+"/"+bottlerocketOSFileName+"-"+kubeVersion+".img.gz") if err != nil { t.Fatal(err) } diff --git a/test/e2e/tinkerbell_test.go b/test/e2e/tinkerbell_test.go index 66f794e5cea5..98a85ecdc064 100644 --- a/test/e2e/tinkerbell_test.go +++ b/test/e2e/tinkerbell_test.go @@ -5,6 +5,7 @@ package e2e import ( + "strings" "testing" corev1 "k8s.io/api/core/v1" @@ -2106,12 +2107,15 @@ func TestTinkerbellAirgappedKubernetes128BottleRocketRegistryMirror(t *testing.T } t.Logf("Admin machine's IP is: %s", localIp) + // Append kube version in the image name to satisfy condition to have kube version in the template name. + kubeVersion := strings.Replace(string(v1alpha1.Kube128), ".", "-", 1) + test := framework.NewClusterE2ETest( t, framework.NewTinkerbell(t, framework.WithBottleRocketTinkerbell(), framework.WithHookImagesURLPath("http://"+localIp.String()+":8080"), - framework.WithOSImageURL("http://"+localIp.String()+":8080/"+bottlerocketOSFileName), + framework.WithOSImageURL("http://"+localIp.String()+":8080/"+bottlerocketOSFileName+"-"+kubeVersion+".img.gz"), ), framework.WithClusterFiller( api.WithKubernetesVersion(v1alpha1.Kube128), @@ -2121,7 +2125,7 @@ func TestTinkerbellAirgappedKubernetes128BottleRocketRegistryMirror(t *testing.T framework.WithRegistryMirrorEndpointAndCert(constants.TinkerbellProviderName), ) - runTinkerbellAirgapConfigFlow(test, "10.80.0.0/16") + runTinkerbellAirgapConfigFlow(test, "10.80.0.0/16", kubeVersion) } // Proxy tests @@ -2133,6 +2137,8 @@ func TestTinkerbellAirgappedKubernetes128BottlerocketProxyConfigFlow(t *testing. } t.Logf("Admin machine's IP is: %s", localIp) + kubeVersion := strings.Replace(string(v1alpha1.Kube128), ".", "-", 1) + test := framework.NewClusterE2ETest( t, framework.NewTinkerbell(t, @@ -2147,7 +2153,7 @@ func TestTinkerbellAirgappedKubernetes128BottlerocketProxyConfigFlow(t *testing. framework.WithProxy(framework.TinkerbellProxyRequiredEnvVars), ) - runTinkerbellAirgapConfigProxyFlow(test, "10.80.0.0/16") + runTinkerbellAirgapConfigProxyFlow(test, "10.80.0.0/16", kubeVersion) } func TestTinkerbellAirgappedKubernetes128UbuntuProxyConfigFlow(t *testing.T) { @@ -2157,6 +2163,8 @@ func TestTinkerbellAirgappedKubernetes128UbuntuProxyConfigFlow(t *testing.T) { } t.Logf("Admin machine's IP is: %s", localIp) + kubeVersion := strings.Replace(string(v1alpha1.Kube128), ".", "-", 1) + test := framework.NewClusterE2ETest( t, framework.NewTinkerbell(t, @@ -2171,7 +2179,7 @@ func TestTinkerbellAirgappedKubernetes128UbuntuProxyConfigFlow(t *testing.T) { framework.WithProxy(framework.TinkerbellProxyRequiredEnvVars), ) - runTinkerbellAirgapConfigProxyFlow(test, "10.80.0.0/16") + runTinkerbellAirgapConfigProxyFlow(test, "10.80.0.0/16", kubeVersion) } // OOB test