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

Add RHEL8 and RHEL9 fix for validation webhook and tests for Nutanix #6822

Merged
merged 3 commits into from
Oct 19, 2023
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
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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of deleting this entire validation, can we do something like
if c.Spec.OSFamily != Ubuntu && c.Spec.OSFamily != RedHat

for ex:

if config.Spec.OSFamily != Bottlerocket && config.Spec.OSFamily != Ubuntu && config.Spec.OSFamily != RedHat {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ahreehong Fixed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does RedHat OSFamily cover both redhat8 and redhat9

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
}
Comment on lines +567 to +576
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think we need separate UUID tests since the images are going to be the same and it's not really adding a lot more coverage. If we really wanted, we can keep just the 128 tests for UUID and remove the other ones.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


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