mirror of
https://github.com/openshift/installer.git
synced 2026-02-05 15:47:14 +01:00
SPLAT-1272: Modify the terraform variables to support Nutanix Failure Domains
This commit is contained in:
@@ -24,7 +24,7 @@ resource "nutanix_image" "bootstrap_ignition" {
|
||||
resource "nutanix_virtual_machine" "vm_bootstrap" {
|
||||
name = "${var.cluster_id}-bootstrap"
|
||||
description = local.description
|
||||
cluster_uuid = var.nutanix_prism_element_uuid
|
||||
cluster_uuid = var.nutanix_prism_element_uuids[0]
|
||||
num_vcpus_per_socket = 4
|
||||
num_sockets = 1
|
||||
memory_size_mib = 16384
|
||||
@@ -69,6 +69,6 @@ resource "nutanix_virtual_machine" "vm_bootstrap" {
|
||||
}
|
||||
|
||||
nic_list {
|
||||
subnet_uuid = var.nutanix_subnet_uuid
|
||||
subnet_uuid = var.nutanix_subnet_uuids[0]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ resource "nutanix_virtual_machine" "vm_master" {
|
||||
count = var.master_count
|
||||
description = local.description
|
||||
name = "${var.cluster_id}-master-${count.index}"
|
||||
cluster_uuid = var.nutanix_prism_element_uuid
|
||||
cluster_uuid = var.nutanix_prism_element_uuids[count.index]
|
||||
num_vcpus_per_socket = var.nutanix_control_plane_cores_per_socket
|
||||
num_sockets = var.nutanix_control_plane_num_cpus
|
||||
memory_size_mib = var.nutanix_control_plane_memory_mib
|
||||
@@ -107,6 +107,6 @@ resource "nutanix_virtual_machine" "vm_master" {
|
||||
|
||||
guest_customization_cloud_init_user_data = base64encode(element(data.ignition_config.master_ignition_config.*.rendered, count.index))
|
||||
nic_list {
|
||||
subnet_uuid = var.nutanix_subnet_uuid
|
||||
subnet_uuid = var.nutanix_subnet_uuids[count.index]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,9 +22,10 @@ variable "nutanix_password" {
|
||||
description = "Prism Central user password"
|
||||
}
|
||||
|
||||
variable "nutanix_prism_element_uuid" {
|
||||
type = string
|
||||
description = "This is the uuid of the Prism Element cluster."
|
||||
variable "nutanix_prism_element_uuids" {
|
||||
type = list(string)
|
||||
default = []
|
||||
description = "This is the uuids of the Prism Element clusters."
|
||||
}
|
||||
|
||||
variable "nutanix_image_uri" {
|
||||
@@ -37,9 +38,10 @@ variable "nutanix_image" {
|
||||
description = "This is the name to the image that will be imported into Prism Central."
|
||||
}
|
||||
|
||||
variable "nutanix_subnet_uuid" {
|
||||
type = string
|
||||
description = "This is the uuid of the publicly accessible subnet for cluster ingress and access."
|
||||
variable "nutanix_subnet_uuids" {
|
||||
type = list(string)
|
||||
default = []
|
||||
description = "This is the uuids of the publicly accessible subnets for cluster ingress and access."
|
||||
}
|
||||
|
||||
variable "nutanix_bootstrap_ignition_image" {
|
||||
|
||||
@@ -20,8 +20,8 @@ type config struct {
|
||||
NumCoresPerSocket int64 `json:"nutanix_control_plane_cores_per_socket"`
|
||||
ProjectUUID string `json:"nutanix_control_plane_project_uuid"`
|
||||
Categories map[string]string `json:"nutanix_control_plane_categories"`
|
||||
PrismElementUUID string `json:"nutanix_prism_element_uuid"`
|
||||
SubnetUUID string `json:"nutanix_subnet_uuid"`
|
||||
PrismElementUUIDs []string `json:"nutanix_prism_element_uuids"`
|
||||
SubnetUUIDs []string `json:"nutanix_subnet_uuids"`
|
||||
Image string `json:"nutanix_image"`
|
||||
ImageURI string `json:"nutanix_image_uri"`
|
||||
BootstrapIgnitionImage string `json:"nutanix_bootstrap_ignition_image"`
|
||||
@@ -49,6 +49,7 @@ func TFVars(sources TFVarsSources) ([]byte, error) {
|
||||
|
||||
bootstrapIgnitionImageName := nutanixtypes.BootISOImageName(sources.ClusterID)
|
||||
controlPlaneConfig := sources.ControlPlaneConfigs[0]
|
||||
cpCount := len(sources.ControlPlaneConfigs)
|
||||
cfg := &config{
|
||||
Port: sources.Port,
|
||||
PrismCentralAddress: sources.PrismCentralAddress,
|
||||
@@ -58,14 +59,19 @@ func TFVars(sources TFVarsSources) ([]byte, error) {
|
||||
DiskSizeMiB: controlPlaneConfig.SystemDiskSize.Value() / (1024 * 1024),
|
||||
NumCPUs: int64(controlPlaneConfig.VCPUSockets),
|
||||
NumCoresPerSocket: int64(controlPlaneConfig.VCPUsPerSocket),
|
||||
PrismElementUUID: *controlPlaneConfig.Cluster.UUID,
|
||||
SubnetUUID: *controlPlaneConfig.Subnets[0].UUID,
|
||||
PrismElementUUIDs: make([]string, cpCount),
|
||||
SubnetUUIDs: make([]string, cpCount),
|
||||
Image: *controlPlaneConfig.Image.Name,
|
||||
ImageURI: sources.ImageURI,
|
||||
BootstrapIgnitionImage: bootstrapIgnitionImageName,
|
||||
BootstrapIgnitionImageFilePath: bootstrapIgnitionImagePath,
|
||||
}
|
||||
|
||||
for i, cpcfg := range sources.ControlPlaneConfigs {
|
||||
cfg.PrismElementUUIDs[i] = *cpcfg.Cluster.UUID
|
||||
cfg.SubnetUUIDs[i] = *cpcfg.Subnets[0].UUID
|
||||
}
|
||||
|
||||
if controlPlaneConfig.Project.Type == machinev1.NutanixIdentifierUUID {
|
||||
cfg.ProjectUUID = *controlPlaneConfig.Project.UUID
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user