From 0d8e8171e4d79bbb353d8a49e386c9c91e0b2e8f Mon Sep 17 00:00:00 2001 From: Ilya Alekseyev Date: Thu, 19 Oct 2023 21:06:54 +0200 Subject: [PATCH] Add RHEL8 and RHEL9 fix for validation webhook and tests for Nutanix (#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 --- .../buildspecs/nutanix-test-eks-a-cli.yml | 11 + pkg/api/v1alpha1/nutanixmachineconfig.go | 5 +- test/e2e/nutanix_test.go | 248 ++++++++++++++++ test/framework/nutanix.go | 268 ++++++++++++++++-- test/framework/os_versions.go | 3 + 5 files changed, 510 insertions(+), 25 deletions(-) diff --git a/cmd/integration_test/build/buildspecs/nutanix-test-eks-a-cli.yml b/cmd/integration_test/build/buildspecs/nutanix-test-eks-a-cli.yml index 70e08e79abb8..aba283b7ce2b 100644 --- a/cmd/integration_test/build/buildspecs/nutanix-test-eks-a-cli.yml +++ b/cmd/integration_test/build/buildspecs/nutanix-test-eks-a-cli.yml @@ -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: diff --git a/pkg/api/v1alpha1/nutanixmachineconfig.go b/pkg/api/v1alpha1/nutanixmachineconfig.go index 34e9c40dfad1..66b59aaca465 100644 --- a/pkg/api/v1alpha1/nutanixmachineconfig.go +++ b/pkg/api/v1alpha1/nutanixmachineconfig.go @@ -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, ) } diff --git a/test/e2e/nutanix_test.go b/test/e2e/nutanix_test.go index 130993bfb19a..3f6f94caddcf 100644 --- a/test/e2e/nutanix_test.go +++ b/test/e2e/nutanix_test.go @@ -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, @@ -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()) @@ -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( diff --git a/test/framework/nutanix.go b/test/framework/nutanix.go index 58bd9977aea6..0aa09060f60f 100644 --- a/test/framework/nutanix.go +++ b/test/framework/nutanix.go @@ -17,28 +17,37 @@ import ( ) const ( - nutanixEndpoint = "T_NUTANIX_ENDPOINT" - nutanixPort = "T_NUTANIX_PORT" - nutanixAdditionalTrustBundle = "T_NUTANIX_ADDITIONAL_TRUST_BUNDLE" - nutanixInsecure = "T_NUTANIX_INSECURE" - nutanixMachineBootType = "T_NUTANIX_MACHINE_BOOT_TYPE" - nutanixMachineMemorySize = "T_NUTANIX_MACHINE_MEMORY_SIZE" - nutanixSystemDiskSize = "T_NUTANIX_SYSTEMDISK_SIZE" - nutanixMachineVCPUsPerSocket = "T_NUTANIX_MACHINE_VCPU_PER_SOCKET" - nutanixMachineVCPUSocket = "T_NUTANIX_MACHINE_VCPU_SOCKET" - nutanixPrismElementClusterName = "T_NUTANIX_PRISM_ELEMENT_CLUSTER_NAME" - nutanixSSHAuthorizedKey = "T_NUTANIX_SSH_AUTHORIZED_KEY" - nutanixSubnetName = "T_NUTANIX_SUBNET_NAME" - nutanixControlPlaneEndpointIP = "T_NUTANIX_CONTROL_PLANE_ENDPOINT_IP" - nutanixControlPlaneCidrVar = "T_NUTANIX_CONTROL_PLANE_CIDR" - nutanixPodCidrVar = "T_NUTANIX_POD_CIDR" - nutanixServiceCidrVar = "T_NUTANIX_SERVICE_CIDR" - nutanixTemplateNameUbuntu123Var = "T_NUTANIX_TEMPLATE_NAME_UBUNTU_1_23" - nutanixTemplateNameUbuntu124Var = "T_NUTANIX_TEMPLATE_NAME_UBUNTU_1_24" - nutanixTemplateNameUbuntu125Var = "T_NUTANIX_TEMPLATE_NAME_UBUNTU_1_25" - nutanixTemplateNameUbuntu126Var = "T_NUTANIX_TEMPLATE_NAME_UBUNTU_1_26" - nutanixTemplateNameUbuntu127Var = "T_NUTANIX_TEMPLATE_NAME_UBUNTU_1_27" - nutanixTemplateNameUbuntu128Var = "T_NUTANIX_TEMPLATE_NAME_UBUNTU_1_28" + nutanixEndpoint = "T_NUTANIX_ENDPOINT" + nutanixPort = "T_NUTANIX_PORT" + nutanixAdditionalTrustBundle = "T_NUTANIX_ADDITIONAL_TRUST_BUNDLE" + nutanixInsecure = "T_NUTANIX_INSECURE" + nutanixMachineBootType = "T_NUTANIX_MACHINE_BOOT_TYPE" + nutanixMachineMemorySize = "T_NUTANIX_MACHINE_MEMORY_SIZE" + nutanixSystemDiskSize = "T_NUTANIX_SYSTEMDISK_SIZE" + nutanixMachineVCPUsPerSocket = "T_NUTANIX_MACHINE_VCPU_PER_SOCKET" + nutanixMachineVCPUSocket = "T_NUTANIX_MACHINE_VCPU_SOCKET" + nutanixPrismElementClusterName = "T_NUTANIX_PRISM_ELEMENT_CLUSTER_NAME" + nutanixSSHAuthorizedKey = "T_NUTANIX_SSH_AUTHORIZED_KEY" + nutanixSubnetName = "T_NUTANIX_SUBNET_NAME" + nutanixControlPlaneEndpointIP = "T_NUTANIX_CONTROL_PLANE_ENDPOINT_IP" + nutanixControlPlaneCidrVar = "T_NUTANIX_CONTROL_PLANE_CIDR" + nutanixPodCidrVar = "T_NUTANIX_POD_CIDR" + nutanixServiceCidrVar = "T_NUTANIX_SERVICE_CIDR" + nutanixTemplateNameUbuntu124Var = "T_NUTANIX_TEMPLATE_NAME_UBUNTU_1_24" + nutanixTemplateNameUbuntu125Var = "T_NUTANIX_TEMPLATE_NAME_UBUNTU_1_25" + nutanixTemplateNameUbuntu126Var = "T_NUTANIX_TEMPLATE_NAME_UBUNTU_1_26" + nutanixTemplateNameUbuntu127Var = "T_NUTANIX_TEMPLATE_NAME_UBUNTU_1_27" + nutanixTemplateNameUbuntu128Var = "T_NUTANIX_TEMPLATE_NAME_UBUNTU_1_28" + nutanixTemplateNameRedHat124Var = "T_NUTANIX_TEMPLATE_NAME_REDHAT_1_24" + nutanixTemplateNameRedHat125Var = "T_NUTANIX_TEMPLATE_NAME_REDHAT_1_25" + nutanixTemplateNameRedHat126Var = "T_NUTANIX_TEMPLATE_NAME_REDHAT_1_26" + nutanixTemplateNameRedHat127Var = "T_NUTANIX_TEMPLATE_NAME_REDHAT_1_27" + nutanixTemplateNameRedHat128Var = "T_NUTANIX_TEMPLATE_NAME_REDHAT_1_28" + nutanixTemplateNameRedHat9124Var = "T_NUTANIX_TEMPLATE_NAME_REDHAT_9_1_24" + nutanixTemplateNameRedHat9125Var = "T_NUTANIX_TEMPLATE_NAME_REDHAT_9_1_25" + nutanixTemplateNameRedHat9126Var = "T_NUTANIX_TEMPLATE_NAME_REDHAT_9_1_26" + nutanixTemplateNameRedHat9127Var = "T_NUTANIX_TEMPLATE_NAME_REDHAT_9_1_27" + nutanixTemplateNameRedHat9128Var = "T_NUTANIX_TEMPLATE_NAME_REDHAT_9_1_28" ) var requiredNutanixEnvVars = []string{ @@ -57,12 +66,21 @@ var requiredNutanixEnvVars = []string{ nutanixSubnetName, nutanixPodCidrVar, nutanixServiceCidrVar, - nutanixTemplateNameUbuntu123Var, nutanixTemplateNameUbuntu124Var, nutanixTemplateNameUbuntu125Var, nutanixTemplateNameUbuntu126Var, nutanixTemplateNameUbuntu127Var, nutanixTemplateNameUbuntu128Var, + nutanixTemplateNameRedHat124Var, + nutanixTemplateNameRedHat125Var, + nutanixTemplateNameRedHat126Var, + nutanixTemplateNameRedHat127Var, + nutanixTemplateNameRedHat128Var, + nutanixTemplateNameRedHat9124Var, + nutanixTemplateNameRedHat9125Var, + nutanixTemplateNameRedHat9126Var, + nutanixTemplateNameRedHat9127Var, + nutanixTemplateNameRedHat9128Var, nutanixInsecure, } @@ -239,6 +257,78 @@ func WithUbuntu128Nutanix() NutanixOpt { return withNutanixKubeVersionAndOS(anywherev1.Kube128, Ubuntu2004, nil) } +// WithRedHat123Nutanix returns a NutanixOpt that adds API fillers to use a RedHat Nutanix template for k8s 1.23 +// and the "redhat" osFamily in all machine configs. +func WithRedHat123Nutanix() NutanixOpt { + return withNutanixKubeVersionAndOS(anywherev1.Kube123, RedHat8, nil) +} + +// WithRedHat124Nutanix returns a NutanixOpt that adds API fillers to use a RedHat Nutanix template for k8s 1.24 +// and the "redhat" osFamily in all machine configs. +func WithRedHat124Nutanix() NutanixOpt { + return withNutanixKubeVersionAndOS(anywherev1.Kube124, RedHat8, nil) +} + +// WithRedHat125Nutanix returns a NutanixOpt that adds API fillers to use a RedHat Nutanix template for k8s 1.25 +// and the "redhat" osFamily in all machine configs. +func WithRedHat125Nutanix() NutanixOpt { + return withNutanixKubeVersionAndOS(anywherev1.Kube125, RedHat8, nil) +} + +// WithRedHat126Nutanix returns a NutanixOpt that adds API fillers to use a RedHat Nutanix template for k8s 1.26 +// and the "redhat" osFamily in all machine configs. +func WithRedHat126Nutanix() NutanixOpt { + return withNutanixKubeVersionAndOS(anywherev1.Kube126, RedHat8, nil) +} + +// WithRedHat127Nutanix returns a NutanixOpt that adds API fillers to use a RedHat Nutanix template for k8s 1.27 +// and the "redhat" osFamily in all machine configs. +func WithRedHat127Nutanix() NutanixOpt { + return withNutanixKubeVersionAndOS(anywherev1.Kube127, RedHat8, nil) +} + +// WithRedHat128Nutanix returns a NutanixOpt that adds API fillers to use a RedHat Nutanix template for k8s 1.28 +// and the "redhat" osFamily in all machine configs. +func WithRedHat128Nutanix() NutanixOpt { + return withNutanixKubeVersionAndOS(anywherev1.Kube128, RedHat8, nil) +} + +// WithRedHat9Kubernetes123Nutanix returns a NutanixOpt that adds API fillers to use a RedHat Nutanix template for k8s 1.23 +// and the "redhat" osFamily in all machine configs. +func WithRedHat9Kubernetes123Nutanix() NutanixOpt { + return withNutanixKubeVersionAndOS(anywherev1.Kube123, RedHat9, nil) +} + +// WithRedHat9Kubernetes124Nutanix returns a NutanixOpt that adds API fillers to use a RedHat Nutanix template for k8s 1.24 +// and the "redhat" osFamily in all machine configs. +func WithRedHat9Kubernetes124Nutanix() NutanixOpt { + return withNutanixKubeVersionAndOS(anywherev1.Kube124, RedHat9, nil) +} + +// WithRedHat9Kubernetes125Nutanix returns a NutanixOpt that adds API fillers to use a RedHat Nutanix template for k8s 1.25 +// and the "redhat" osFamily in all machine configs. +func WithRedHat9Kubernetes125Nutanix() NutanixOpt { + return withNutanixKubeVersionAndOS(anywherev1.Kube125, RedHat9, nil) +} + +// WithRedHat9Kubernetes126Nutanix returns a NutanixOpt that adds API fillers to use a RedHat Nutanix template for k8s 1.26 +// and the "redhat" osFamily in all machine configs. +func WithRedHat9Kubernetes126Nutanix() NutanixOpt { + return withNutanixKubeVersionAndOS(anywherev1.Kube126, RedHat9, nil) +} + +// WithRedHat9Kubernetes127Nutanix returns a NutanixOpt that adds API fillers to use a RedHat Nutanix template for k8s 1.27 +// and the "redhat" osFamily in all machine configs. +func WithRedHat9Kubernetes127Nutanix() NutanixOpt { + return withNutanixKubeVersionAndOS(anywherev1.Kube127, RedHat9, nil) +} + +// WithRedHat9Kubernetes128Nutanix returns a NutanixOpt that adds API fillers to use a RedHat Nutanix template for k8s 1.28 +// and the "redhat" osFamily in all machine configs. +func WithRedHat9Kubernetes128Nutanix() NutanixOpt { + return withNutanixKubeVersionAndOS(anywherev1.Kube128, RedHat9, nil) +} + // withNutanixKubeVersionAndOSForUUID returns a NutanixOpt that adds API fillers to use a Nutanix template UUID // corresponding to the provided OS family and Kubernetes version, in addition to configuring all machine configs // to use this OS family. @@ -285,6 +375,78 @@ func WithUbuntu128NutanixUUID() NutanixOpt { return withNutanixKubeVersionAndOSForUUID(anywherev1.Kube128, Ubuntu2004, nil) } +// WithRedHat123NutanixUUID returns a NutanixOpt that adds API fillers to use a RedHat Nutanix template UUID for k8s 1.23 +// and the "redhat" osFamily in all machine configs. +func WithRedHat123NutanixUUID() NutanixOpt { + return withNutanixKubeVersionAndOSForUUID(anywherev1.Kube123, RedHat8, nil) +} + +// WithRedHat124NutanixUUID returns a NutanixOpt that adds API fillers to use a RedHat Nutanix template UUID for k8s 1.24 +// and the "redhat" osFamily in all machine configs. +func WithRedHat124NutanixUUID() NutanixOpt { + return withNutanixKubeVersionAndOSForUUID(anywherev1.Kube124, RedHat8, nil) +} + +// WithRedHat125NutanixUUID returns a NutanixOpt that adds API fillers to use a RedHat Nutanix template UUID for k8s 1.25 +// and the "redhat" osFamily in all machine configs. +func WithRedHat125NutanixUUID() NutanixOpt { + return withNutanixKubeVersionAndOSForUUID(anywherev1.Kube125, RedHat8, nil) +} + +// WithRedHat126NutanixUUID returns a NutanixOpt that adds API fillers to use a RedHat Nutanix template UUID for k8s 1.26 +// and the "redhat" osFamily in all machine configs. +func WithRedHat126NutanixUUID() NutanixOpt { + return withNutanixKubeVersionAndOSForUUID(anywherev1.Kube126, RedHat8, nil) +} + +// WithRedHat127NutanixUUID returns a NutanixOpt that adds API fillers to use a RedHat Nutanix template UUID for k8s 1.27 +// and the "redhat" osFamily in all machine configs. +func WithRedHat127NutanixUUID() NutanixOpt { + return withNutanixKubeVersionAndOSForUUID(anywherev1.Kube127, RedHat8, nil) +} + +// WithRedHat128NutanixUUID returns a NutanixOpt that adds API fillers to use a RedHat Nutanix template UUID for k8s 1.28 +// and the "redhat" osFamily in all machine configs. +func WithRedHat128NutanixUUID() NutanixOpt { + return withNutanixKubeVersionAndOSForUUID(anywherev1.Kube128, RedHat8, nil) +} + +// WithRedHat9Kubernetes123NutanixUUID returns a NutanixOpt that adds API fillers to use a RedHat Nutanix template UUID for k8s 1.23 +// and the "redhat" osFamily in all machine configs. +func WithRedHat9Kubernetes123NutanixUUID() NutanixOpt { + return withNutanixKubeVersionAndOSForUUID(anywherev1.Kube123, RedHat9, nil) +} + +// WithRedHat9Kubernetes124NutanixUUID returns a NutanixOpt that adds API fillers to use a RedHat Nutanix template UUID for k8s 1.24 +// and the "redhat" osFamily in all machine configs. +func WithRedHat9Kubernetes124NutanixUUID() NutanixOpt { + return withNutanixKubeVersionAndOSForUUID(anywherev1.Kube124, RedHat9, nil) +} + +// WithRedHat9Kubernetes125NutanixUUID returns a NutanixOpt that adds API fillers to use a RedHat Nutanix template UUID for k8s 1.25 +// and the "redhat" osFamily in all machine configs. +func WithRedHat9Kubernetes125NutanixUUID() NutanixOpt { + return withNutanixKubeVersionAndOSForUUID(anywherev1.Kube125, RedHat9, nil) +} + +// WithRedHat9Kubernetes126NutanixUUID returns a NutanixOpt that adds API fillers to use a RedHat Nutanix template UUID for k8s 1.26 +// and the "redhat" osFamily in all machine configs. +func WithRedHat9Kubernetes126NutanixUUID() NutanixOpt { + return withNutanixKubeVersionAndOSForUUID(anywherev1.Kube126, RedHat9, nil) +} + +// WithRedHat9Kubernetes127NutanixUUID returns a NutanixOpt that adds API fillers to use a RedHat Nutanix template UUID for k8s 1.27 +// and the "redhat" osFamily in all machine configs. +func WithRedHat9Kubernetes127NutanixUUID() NutanixOpt { + return withNutanixKubeVersionAndOSForUUID(anywherev1.Kube127, RedHat9, nil) +} + +// WithRedHat9Kubernetes128NutanixUUID returns a NutanixOpt that adds API fillers to use a RedHat Nutanix template UUID for k8s 1.28 +// and the "redhat" osFamily in all machine configs. +func WithRedHat9Kubernetes128NutanixUUID() NutanixOpt { + return withNutanixKubeVersionAndOSForUUID(anywherev1.Kube128, RedHat9, nil) +} + func (n *Nutanix) withNutanixUUID(name string, osFamily anywherev1.OSFamily) []api.NutanixFiller { uuid, err := n.client.GetImageUUIDFromName(context.Background(), name) if err != nil { @@ -366,6 +528,66 @@ func (n *Nutanix) Ubuntu128Template() api.NutanixFiller { return n.templateForKubeVersionAndOS(anywherev1.Kube128, Ubuntu2004, nil) } +// RedHat124Template returns NutanixFiller by reading the env var and setting machine config's +// image name parameter in the spec. +func (n *Nutanix) RedHat124Template() api.NutanixFiller { + return n.templateForKubeVersionAndOS(anywherev1.Kube124, RedHat8, nil) +} + +// RedHat125Template returns NutanixFiller by reading the env var and setting machine config's +// image name parameter in the spec. +func (n *Nutanix) RedHat125Template() api.NutanixFiller { + return n.templateForKubeVersionAndOS(anywherev1.Kube125, RedHat8, nil) +} + +// RedHat126Template returns NutanixFiller by reading the env var and setting machine config's +// image name parameter in the spec. +func (n *Nutanix) RedHat126Template() api.NutanixFiller { + return n.templateForKubeVersionAndOS(anywherev1.Kube126, RedHat8, nil) +} + +// RedHat127Template returns NutanixFiller by reading the env var and setting machine config's +// image name parameter in the spec. +func (n *Nutanix) RedHat127Template() api.NutanixFiller { + return n.templateForKubeVersionAndOS(anywherev1.Kube127, RedHat8, nil) +} + +// RedHat128Template returns NutanixFiller by reading the env var and setting machine config's +// image name parameter in the spec. +func (n *Nutanix) RedHat128Template() api.NutanixFiller { + return n.templateForKubeVersionAndOS(anywherev1.Kube128, RedHat8, nil) +} + +// RedHat9Kubernetes124Template returns NutanixFiller by reading the env var and setting machine config's +// image name parameter in the spec. +func (n *Nutanix) RedHat9Kubernetes124Template() api.NutanixFiller { + return n.templateForKubeVersionAndOS(anywherev1.Kube124, RedHat9, nil) +} + +// RedHat9Kubernetes125Template returns NutanixFiller by reading the env var and setting machine config's +// image name parameter in the spec. +func (n *Nutanix) RedHat9Kubernetes125Template() api.NutanixFiller { + return n.templateForKubeVersionAndOS(anywherev1.Kube125, RedHat9, nil) +} + +// RedHat9Kubernetes126Template returns NutanixFiller by reading the env var and setting machine config's +// image name parameter in the spec. +func (n *Nutanix) RedHat9Kubernetes126Template() api.NutanixFiller { + return n.templateForKubeVersionAndOS(anywherev1.Kube126, RedHat9, nil) +} + +// RedHat9Kubernetes127Template returns NutanixFiller by reading the env var and setting machine config's +// image name parameter in the spec. +func (n *Nutanix) RedHat9Kubernetes127Template() api.NutanixFiller { + return n.templateForKubeVersionAndOS(anywherev1.Kube127, RedHat9, nil) +} + +// RedHat9Kubernetes128Template returns NutanixFiller by reading the env var and setting machine config's +// image name parameter in the spec. +func (n *Nutanix) RedHat9Kubernetes128Template() api.NutanixFiller { + return n.templateForKubeVersionAndOS(anywherev1.Kube128, RedHat9, nil) +} + // ClusterStateValidations returns a list of provider specific ClusterStateValidations. func (n *Nutanix) ClusterStateValidations() []clusterf.StateValidation { return []clusterf.StateValidation{} diff --git a/test/framework/os_versions.go b/test/framework/os_versions.go index 67e81c62747f..4c36851abc05 100644 --- a/test/framework/os_versions.go +++ b/test/framework/os_versions.go @@ -16,6 +16,8 @@ const ( Ubuntu2004 OS = "ubuntu" // Bottlerocket1 corresponds to Bottlerocket OS. We don't add the version number in the string to facilitate backwards compatibility. Bottlerocket1 OS = "bottlerocket" + // RedHat9 corresponds to Red Hat 9 OS. + RedHat9 OS = "redhat-9" // RedHat8 corresponds to Red Hat 8 OS. We don't add the version number in the string to facilitate backwards compatibility. RedHat8 OS = "redhat" ) @@ -25,4 +27,5 @@ var osFamiliesForOS = map[OS]anywherev1.OSFamily{ Ubuntu2004: anywherev1.Ubuntu, Bottlerocket1: anywherev1.Bottlerocket, RedHat8: anywherev1.RedHat, + RedHat9: anywherev1.RedHat, }