diff --git a/cmd/integration_test/build/buildspecs/conformance-eks-a-cli.yml b/cmd/integration_test/build/buildspecs/conformance-eks-a-cli.yml index 8ca6792aea97..c578cabf8503 100644 --- a/cmd/integration_test/build/buildspecs/conformance-eks-a-cli.yml +++ b/cmd/integration_test/build/buildspecs/conformance-eks-a-cli.yml @@ -70,16 +70,22 @@ env: T_NUTANIX_PORT: "nutanix_ci:nutanix_port" T_NUTANIX_MACHINE_BOOT_TYPE: "nutanix_ci:nutanix_machine_boot_type" T_NUTANIX_PRISM_ELEMENT_CLUSTER_NAME: "nutanix_ci:nutanix_prism_element_cluster_name" + T_NUTANIX_PRISM_ELEMENT_CLUSTER_UUID: "nutanix_ci:nutanix_prism_element_cluster_uuid" T_NUTANIX_SSH_AUTHORIZED_KEY: "nutanix_ci:nutanix_ssh_authorized_key" T_NUTANIX_SUBNET_NAME: "nutanix_ci:nutanix_subnet_name" + T_NUTANIX_SUBNET_UUID: "nutanix_ci:nutanix_subnet_uuid" T_NUTANIX_CONTROL_PLANE_CIDR: "nutanix_ci:nutanix_control_plane_cidr" T_NUTANIX_POD_CIDR: "nutanix_ci:nutanix_pod_cidr" T_NUTANIX_SERVICE_CIDR: "nutanix_ci:nutanix_service_cidr" T_NUTANIX_ADDITIONAL_TRUST_BUNDLE: "nutanix_ci:nutanix_additional_trust_bundle" - T_NUTANIX_TEMPLATE_UBUNTU_1_21: "nutanix_ci:nutanix_template_ubuntu_1_21" - T_NUTANIX_TEMPLATE_UBUNTU_1_22: "nutanix_ci:nutanix_template_ubuntu_1_22" - T_NUTANIX_TEMPLATE_UBUNTU_1_23: "nutanix_ci:nutanix_template_ubuntu_1_23" - T_NUTANIX_TEMPLATE_UBUNTU_1_24: "nutanix_ci:nutanix_template_ubuntu_1_24" + T_NUTANIX_TEMPLATE_NAME_UBUNTU_1_21: "nutanix_ci:nutanix_template_ubuntu_1_21" + T_NUTANIX_TEMPLATE_NAME_UBUNTU_1_22: "nutanix_ci:nutanix_template_ubuntu_1_22" + T_NUTANIX_TEMPLATE_NAME_UBUNTU_1_23: "nutanix_ci:nutanix_template_ubuntu_1_23" + T_NUTANIX_TEMPLATE_NAME_UBUNTU_1_24: "nutanix_ci:nutanix_template_ubuntu_1_24" + T_NUTANIX_TEMPLATE_UUID_UBUNTU_1_21: "nutanix_ci:nutanix_template_uuid_ubuntu_1_21" + T_NUTANIX_TEMPLATE_UUID_UBUNTU_1_22: "nutanix_ci:nutanix_template_uuid_ubuntu_1_22" + T_NUTANIX_TEMPLATE_UUID_UBUNTU_1_23: "nutanix_ci:nutanix_template_uuid_ubuntu_1_23" + T_NUTANIX_TEMPLATE_UUID_UBUNTU_1_24: "nutanix_ci:nutanix_template_uuid_ubuntu_1_24" phases: pre_build: commands: diff --git a/cmd/integration_test/build/buildspecs/test-eks-a-cli.yml b/cmd/integration_test/build/buildspecs/test-eks-a-cli.yml index 9f55718dec28..1d1f8d921e33 100644 --- a/cmd/integration_test/build/buildspecs/test-eks-a-cli.yml +++ b/cmd/integration_test/build/buildspecs/test-eks-a-cli.yml @@ -121,8 +121,10 @@ env: T_NUTANIX_PORT: "nutanix_ci:nutanix_port" T_NUTANIX_MACHINE_BOOT_TYPE: "nutanix_ci:nutanix_machine_boot_type" T_NUTANIX_PRISM_ELEMENT_CLUSTER_NAME: "nutanix_ci:nutanix_prism_element_cluster_name" + T_NUTANIX_PRISM_ELEMENT_CLUSTER_UUID: "nutanix_ci:nutanix_prism_element_cluster_uuid" T_NUTANIX_SSH_AUTHORIZED_KEY: "nutanix_ci:nutanix_ssh_authorized_key" T_NUTANIX_SUBNET_NAME: "nutanix_ci:nutanix_subnet_name" + T_NUTANIX_SUBNET_UUID: "nutanix_ci:nutanix_subnet_uuid" T_NUTANIX_CONTROL_PLANE_CIDR: "nutanix_ci:nutanix_control_plane_cidr" T_NUTANIX_POD_CIDR: "nutanix_ci:nutanix_pod_cidr" T_NUTANIX_SERVICE_CIDR: "nutanix_ci:nutanix_service_cidr" @@ -131,6 +133,10 @@ env: T_NUTANIX_TEMPLATE_UBUNTU_1_22: "nutanix_ci:nutanix_template_ubuntu_1_22" T_NUTANIX_TEMPLATE_UBUNTU_1_23: "nutanix_ci:nutanix_template_ubuntu_1_23" T_NUTANIX_TEMPLATE_UBUNTU_1_24: "nutanix_ci:nutanix_template_ubuntu_1_24" + T_NUTANIX_TEMPLATE_UUID_UBUNTU_1_21: "nutanix_ci:nutanix_template_uuid_ubuntu_1_21" + T_NUTANIX_TEMPLATE_UUID_UBUNTU_1_22: "nutanix_ci:nutanix_template_uuid_ubuntu_1_22" + T_NUTANIX_TEMPLATE_UUID_UBUNTU_1_23: "nutanix_ci:nutanix_template_uuid_ubuntu_1_23" + T_NUTANIX_TEMPLATE_UUID_UBUNTU_1_24: "nutanix_ci:nutanix_template_uuid_ubuntu_1_24" phases: pre_build: commands: diff --git a/pkg/api/v1alpha1/nutanixmachineconfig.go b/pkg/api/v1alpha1/nutanixmachineconfig.go index b62bec05ee85..d122892be68f 100644 --- a/pkg/api/v1alpha1/nutanixmachineconfig.go +++ b/pkg/api/v1alpha1/nutanixmachineconfig.go @@ -13,6 +13,10 @@ import ( // NutanixIdentifierType is an enumeration of different resource identifier types. type NutanixIdentifierType string +func (c NutanixIdentifierType) String() string { + return string(c) +} + const ( // NutanixMachineConfigKind is the kind for a NutanixMachineConfig. NutanixMachineConfigKind = "NutanixMachineConfig" diff --git a/pkg/providers/nutanix/config/cp-template.yaml b/pkg/providers/nutanix/config/cp-template.yaml index db01c5f5ee7f..58d237b18305 100644 --- a/pkg/providers/nutanix/config/cp-template.yaml +++ b/pkg/providers/nutanix/config/cp-template.yaml @@ -177,11 +177,26 @@ spec: memorySize: {{.memorySize}} systemDiskSize: {{.systemDiskSize}} image: +{{- if (eq .imageIDType "name") }} type: name name: "{{.imageName}}" +{{ else if (eq .imageIDType "uuid") }} + type: uuid + uuid: "{{.imageUUID}}" +{{ end }} cluster: +{{- if (eq .nutanixPEClusterIDType "name") }} type: name name: "{{.nutanixPEClusterName}}" +{{- else if (eq .nutanixPEClusterIDType "uuid") }} + type: uuid + uuid: "{{.nutanixPEClusterUUID}}" +{{ end }} subnet: +{{- if (eq .subnetIDType "name") }} - type: name name: "{{.subnetName}}" +{{- else if (eq .subnetIDType "uuid") }} + - type: uuid + uuid: "{{.subnetUUID}}" +{{ end }} diff --git a/pkg/providers/nutanix/config/md-template.yaml b/pkg/providers/nutanix/config/md-template.yaml index 81ea166d7298..52f7d4b18de5 100644 --- a/pkg/providers/nutanix/config/md-template.yaml +++ b/pkg/providers/nutanix/config/md-template.yaml @@ -41,14 +41,29 @@ spec: memorySize: {{.memorySize}} systemDiskSize: {{.systemDiskSize}} image: +{{- if (eq .imageIDType "name") }} type: name name: "{{.imageName}}" +{{ else if (eq .imageIDType "uuid") }} + type: uuid + uuid: "{{.imageUUID}}" +{{ end }} cluster: +{{- if (eq .nutanixPEClusterIDType "name") }} type: name name: "{{.nutanixPEClusterName}}" +{{- else if (eq .nutanixPEClusterIDType "uuid") }} + type: uuid + uuid: "{{.nutanixPEClusterUUID}}" +{{ end }} subnet: +{{- if (eq .subnetIDType "name") }} - type: name name: "{{.subnetName}}" +{{- else if (eq .subnetIDType "uuid") }} + - type: uuid + uuid: "{{.subnetUUID}}" +{{ end }} --- apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 kind: KubeadmConfigTemplate diff --git a/pkg/providers/nutanix/template.go b/pkg/providers/nutanix/template.go index 88906708e3cb..a1294e939bc9 100644 --- a/pkg/providers/nutanix/template.go +++ b/pkg/providers/nutanix/template.go @@ -154,9 +154,15 @@ func buildTemplateMapCP( "vcpuSockets": controlPlaneMachineSpec.VCPUSockets, "memorySize": controlPlaneMachineSpec.MemorySize.String(), "systemDiskSize": controlPlaneMachineSpec.SystemDiskSize.String(), - "imageName": controlPlaneMachineSpec.Image.Name, // TODO(nutanix): pass name or uuid based on type of identifier - "nutanixPEClusterName": controlPlaneMachineSpec.Cluster.Name, // TODO(nutanix): pass name or uuid based on type of identifier - "subnetName": controlPlaneMachineSpec.Subnet.Name, // TODO(nutanix): pass name or uuid based on type of identifier + "imageIDType": controlPlaneMachineSpec.Image.Type, + "imageName": controlPlaneMachineSpec.Image.Name, + "imageUUID": controlPlaneMachineSpec.Image.UUID, + "nutanixPEClusterIDType": controlPlaneMachineSpec.Cluster.Type, + "nutanixPEClusterName": controlPlaneMachineSpec.Cluster.Name, + "nutanixPEClusterUUID": controlPlaneMachineSpec.Cluster.UUID, + "subnetIDType": controlPlaneMachineSpec.Subnet.Type, + "subnetName": controlPlaneMachineSpec.Subnet.Name, + "subnetUUID": controlPlaneMachineSpec.Subnet.UUID, } if clusterSpec.Cluster.Spec.ExternalEtcdConfiguration != nil { @@ -185,9 +191,15 @@ func buildTemplateMapMD(clusterSpec *cluster.Spec, workerNodeGroupMachineSpec v1 "vcpuSockets": workerNodeGroupMachineSpec.VCPUSockets, "memorySize": workerNodeGroupMachineSpec.MemorySize.String(), "systemDiskSize": workerNodeGroupMachineSpec.SystemDiskSize.String(), - "imageName": workerNodeGroupMachineSpec.Image.Name, // TODO(nutanix): pass name or uuid based on type of identifier - "nutanixPEClusterName": workerNodeGroupMachineSpec.Cluster.Name, // TODO(nutanix): pass name or uuid based on type of identifier - "subnetName": workerNodeGroupMachineSpec.Subnet.Name, // TODO(nutanix): pass name or uuid based on type of identifier + "imageIDType": workerNodeGroupMachineSpec.Image.Type, + "imageName": workerNodeGroupMachineSpec.Image.Name, + "imageUUID": workerNodeGroupMachineSpec.Image.UUID, + "nutanixPEClusterIDType": workerNodeGroupMachineSpec.Cluster.Type, + "nutanixPEClusterName": workerNodeGroupMachineSpec.Cluster.Name, + "nutanixPEClusterUUID": workerNodeGroupMachineSpec.Cluster.UUID, + "subnetIDType": workerNodeGroupMachineSpec.Subnet.Type, + "subnetName": workerNodeGroupMachineSpec.Subnet.Name, + "subnetUUID": workerNodeGroupMachineSpec.Subnet.UUID, "workerNodeGroupName": fmt.Sprintf("%s-%s", clusterSpec.Cluster.Name, workerNodeGroupConfiguration.Name), } return values diff --git a/test/e2e/README.md b/test/e2e/README.md index 8c74cc3b8813..9e4e84e9f2e5 100644 --- a/test/e2e/README.md +++ b/test/e2e/README.md @@ -77,15 +77,22 @@ The format is: `T_VSPHERE_TEMPLATE_{OS}_{EKS-D VERSION}`. For example, for Ubunt T_NUTANIX_MACHINE_VCPU_PER_SOCKET T_NUTANIX_MACHINE_VCPU_SOCKET T_NUTANIX_PRISM_ELEMENT_CLUSTER_NAME - T_NUTANIX_SSH_AUTHORIZED_KEY + T_NUTANIX_PRISM_ELEMENT_CLUSTER_UUID T_NUTANIX_SUBNET_NAME + T_NUTANIX_SUBNET_UUID + T_NUTANIX_SSH_AUTHORIZED_KEY T_NUTANIX_CONTROL_PLANE_ENDPOINT_IP T_NUTANIX_POD_CIDR T_NUTANIX_SERVICE_CIDR - T_NUTANIX_TEMPLATE_UBUNTU_1_21 - T_NUTANIX_TEMPLATE_UBUNTU_1_22 - T_NUTANIX_TEMPLATE_UBUNTU_1_23 - T_NUTANIX_TEMPLATE_UBUNTU_1_24 + T_NUTANIX_TEMPLATE_NAME_UBUNTU_1_21 + T_NUTANIX_TEMPLATE_NAME_UBUNTU_1_22 + T_NUTANIX_TEMPLATE_NAME_UBUNTU_1_23 + T_NUTANIX_TEMPLATE_NAME_UBUNTU_1_24 + T_NUTANIX_TEMPLATE_UUID_UBUNTU_1_21 + T_NUTANIX_TEMPLATE_UUID_UBUNTU_1_22 + T_NUTANIX_TEMPLATE_UUID_UBUNTU_1_23 + T_NUTANIX_TEMPLATE_UUID_UBUNTU_1_24 + ``` ## Tinkerbell tests requisites The following env variables need to be set: diff --git a/test/e2e/simpleflow_test.go b/test/e2e/simpleflow_test.go index beb8cee7cb57..030ac34e17e7 100644 --- a/test/e2e/simpleflow_test.go +++ b/test/e2e/simpleflow_test.go @@ -549,3 +549,47 @@ func TestNutanixKubernetes124SimpleFlow(t *testing.T) { ) runSimpleFlow(test) } + +func TestNutanixKubernetes121SimpleFlowUUID(t *testing.T) { + test := framework.NewClusterE2ETest( + t, + framework.NewNutanix(t, framework.WithUbuntu121NutanixUUID(), + framework.WithPrismElementClusterUUID(), + framework.WithSubnetUUID()), + framework.WithClusterFiller(api.WithKubernetesVersion(v1alpha1.Kube121)), + ) + runSimpleFlow(test) +} + +func TestNutanixKubernetes122SimpleFlowUUID(t *testing.T) { + test := framework.NewClusterE2ETest( + t, + framework.NewNutanix(t, framework.WithUbuntu122NutanixUUID(), + framework.WithPrismElementClusterUUID(), + framework.WithSubnetUUID()), + framework.WithClusterFiller(api.WithKubernetesVersion(v1alpha1.Kube122)), + ) + runSimpleFlow(test) +} + +func TestNutanixKubernetes123SimpleFlowUUID(t *testing.T) { + test := framework.NewClusterE2ETest( + t, + framework.NewNutanix(t, framework.WithUbuntu123NutanixUUID(), + framework.WithPrismElementClusterUUID(), + framework.WithSubnetUUID()), + framework.WithClusterFiller(api.WithKubernetesVersion(v1alpha1.Kube123)), + ) + runSimpleFlow(test) +} + +func TestNutanixKubernetes124SimpleFlowUUID(t *testing.T) { + test := framework.NewClusterE2ETest( + t, + framework.NewNutanix(t, framework.WithUbuntu124NutanixUUID(), + framework.WithPrismElementClusterUUID(), + framework.WithSubnetUUID()), + framework.WithClusterFiller(api.WithKubernetesVersion(v1alpha1.Kube124)), + ) + runSimpleFlow(test) +} diff --git a/test/framework/nutanix.go b/test/framework/nutanix.go index 1b0c4e024658..f8e91addf4c9 100644 --- a/test/framework/nutanix.go +++ b/test/framework/nutanix.go @@ -23,18 +23,26 @@ const ( nutanixMachineVCPUSocket = "T_NUTANIX_MACHINE_VCPU_SOCKET" nutanixPrismElementClusterName = "T_NUTANIX_PRISM_ELEMENT_CLUSTER_NAME" + nutanixPrismElementClusterUUID = "T_NUTANIX_PRISM_ELEMENT_CLUSTER_UUID" nutanixSSHAuthorizedKey = "T_NUTANIX_SSH_AUTHORIZED_KEY" - nutanixSubnetName = "T_NUTANIX_SUBNET_NAME" + + nutanixSubnetName = "T_NUTANIX_SUBNET_NAME" + nutanixSubnetUUID = "T_NUTANIX_SUBNET_UUID" nutanixControlPlaneEndpointIP = "T_NUTANIX_CONTROL_PLANE_ENDPOINT_IP" nutanixControlPlaneCidrVar = "T_NUTANIX_CONTROL_PLANE_CIDR" nutanixPodCidrVar = "T_NUTANIX_POD_CIDR" nutanixServiceCidrVar = "T_NUTANIX_SERVICE_CIDR" - nutanixTemplateUbuntu121Var = "T_NUTANIX_TEMPLATE_UBUNTU_1_21" - nutanixTemplateUbuntu122Var = "T_NUTANIX_TEMPLATE_UBUNTU_1_22" - nutanixTemplateUbuntu123Var = "T_NUTANIX_TEMPLATE_UBUNTU_1_23" - nutanixTemplateUbuntu124Var = "T_NUTANIX_TEMPLATE_UBUNTU_1_24" + nutanixTemplateNameUbuntu121Var = "T_NUTANIX_TEMPLATE_NAME_UBUNTU_1_21" + nutanixTemplateNameUbuntu122Var = "T_NUTANIX_TEMPLATE_NAME_UBUNTU_1_22" + nutanixTemplateNameUbuntu123Var = "T_NUTANIX_TEMPLATE_NAME_UBUNTU_1_23" + nutanixTemplateNameUbuntu124Var = "T_NUTANIX_TEMPLATE_NAME_UBUNTU_1_24" + + nutanixTemplateUUIDUbuntu121Var = "T_NUTANIX_TEMPLATE_UUID_UBUNTU_1_21" + nutanixTemplateUUIDUbuntu122Var = "T_NUTANIX_TEMPLATE_UUID_UBUNTU_1_22" + nutanixTemplateUUIDUbuntu123Var = "T_NUTANIX_TEMPLATE_UUID_UBUNTU_1_23" + nutanixTemplateUUIDUbuntu124Var = "T_NUTANIX_TEMPLATE_UUID_UBUNTU_1_24" ) var requiredNutanixEnvVars = []string{ @@ -50,14 +58,20 @@ var requiredNutanixEnvVars = []string{ nutanixMachineVCPUsPerSocket, nutanixMachineVCPUSocket, nutanixPrismElementClusterName, + nutanixPrismElementClusterUUID, nutanixSSHAuthorizedKey, nutanixSubnetName, + nutanixSubnetUUID, nutanixPodCidrVar, nutanixServiceCidrVar, - nutanixTemplateUbuntu121Var, - nutanixTemplateUbuntu122Var, - nutanixTemplateUbuntu123Var, - nutanixTemplateUbuntu124Var, + nutanixTemplateNameUbuntu121Var, + nutanixTemplateNameUbuntu122Var, + nutanixTemplateNameUbuntu123Var, + nutanixTemplateNameUbuntu124Var, + nutanixTemplateUUIDUbuntu121Var, + nutanixTemplateUUIDUbuntu122Var, + nutanixTemplateUUIDUbuntu123Var, + nutanixTemplateUUIDUbuntu124Var, nutanixInsecure, } @@ -86,10 +100,15 @@ func NewNutanix(t *testing.T, opts ...NutanixOpt) *Nutanix { api.WithNutanixStringFromEnvVar(nutanixSystemDiskSize, api.WithNutanixMachineSystemDiskSize), api.WithNutanixInt32FromEnvVar(nutanixMachineVCPUsPerSocket, api.WithNutanixMachineVCPUsPerSocket), api.WithNutanixInt32FromEnvVar(nutanixMachineVCPUSocket, api.WithNutanixMachineVCPUSocket), - api.WithNutanixStringFromEnvVar(nutanixPrismElementClusterName, api.WithNutanixPrismElementClusterName), api.WithNutanixStringFromEnvVar(nutanixSSHAuthorizedKey, api.WithNutanixSSHAuthorizedKey), - api.WithNutanixStringFromEnvVar(nutanixSubnetName, api.WithNutanixSubnetName), api.WithNutanixBoolFromEnvVar(nutanixInsecure, api.WithNutanixInsecure), + // Assumption: generated clusterconfig by nutanix provider sets name as id type by default. + // for uuid specific id type, we will set it thru each specific test so that current CI + // works as is with name id type for following resources + api.WithNutanixStringFromEnvVar(nutanixPrismElementClusterName, api.WithNutanixPrismElementClusterName), + api.WithNutanixStringFromEnvVar(nutanixPrismElementClusterUUID, api.WithNutanixPrismElementClusterUUID), + api.WithNutanixStringFromEnvVar(nutanixSubnetName, api.WithNutanixSubnetName), + api.WithNutanixStringFromEnvVar(nutanixSubnetUUID, api.WithNutanixSubnetUUID), }, } @@ -160,70 +179,132 @@ func (s *Nutanix) WithProviderUpgrade(fillers ...api.NutanixFiller) ClusterE2ETe } } -// WithUbuntu121Nutanix returns a NutanixOpt that adds API fillers to use a Ubuntu vSphere template for k8s 1.21 +// WithUbuntu121Nutanix returns a NutanixOpt that adds API fillers to use a Ubuntu Nutanix template for k8s 1.21 // and the "ubuntu" osFamily in all machine configs. func WithUbuntu121Nutanix() NutanixOpt { return func(v *Nutanix) { v.fillers = append(v.fillers, - api.WithNutanixStringFromEnvVar(nutanixTemplateUbuntu121Var, api.WithNutanixMachineTemplateImageName), + api.WithNutanixStringFromEnvVar(nutanixTemplateNameUbuntu121Var, api.WithNutanixMachineTemplateImageName), api.WithOsFamilyForAllNutanixMachines(anywherev1.Ubuntu), ) } } -// WithUbuntu122Nutanix returns a NutanixOpt that adds API fillers to use a Ubuntu vSphere template for k8s 1.22 +// WithUbuntu122Nutanix returns a NutanixOpt that adds API fillers to use a Ubuntu Nutanix template for k8s 1.22 // and the "ubuntu" osFamily in all machine configs. func WithUbuntu122Nutanix() NutanixOpt { return func(v *Nutanix) { v.fillers = append(v.fillers, - api.WithNutanixStringFromEnvVar(nutanixTemplateUbuntu122Var, api.WithNutanixMachineTemplateImageName), + api.WithNutanixStringFromEnvVar(nutanixTemplateNameUbuntu122Var, api.WithNutanixMachineTemplateImageName), api.WithOsFamilyForAllNutanixMachines(anywherev1.Ubuntu), ) } } -// WithUbuntu123Nutanix returns a NutanixOpt that adds API fillers to use a Ubuntu vSphere template for k8s 1.23 +// WithUbuntu123Nutanix returns a NutanixOpt that adds API fillers to use a Ubuntu Nutanix template for k8s 1.23 // and the "ubuntu" osFamily in all machine configs. func WithUbuntu123Nutanix() NutanixOpt { return func(v *Nutanix) { v.fillers = append(v.fillers, - api.WithNutanixStringFromEnvVar(nutanixTemplateUbuntu123Var, api.WithNutanixMachineTemplateImageName), + api.WithNutanixStringFromEnvVar(nutanixTemplateNameUbuntu123Var, api.WithNutanixMachineTemplateImageName), api.WithOsFamilyForAllNutanixMachines(anywherev1.Ubuntu), ) } } -// WithUbuntu124Nutanix returns a NutanixOpt that adds API fillers to use a Ubuntu vSphere template for k8s 1.24 +// WithUbuntu124Nutanix returns a NutanixOpt that adds API fillers to use a Ubuntu Nutanix template for k8s 1.24 // and the "ubuntu" osFamily in all machine configs. func WithUbuntu124Nutanix() NutanixOpt { return func(v *Nutanix) { v.fillers = append(v.fillers, - api.WithNutanixStringFromEnvVar(nutanixTemplateUbuntu124Var, api.WithNutanixMachineTemplateImageName), + api.WithNutanixStringFromEnvVar(nutanixTemplateNameUbuntu124Var, api.WithNutanixMachineTemplateImageName), + api.WithOsFamilyForAllNutanixMachines(anywherev1.Ubuntu), + ) + } +} + +// WithUbuntu121NutanixUUID returns a NutanixOpt that adds API fillers to use a Ubuntu Nutanix template UUID for k8s 1.21 +// and the "ubuntu" osFamily in all machine configs. +func WithUbuntu121NutanixUUID() NutanixOpt { + return func(v *Nutanix) { + v.fillers = append(v.fillers, + api.WithNutanixStringFromEnvVar(nutanixTemplateUUIDUbuntu121Var, api.WithNutanixMachineTemplateImageUUID), + api.WithOsFamilyForAllNutanixMachines(anywherev1.Ubuntu), + ) + } +} + +// WithUbuntu122NutanixUUID returns a NutanixOpt that adds API fillers to use a Ubuntu Nutanix template UUID for k8s 1.22 +// and the "ubuntu" osFamily in all machine configs. +func WithUbuntu122NutanixUUID() NutanixOpt { + return func(v *Nutanix) { + v.fillers = append(v.fillers, + api.WithNutanixStringFromEnvVar(nutanixTemplateUUIDUbuntu122Var, api.WithNutanixMachineTemplateImageUUID), + api.WithOsFamilyForAllNutanixMachines(anywherev1.Ubuntu), + ) + } +} + +// WithUbuntu123NutanixUUID returns a NutanixOpt that adds API fillers to use a Ubuntu Nutanix template UUID for k8s 1.23 +// and the "ubuntu" osFamily in all machine configs. +func WithUbuntu123NutanixUUID() NutanixOpt { + return func(v *Nutanix) { + v.fillers = append(v.fillers, + api.WithNutanixStringFromEnvVar(nutanixTemplateUUIDUbuntu123Var, api.WithNutanixMachineTemplateImageUUID), + api.WithOsFamilyForAllNutanixMachines(anywherev1.Ubuntu), + ) + } +} + +// WithUbuntu124NutanixUUID returns a NutanixOpt that adds API fillers to use a Ubuntu Nutanix template UUID for k8s 1.24 +// and the "ubuntu" osFamily in all machine configs. +func WithUbuntu124NutanixUUID() NutanixOpt { + return func(v *Nutanix) { + v.fillers = append(v.fillers, + api.WithNutanixStringFromEnvVar(nutanixTemplateUUIDUbuntu124Var, api.WithNutanixMachineTemplateImageUUID), api.WithOsFamilyForAllNutanixMachines(anywherev1.Ubuntu), ) } } +// WithPrismElementClusterUUID returns a NutanixOpt that adds API fillers to use a PE Cluster UUID. +func WithPrismElementClusterUUID() NutanixOpt { + return func(v *Nutanix) { + v.fillers = append(v.fillers, + api.WithNutanixStringFromEnvVar(nutanixPrismElementClusterUUID, api.WithNutanixMachineTemplateImageUUID), + ) + } +} + +// WithSubnetUUID returns a NutanixOpt that adds API fillers to use a Subnet UUID. +func WithSubnetUUID() NutanixOpt { + return func(v *Nutanix) { + v.fillers = append(v.fillers, + api.WithNutanixStringFromEnvVar(nutanixSubnetUUID, api.WithNutanixSubnetUUID), + ) + } +} + // UpdateNutanixUbuntuTemplate121Var returns NutanixFiller by reading the env var and setting machine config's // image name parameter in the spec. func UpdateNutanixUbuntuTemplate121Var() api.NutanixFiller { - return api.WithNutanixStringFromEnvVar(nutanixTemplateUbuntu121Var, api.WithNutanixMachineTemplateImageName) + return api.WithNutanixStringFromEnvVar(nutanixTemplateNameUbuntu121Var, api.WithNutanixMachineTemplateImageName) } // UpdateNutanixUbuntuTemplate122Var returns NutanixFiller by reading the env var and setting machine config's // image name parameter in the spec. func UpdateNutanixUbuntuTemplate122Var() api.NutanixFiller { - return api.WithNutanixStringFromEnvVar(nutanixTemplateUbuntu122Var, api.WithNutanixMachineTemplateImageName) + return api.WithNutanixStringFromEnvVar(nutanixTemplateNameUbuntu122Var, api.WithNutanixMachineTemplateImageName) } // UpdateNutanixUbuntuTemplate123Var returns NutanixFiller by reading the env var and setting machine config's // image name parameter in the spec. func UpdateNutanixUbuntuTemplate123Var() api.NutanixFiller { - return api.WithNutanixStringFromEnvVar(nutanixTemplateUbuntu123Var, api.WithNutanixMachineTemplateImageName) + return api.WithNutanixStringFromEnvVar(nutanixTemplateNameUbuntu123Var, api.WithNutanixMachineTemplateImageName) } // UpdateNutanixUbuntuTemplate124Var returns NutanixFiller by reading the env var and setting machine config's // image name parameter in the spec. func UpdateNutanixUbuntuTemplate124Var() api.NutanixFiller { - return api.WithNutanixStringFromEnvVar(nutanixTemplateUbuntu124Var, api.WithNutanixMachineTemplateImageName) + return api.WithNutanixStringFromEnvVar(nutanixTemplateNameUbuntu124Var, api.WithNutanixMachineTemplateImageName) }