Skip to content

Commit

Permalink
Add RHEL8 and RHEL9 fix for validation webhook and tests for Nutanix (#…
Browse files Browse the repository at this point in the history
…6822)

* Add RHEL8 and RHEL9 tests for Nutanix

 - add tests
 - add rhel8 and rhel9 template vars
 - add rhel9 constants
 - change NutanixMachineConfig validation

* Fix review comments

* Fix review comments
  • Loading branch information
adiantum authored Oct 19, 2023
1 parent f11dfd8 commit 0d8e817
Show file tree
Hide file tree
Showing 5 changed files with 510 additions and 25 deletions.
11 changes: 11 additions & 0 deletions cmd/integration_test/build/buildspecs/nutanix-test-eks-a-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ env:
T_NUTANIX_TEMPLATE_NAME_UBUNTU_1_26: "nutanix_ci:nutanix_template_ubuntu_1_26"
T_NUTANIX_TEMPLATE_NAME_UBUNTU_1_27: "nutanix_ci:nutanix_template_ubuntu_1_27"
T_NUTANIX_TEMPLATE_NAME_UBUNTU_1_28: "nutanix_ci:nutanix_template_ubuntu_1_28"
T_NUTANIX_TEMPLATE_NAME_REDHAT_1_24: "nutanix_ci:nutanix_template_rhel_8_1_24"
T_NUTANIX_TEMPLATE_NAME_REDHAT_1_25: "nutanix_ci:nutanix_template_rhel_8_1_25"
T_NUTANIX_TEMPLATE_NAME_REDHAT_1_26: "nutanix_ci:nutanix_template_rhel_8_1_26"
T_NUTANIX_TEMPLATE_NAME_REDHAT_1_27: "nutanix_ci:nutanix_template_rhel_8_1_27"
T_NUTANIX_TEMPLATE_NAME_REDHAT_1_28: "nutanix_ci:nutanix_template_rhel_8_1_28"
T_NUTANIX_TEMPLATE_NAME_REDHAT_9_1_24: "nutanix_ci:nutanix_template_rhel_9_1_24"
T_NUTANIX_TEMPLATE_NAME_REDHAT_9_1_25: "nutanix_ci:nutanix_template_rhel_9_1_25"
T_NUTANIX_TEMPLATE_NAME_REDHAT_9_1_26: "nutanix_ci:nutanix_template_rhel_9_1_26"
T_NUTANIX_TEMPLATE_NAME_REDHAT_9_1_27: "nutanix_ci:nutanix_template_rhel_9_1_27"
T_NUTANIX_TEMPLATE_NAME_REDHAT_9_1_28: "nutanix_ci:nutanix_template_rhel_9_1_28"

phases:
pre_build:
commands:
Expand Down
5 changes: 3 additions & 2 deletions pkg/api/v1alpha1/nutanixmachineconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,12 @@ func validateNutanixMachineConfig(c *NutanixMachineConfig) error {
return fmt.Errorf("NutanixMachineConfig: %v", err)
}

if c.Spec.OSFamily != Ubuntu {
if c.Spec.OSFamily != Ubuntu && c.Spec.OSFamily != RedHat {
return fmt.Errorf(
"NutanixMachineConfig: unsupported spec.osFamily (%v); Please use one of the following: %s",
"NutanixMachineConfig: unsupported spec.osFamily (%v); Please use one of the following: %s, %s",
c.Spec.OSFamily,
Ubuntu,
RedHat,
)
}

Expand Down
248 changes: 248 additions & 0 deletions test/e2e/nutanix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,96 @@ func TestNutanixKubernetes127SimpleFlowWithName(t *testing.T) {
runSimpleFlow(test)
}

func TestNutanixKubernetes128RedHatSimpleFlowWithName(t *testing.T) {
test := framework.NewClusterE2ETest(
t,
framework.NewNutanix(t, framework.WithRedHat128Nutanix()),
framework.WithClusterFiller(api.WithKubernetesVersion(v1alpha1.Kube128)),
)
runSimpleFlow(test)
}

func TestNutanixKubernetes124RedHatSimpleFlowWithName(t *testing.T) {
test := framework.NewClusterE2ETest(
t,
framework.NewNutanix(t, framework.WithRedHat124Nutanix()),
framework.WithClusterFiller(api.WithKubernetesVersion(v1alpha1.Kube124)),
)
runSimpleFlow(test)
}

func TestNutanixKubernetes125RedHatSimpleFlowWithName(t *testing.T) {
test := framework.NewClusterE2ETest(
t,
framework.NewNutanix(t, framework.WithRedHat125Nutanix()),
framework.WithClusterFiller(api.WithKubernetesVersion(v1alpha1.Kube125)),
)
runSimpleFlow(test)
}

func TestNutanixKubernetes126RedHatSimpleFlowWithName(t *testing.T) {
test := framework.NewClusterE2ETest(
t,
framework.NewNutanix(t, framework.WithRedHat126Nutanix()),
framework.WithClusterFiller(api.WithKubernetesVersion(v1alpha1.Kube126)),
)
runSimpleFlow(test)
}

func TestNutanixKubernetes127RedHatSimpleFlowWithName(t *testing.T) {
test := framework.NewClusterE2ETest(
t,
framework.NewNutanix(t, framework.WithRedHat127Nutanix()),
framework.WithClusterFiller(api.WithKubernetesVersion(v1alpha1.Kube127)),
)
runSimpleFlow(test)
}

func TestNutanixKubernetes128RedHat9SimpleFlowWithName(t *testing.T) {
test := framework.NewClusterE2ETest(
t,
framework.NewNutanix(t, framework.WithRedHat9Kubernetes128Nutanix()),
framework.WithClusterFiller(api.WithKubernetesVersion(v1alpha1.Kube128)),
)
runSimpleFlow(test)
}

func TestNutanixKubernetes124RedHat9SimpleFlowWithName(t *testing.T) {
test := framework.NewClusterE2ETest(
t,
framework.NewNutanix(t, framework.WithRedHat9Kubernetes124Nutanix()),
framework.WithClusterFiller(api.WithKubernetesVersion(v1alpha1.Kube124)),
)
runSimpleFlow(test)
}

func TestNutanixKubernetes125RedHat9SimpleFlowWithName(t *testing.T) {
test := framework.NewClusterE2ETest(
t,
framework.NewNutanix(t, framework.WithRedHat9Kubernetes125Nutanix()),
framework.WithClusterFiller(api.WithKubernetesVersion(v1alpha1.Kube125)),
)
runSimpleFlow(test)
}

func TestNutanixKubernetes126RedHat9SimpleFlowWithName(t *testing.T) {
test := framework.NewClusterE2ETest(
t,
framework.NewNutanix(t, framework.WithRedHat9Kubernetes126Nutanix()),
framework.WithClusterFiller(api.WithKubernetesVersion(v1alpha1.Kube126)),
)
runSimpleFlow(test)
}

func TestNutanixKubernetes127RedHat9SimpleFlowWithName(t *testing.T) {
test := framework.NewClusterE2ETest(
t,
framework.NewNutanix(t, framework.WithRedHat9Kubernetes127Nutanix()),
framework.WithClusterFiller(api.WithKubernetesVersion(v1alpha1.Kube127)),
)
runSimpleFlow(test)
}

func TestNutanixKubernetes128SimpleFlowWithUUID(t *testing.T) {
test := framework.NewClusterE2ETest(
t,
Expand Down Expand Up @@ -474,6 +564,28 @@ func TestNutanixKubernetes127SimpleFlowWithUUID(t *testing.T) {
runSimpleFlow(test)
}

func TestNutanixKubernetes128RedHatSimpleFlowWithUUID(t *testing.T) {
test := framework.NewClusterE2ETest(
t,
framework.NewNutanix(t, framework.WithRedHat128NutanixUUID(),
framework.WithPrismElementClusterUUID(),
framework.WithNutanixSubnetUUID()),
framework.WithClusterFiller(api.WithKubernetesVersion(v1alpha1.Kube128)),
)
runSimpleFlow(test)
}

func TestNutanixKubernetes128RedHat9SimpleFlowWithUUID(t *testing.T) {
test := framework.NewClusterE2ETest(
t,
framework.NewNutanix(t, framework.WithRedHat9Kubernetes128NutanixUUID(),
framework.WithPrismElementClusterUUID(),
framework.WithNutanixSubnetUUID()),
framework.WithClusterFiller(api.WithKubernetesVersion(v1alpha1.Kube128)),
)
runSimpleFlow(test)
}

// Upgrade
func TestNutanixKubernetes127To128UbuntuUpgrade(t *testing.T) {
provider := framework.NewNutanix(t, framework.WithUbuntu127Nutanix())
Expand Down Expand Up @@ -541,6 +653,142 @@ func TestNutanixKubernetes126To127UbuntuUpgrade(t *testing.T) {
)
}

func TestNutanixKubernetes127to128RedHatUpgrade(t *testing.T) {
provider := framework.NewNutanix(t, framework.WithRedHat127Nutanix())
test := framework.NewClusterE2ETest(
t,
provider,
framework.WithClusterFiller(api.WithKubernetesVersion(v1alpha1.Kube127)),
framework.WithClusterFiller(api.WithControlPlaneCount(1)),
framework.WithClusterFiller(api.WithWorkerNodeCount(1)),
)
runSimpleUpgradeFlow(
test,
v1alpha1.Kube128,
framework.WithClusterUpgrade(api.WithKubernetesVersion(v1alpha1.Kube128)),
provider.WithProviderUpgrade(provider.RedHat128Template()),
)
}

func TestNutanixKubernetes124to125RedHatUpgrade(t *testing.T) {
provider := framework.NewNutanix(t, framework.WithRedHat124Nutanix())
test := framework.NewClusterE2ETest(
t,
provider,
framework.WithClusterFiller(api.WithKubernetesVersion(v1alpha1.Kube124)),
framework.WithClusterFiller(api.WithControlPlaneCount(1)),
framework.WithClusterFiller(api.WithWorkerNodeCount(1)),
)
runSimpleUpgradeFlow(
test,
v1alpha1.Kube125,
framework.WithClusterUpgrade(api.WithKubernetesVersion(v1alpha1.Kube125)),
provider.WithProviderUpgrade(provider.RedHat125Template()),
)
}

func TestNutanixKubernetes125to126RedHatUpgrade(t *testing.T) {
provider := framework.NewNutanix(t, framework.WithRedHat125Nutanix())
test := framework.NewClusterE2ETest(
t,
provider,
framework.WithClusterFiller(api.WithKubernetesVersion(v1alpha1.Kube125)),
framework.WithClusterFiller(api.WithControlPlaneCount(1)),
framework.WithClusterFiller(api.WithWorkerNodeCount(1)),
)
runSimpleUpgradeFlow(
test,
v1alpha1.Kube126,
framework.WithClusterUpgrade(api.WithKubernetesVersion(v1alpha1.Kube126)),
provider.WithProviderUpgrade(provider.RedHat126Template()),
)
}

func TestNutanixKubernetes126to127RedHatUpgrade(t *testing.T) {
provider := framework.NewNutanix(t, framework.WithRedHat126Nutanix())
test := framework.NewClusterE2ETest(
t,
provider,
framework.WithClusterFiller(api.WithKubernetesVersion(v1alpha1.Kube126)),
framework.WithClusterFiller(api.WithControlPlaneCount(1)),
framework.WithClusterFiller(api.WithWorkerNodeCount(1)),
)
runSimpleUpgradeFlow(
test,
v1alpha1.Kube127,
framework.WithClusterUpgrade(api.WithKubernetesVersion(v1alpha1.Kube127)),
provider.WithProviderUpgrade(provider.RedHat127Template()),
)
}

func TestNutanixKubernetes127to128RedHat9Upgrade(t *testing.T) {
provider := framework.NewNutanix(t, framework.WithRedHat9Kubernetes127Nutanix())
test := framework.NewClusterE2ETest(
t,
provider,
framework.WithClusterFiller(api.WithKubernetesVersion(v1alpha1.Kube127)),
framework.WithClusterFiller(api.WithControlPlaneCount(1)),
framework.WithClusterFiller(api.WithWorkerNodeCount(1)),
)
runSimpleUpgradeFlow(
test,
v1alpha1.Kube128,
framework.WithClusterUpgrade(api.WithKubernetesVersion(v1alpha1.Kube128)),
provider.WithProviderUpgrade(provider.RedHat9Kubernetes128Template()),
)
}

func TestNutanixKubernetes124to125RedHat9Upgrade(t *testing.T) {
provider := framework.NewNutanix(t, framework.WithRedHat9Kubernetes124Nutanix())
test := framework.NewClusterE2ETest(
t,
provider,
framework.WithClusterFiller(api.WithKubernetesVersion(v1alpha1.Kube124)),
framework.WithClusterFiller(api.WithControlPlaneCount(1)),
framework.WithClusterFiller(api.WithWorkerNodeCount(1)),
)
runSimpleUpgradeFlow(
test,
v1alpha1.Kube125,
framework.WithClusterUpgrade(api.WithKubernetesVersion(v1alpha1.Kube125)),
provider.WithProviderUpgrade(provider.RedHat9Kubernetes125Template()),
)
}

func TestNutanixKubernetes125to126RedHat9Upgrade(t *testing.T) {
provider := framework.NewNutanix(t, framework.WithRedHat9Kubernetes125Nutanix())
test := framework.NewClusterE2ETest(
t,
provider,
framework.WithClusterFiller(api.WithKubernetesVersion(v1alpha1.Kube125)),
framework.WithClusterFiller(api.WithControlPlaneCount(1)),
framework.WithClusterFiller(api.WithWorkerNodeCount(1)),
)
runSimpleUpgradeFlow(
test,
v1alpha1.Kube126,
framework.WithClusterUpgrade(api.WithKubernetesVersion(v1alpha1.Kube126)),
provider.WithProviderUpgrade(provider.RedHat9Kubernetes126Template()),
)
}

func TestNutanixKubernetes126to127RedHat9Upgrade(t *testing.T) {
provider := framework.NewNutanix(t, framework.WithRedHat9Kubernetes126Nutanix())
test := framework.NewClusterE2ETest(
t,
provider,
framework.WithClusterFiller(api.WithKubernetesVersion(v1alpha1.Kube126)),
framework.WithClusterFiller(api.WithControlPlaneCount(1)),
framework.WithClusterFiller(api.WithWorkerNodeCount(1)),
)
runSimpleUpgradeFlow(
test,
v1alpha1.Kube127,
framework.WithClusterUpgrade(api.WithKubernetesVersion(v1alpha1.Kube127)),
provider.WithProviderUpgrade(provider.RedHat9Kubernetes127Template()),
)
}

func TestNutanixKubernetes128UbuntuWorkerNodeScaleUp1To3(t *testing.T) {
provider := framework.NewNutanix(t, framework.WithUbuntu128Nutanix())
test := framework.NewClusterE2ETest(
Expand Down
Loading

0 comments on commit 0d8e817

Please sign in to comment.