Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-0.20] Skip bundles override for e2e-test when upgrade is from latest minor release #8860

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 21 additions & 11 deletions test/e2e/vsphere_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4497,11 +4497,12 @@ func TestVSphereKubernetes127UbuntuTo128UpgradeWithCheckpoint(t *testing.T) {

func TestVSphereKubernetes127RedhatUpgradeFromLatestMinorRelease(t *testing.T) {
release := latestMinorRelease(t)
useBundlesOverride := false
provider := framework.NewVSphere(t,
framework.WithVSphereFillers(
api.WithOsFamilyForAllMachines(v1alpha1.RedHat),
),
framework.WithKubeVersionAndOSForRelease(v1alpha1.Kube127, framework.RedHat8, release),
framework.WithKubeVersionAndOSForRelease(v1alpha1.Kube127, framework.RedHat8, release, useBundlesOverride),
)
test := framework.NewClusterE2ETest(
t,
Expand All @@ -4528,11 +4529,12 @@ func TestVSphereKubernetes126WithOIDCManagementClusterUpgradeFromLatestSideEffec

func TestVSphereKubernetes126To127UbuntuUpgradeFromLatestMinorRelease(t *testing.T) {
release := latestMinorRelease(t)
useBundlesOverride := false
provider := framework.NewVSphere(t,
framework.WithVSphereFillers(
api.WithOsFamilyForAllMachines(v1alpha1.Ubuntu),
),
framework.WithKubeVersionAndOSForRelease(v1alpha1.Kube126, framework.Ubuntu2004, release),
framework.WithKubeVersionAndOSForRelease(v1alpha1.Kube126, framework.Ubuntu2004, release, useBundlesOverride),
)
test := framework.NewClusterE2ETest(
t,
Expand All @@ -4555,11 +4557,12 @@ func TestVSphereKubernetes126To127UbuntuUpgradeFromLatestMinorRelease(t *testing

func TestVSphereKubernetes127To128UbuntuUpgradeFromLatestMinorRelease(t *testing.T) {
release := latestMinorRelease(t)
useBundlesOverride := false
provider := framework.NewVSphere(t,
framework.WithVSphereFillers(
api.WithOsFamilyForAllMachines(v1alpha1.Ubuntu),
),
framework.WithKubeVersionAndOSForRelease(v1alpha1.Kube127, framework.Ubuntu2004, release),
framework.WithKubeVersionAndOSForRelease(v1alpha1.Kube127, framework.Ubuntu2004, release, useBundlesOverride),
)
test := framework.NewClusterE2ETest(
t,
Expand All @@ -4582,11 +4585,12 @@ func TestVSphereKubernetes127To128UbuntuUpgradeFromLatestMinorRelease(t *testing

func TestVSphereKubernetes128To129UbuntuUpgradeFromLatestMinorRelease(t *testing.T) {
release := latestMinorRelease(t)
useBundlesOverride := false
provider := framework.NewVSphere(t,
framework.WithVSphereFillers(
api.WithOsFamilyForAllMachines(v1alpha1.Ubuntu),
),
framework.WithKubeVersionAndOSForRelease(v1alpha1.Kube128, framework.Ubuntu2004, release),
framework.WithKubeVersionAndOSForRelease(v1alpha1.Kube128, framework.Ubuntu2004, release, useBundlesOverride),
)
test := framework.NewClusterE2ETest(
t,
Expand All @@ -4609,11 +4613,12 @@ func TestVSphereKubernetes128To129UbuntuUpgradeFromLatestMinorRelease(t *testing

func TestVSphereKubernetes129To130UbuntuUpgradeFromLatestMinorRelease(t *testing.T) {
release := latestMinorRelease(t)
useBundlesOverride := false
provider := framework.NewVSphere(t,
framework.WithVSphereFillers(
api.WithOsFamilyForAllMachines(v1alpha1.Ubuntu),
),
framework.WithKubeVersionAndOSForRelease(v1alpha1.Kube129, framework.Ubuntu2004, release),
framework.WithKubeVersionAndOSForRelease(v1alpha1.Kube129, framework.Ubuntu2004, release, useBundlesOverride),
)
test := framework.NewClusterE2ETest(
t,
Expand All @@ -4636,12 +4641,13 @@ func TestVSphereKubernetes129To130UbuntuUpgradeFromLatestMinorRelease(t *testing

func TestVSphereKubernetes129To130UbuntuInPlaceUpgradeFromLatestMinorRelease(t *testing.T) {
release := latestMinorRelease(t)
useBundlesOverride := false
provider := framework.NewVSphere(
t,
framework.WithVSphereFillers(
api.WithOsFamilyForAllMachines(v1alpha1.Ubuntu),
),
framework.WithKubeVersionAndOSForRelease(v1alpha1.Kube129, framework.Ubuntu2004, release),
framework.WithKubeVersionAndOSForRelease(v1alpha1.Kube129, framework.Ubuntu2004, release, useBundlesOverride),
)
test := framework.NewClusterE2ETest(
t,
Expand Down Expand Up @@ -4711,11 +4717,12 @@ func TestVSphereKubernetes128BottlerocketAndRemoveWorkerNodeGroups(t *testing.T)

func TestVSphereKubernetes127To128RedhatUpgradeFromLatestMinorRelease(t *testing.T) {
release := latestMinorRelease(t)
useBundlesOverride := false
provider := framework.NewVSphere(t,
framework.WithVSphereFillers(
api.WithOsFamilyForAllMachines(v1alpha1.RedHat),
),
framework.WithKubeVersionAndOSForRelease(v1alpha1.Kube127, framework.RedHat8, release),
framework.WithKubeVersionAndOSForRelease(v1alpha1.Kube127, framework.RedHat8, release, useBundlesOverride),
)
test := framework.NewClusterE2ETest(
t,
Expand All @@ -4738,11 +4745,12 @@ func TestVSphereKubernetes127To128RedhatUpgradeFromLatestMinorRelease(t *testing

func TestVSphereKubernetes128To129RedhatUpgradeFromLatestMinorRelease(t *testing.T) {
release := latestMinorRelease(t)
useBundlesOverride := false
provider := framework.NewVSphere(t,
framework.WithVSphereFillers(
api.WithOsFamilyForAllMachines(v1alpha1.RedHat),
),
framework.WithKubeVersionAndOSForRelease(v1alpha1.Kube128, framework.RedHat8, release),
framework.WithKubeVersionAndOSForRelease(v1alpha1.Kube128, framework.RedHat8, release, useBundlesOverride),
)
test := framework.NewClusterE2ETest(
t,
Expand All @@ -4765,11 +4773,12 @@ func TestVSphereKubernetes128To129RedhatUpgradeFromLatestMinorRelease(t *testing

func TestVSphereKubernetes129To130RedhatUpgradeFromLatestMinorRelease(t *testing.T) {
release := latestMinorRelease(t)
useBundlesOverride := false
provider := framework.NewVSphere(t,
framework.WithVSphereFillers(
api.WithOsFamilyForAllMachines(v1alpha1.RedHat),
),
framework.WithKubeVersionAndOSForRelease(v1alpha1.Kube129, framework.RedHat8, release),
framework.WithKubeVersionAndOSForRelease(v1alpha1.Kube129, framework.RedHat8, release, useBundlesOverride),
)
test := framework.NewClusterE2ETest(
t,
Expand Down Expand Up @@ -4823,6 +4832,7 @@ func TestVSphereKubernetes130UbuntuUpgradeAndRemoveWorkerNodeGroupsAPI(t *testin
func TestVSphereKubernetes127to128UpgradeFromLatestMinorReleaseBottleRocketAPI(t *testing.T) {
release := latestMinorRelease(t)
provider := framework.NewVSphere(t)
useBundlesOverride := false
managementCluster := framework.NewClusterE2ETest(
t, provider,
)
Expand All @@ -4834,7 +4844,7 @@ func TestVSphereKubernetes127to128UpgradeFromLatestMinorReleaseBottleRocketAPI(t
api.VSphereToConfigFiller(
api.WithOsFamilyForAllMachines(v1alpha1.Bottlerocket),
),
provider.WithKubeVersionAndOSForRelease(v1alpha1.Kube127, framework.Bottlerocket1, release),
provider.WithKubeVersionAndOSForRelease(v1alpha1.Kube127, framework.Bottlerocket1, release, useBundlesOverride),
)

test := framework.NewMulticlusterE2ETest(t, managementCluster)
Expand All @@ -4850,7 +4860,7 @@ func TestVSphereKubernetes127to128UpgradeFromLatestMinorReleaseBottleRocketAPI(t
api.VSphereToConfigFiller(
api.WithOsFamilyForAllMachines(v1alpha1.Bottlerocket),
),
provider.WithKubeVersionAndOSForRelease(v1alpha1.Kube127, framework.Bottlerocket1, release),
provider.WithKubeVersionAndOSForRelease(v1alpha1.Kube127, framework.Bottlerocket1, release, useBundlesOverride),
)

test.WithWorkloadClusters(wc)
Expand Down
9 changes: 5 additions & 4 deletions test/framework/cloudstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,11 @@ func cloudStackMachineConfig(name string, fillers ...api.CloudStackMachineConfig
// templateForKubeVersionAndOS returns a CloudStack filler for the given OS and Kubernetes version.
func (c *CloudStack) templateForKubeVersionAndOS(kubeVersion anywherev1.KubernetesVersion, os OS, release *releasev1.EksARelease) api.CloudStackFiller {
var template string
useBundlesOverride := getBundlesOverride() == "true"
if release == nil {
template = c.templateForDevRelease(kubeVersion, os)
template = c.templateForDevRelease(kubeVersion, os, useBundlesOverride)
} else {
template = c.templatesRegistry.templateForRelease(c.t, release, kubeVersion, os)
template = c.templatesRegistry.templateForRelease(c.t, release, kubeVersion, os, useBundlesOverride)
}

return api.WithCloudStackTemplateForAllMachines(template)
Expand Down Expand Up @@ -511,9 +512,9 @@ func (c *CloudStack) getDevRelease() *releasev1.EksARelease {
return c.devRelease
}

func (c *CloudStack) templateForDevRelease(kubeVersion anywherev1.KubernetesVersion, os OS) string {
func (c *CloudStack) templateForDevRelease(kubeVersion anywherev1.KubernetesVersion, os OS, useBundlesOverride bool) string {
c.t.Helper()
return c.templatesRegistry.templateForRelease(c.t, c.getDevRelease(), kubeVersion, os)
return c.templatesRegistry.templateForRelease(c.t, c.getDevRelease(), kubeVersion, os, useBundlesOverride)
}

// envVarForTemplate Looks for explicit configuration through an env var: "T_CLOUDSTACK_TEMPLATE_{osFamily}_{eks-d version}"
Expand Down
12 changes: 7 additions & 5 deletions test/framework/nutanix.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,8 @@ func WithRedHat9Kubernetes130Nutanix() NutanixOpt {
// to use this OS family.
func withNutanixKubeVersionAndOSForUUID(kubeVersion anywherev1.KubernetesVersion, os OS, release *releasev1.EksARelease) NutanixOpt {
return func(n *Nutanix) {
name := n.templateForDevRelease(kubeVersion, os)
useBundlesOverride := getBundlesOverride() == "true"
name := n.templateForDevRelease(kubeVersion, os, useBundlesOverride)
n.fillers = append(n.fillers, n.withNutanixUUID(name, osFamiliesForOS[os])...)
}
}
Expand Down Expand Up @@ -449,10 +450,11 @@ func WithNutanixSubnetUUID() NutanixOpt {
// templateForKubeVersionAndOS returns a Nutanix filler for the given OS and Kubernetes version.
func (n *Nutanix) templateForKubeVersionAndOS(kubeVersion anywherev1.KubernetesVersion, os OS, release *releasev1.EksARelease) api.NutanixFiller {
var template string
useBundlesOverride := getBundlesOverride() == "true"
if release == nil {
template = n.templateForDevRelease(kubeVersion, os)
template = n.templateForDevRelease(kubeVersion, os, useBundlesOverride)
} else {
template = n.templatesRegistry.templateForRelease(n.t, release, kubeVersion, os)
template = n.templatesRegistry.templateForRelease(n.t, release, kubeVersion, os, useBundlesOverride)
}
return api.WithNutanixMachineTemplateImageName(template)
}
Expand Down Expand Up @@ -566,9 +568,9 @@ func (n *Nutanix) getDevRelease() *releasev1.EksARelease {
return n.devRelease
}

func (n *Nutanix) templateForDevRelease(kubeVersion anywherev1.KubernetesVersion, os OS) string {
func (n *Nutanix) templateForDevRelease(kubeVersion anywherev1.KubernetesVersion, os OS, useBundlesOverride bool) string {
n.t.Helper()
return n.templatesRegistry.templateForRelease(n.t, n.getDevRelease(), kubeVersion, os)
return n.templatesRegistry.templateForRelease(n.t, n.getDevRelease(), kubeVersion, os, useBundlesOverride)
}

// envVarForTemplate looks for explicit configuration through an env var: "T_NUTANIX_TEMPLATE_{osFamily}_{eks-d version}"
Expand Down
4 changes: 2 additions & 2 deletions test/framework/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ type templateRegistry struct {
// 3. If the template doesn't exist, default to the value of the default template env vars: eg. "T_CLOUDSTACK_TEMPLATE_REDHAT_1_23".
// This is a catch all condition. Mostly for edge cases where the bundle has been updated with a new eks-d version, but the
// the new template hasn't been imported yet. It also preserves backwards compatibility.
func (tc *templateRegistry) templateForRelease(t *testing.T, release *releasev1.EksARelease, kubeVersion anywherev1.KubernetesVersion, operatingSystem OS) string {
func (tc *templateRegistry) templateForRelease(t *testing.T, release *releasev1.EksARelease, kubeVersion anywherev1.KubernetesVersion, operatingSystem OS, useBundlesOverride bool) string {
t.Helper()
versionsBundle := readVersionsBundles(t, release, kubeVersion)
versionsBundle := readVersionsBundles(t, release, kubeVersion, useBundlesOverride)
eksDName := versionsBundle.EksD.Name

templateEnvVarName := tc.generator.envVarForTemplate(operatingSystem, eksDName)
Expand Down
28 changes: 15 additions & 13 deletions test/framework/vsphere.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,17 +460,19 @@ func (v *VSphere) WithNewVSphereWorkerNodeGroup(name string, workerNodeGroup *Wo
// templateForKubeVersionAndOS returns a vSphere filler for the given OS and Kubernetes version.
func (v *VSphere) templateForKubeVersionAndOS(kubeVersion anywherev1.KubernetesVersion, os OS, release *releasev1.EksARelease) api.VSphereFiller {
var template string
useBundlesOverride := getBundlesOverride() == "true"
if release == nil {
template = v.templateForDevRelease(kubeVersion, os)
template = v.templateForDevRelease(kubeVersion, os, useBundlesOverride)
} else {
template = v.templatesRegistry.templateForRelease(v.t, release, kubeVersion, os)
template = v.templatesRegistry.templateForRelease(v.t, release, kubeVersion, os, useBundlesOverride)
}
return api.WithTemplateForAllMachines(template)
}

// templateForKubeVersionAndOSMachineConfig returns a vSphere filler for the given OS and Kubernetes version for a specific machine config.
func (v *VSphere) templateForKubeVersionAndOSMachineConfig(name string, kubeVersion anywherev1.KubernetesVersion, os OS) api.VSphereFiller {
template := v.templateForDevRelease(kubeVersion, os)
useBundlesOverride := getBundlesOverride() == "true"
template := v.templateForDevRelease(kubeVersion, os, useBundlesOverride)
return api.WithMachineTemplate(name, template)
}

Expand Down Expand Up @@ -588,9 +590,9 @@ func (v *VSphere) getDevRelease() *releasev1.EksARelease {
return v.devRelease
}

func (v *VSphere) templateForDevRelease(kubeVersion anywherev1.KubernetesVersion, os OS) string {
func (v *VSphere) templateForDevRelease(kubeVersion anywherev1.KubernetesVersion, os OS, useBundlesOverride bool) string {
v.t.Helper()
return v.templatesRegistry.templateForRelease(v.t, v.getDevRelease(), kubeVersion, os)
return v.templatesRegistry.templateForRelease(v.t, v.getDevRelease(), kubeVersion, os, useBundlesOverride)
}

func RequiredVsphereEnvVars() []string {
Expand Down Expand Up @@ -631,22 +633,22 @@ func buildVSphereWorkerNodeGroupClusterFiller(machineConfigName string, workerNo

// WithKubeVersionAndOSForRelease returns a vSphereOpt that sets the cluster kube version and the right template for all
// vsphere machine configs based on the EKS-A release.
func WithKubeVersionAndOSForRelease(kubeVersion anywherev1.KubernetesVersion, os OS, release *releasev1.EksARelease) VSphereOpt {
return optionToSetTemplateForRelease(kubeVersion, os, release)
func WithKubeVersionAndOSForRelease(kubeVersion anywherev1.KubernetesVersion, os OS, release *releasev1.EksARelease, useBundlesOverride bool) VSphereOpt {
return optionToSetTemplateForRelease(kubeVersion, os, release, useBundlesOverride)
}

// WithKubeVersionAndOSForRelease returns a cluster config filler that sets the cluster kube version and the right template for all
// vsphere machine configs based on the EKS-A release.
func (v *VSphere) WithKubeVersionAndOSForRelease(kubeVersion anywherev1.KubernetesVersion, os OS, release *releasev1.EksARelease) api.ClusterConfigFiller {
func (v *VSphere) WithKubeVersionAndOSForRelease(kubeVersion anywherev1.KubernetesVersion, os OS, release *releasev1.EksARelease, useBundlesOverride bool) api.ClusterConfigFiller {
return api.VSphereToConfigFiller(
api.WithTemplateForAllMachines(v.templatesRegistry.templateForRelease(v.t, release, kubeVersion, os)),
api.WithTemplateForAllMachines(v.templatesRegistry.templateForRelease(v.t, release, kubeVersion, os, useBundlesOverride)),
)
}

func optionToSetTemplateForRelease(kubeVersion anywherev1.KubernetesVersion, os OS, release *releasev1.EksARelease) VSphereOpt {
func optionToSetTemplateForRelease(kubeVersion anywherev1.KubernetesVersion, os OS, release *releasev1.EksARelease, useBundlesOverride bool) VSphereOpt {
return func(v *VSphere) {
v.fillers = append(v.fillers,
api.WithTemplateForAllMachines(v.templatesRegistry.templateForRelease(v.t, release, kubeVersion, os)),
api.WithTemplateForAllMachines(v.templatesRegistry.templateForRelease(v.t, release, kubeVersion, os, useBundlesOverride)),
)
}
}
Expand Down Expand Up @@ -686,11 +688,11 @@ func (v *VSphere) searchTemplate(ctx context.Context, template string) (string,
return foundTemplate, nil
}

func readVersionsBundles(t testing.TB, release *releasev1.EksARelease, kubeVersion anywherev1.KubernetesVersion) *releasev1.VersionsBundle {
func readVersionsBundles(t testing.TB, release *releasev1.EksARelease, kubeVersion anywherev1.KubernetesVersion, useBundlesOverride bool) *releasev1.VersionsBundle {
reader := newFileReader()
var allBundles *releasev1.Bundles
var err error
if getBundlesOverride() == "true" {
if useBundlesOverride {
allBundles, err = bundles.Read(reader, defaultBundleReleaseManifestFile)
if err != nil {
t.Fatal(err)
Expand Down
Loading