Skip to content
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
44 changes: 21 additions & 23 deletions data/data/install.openshift.io_installconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3202,20 +3202,20 @@ spec:
type: array
uniqueItems: true
cluster:
description: Cluster is the name of the cluster virtual machines
will be cloned into.
description: 'Cluster is the name of the cluster virtual machines
will be cloned into. Deprecated: Use FailureDomains.Topology.Cluster'
type: string
clusterOSImage:
description: ClusterOSImage overrides the url provided in rhcos.json
to download the RHCOS OVA
type: string
datacenter:
description: Datacenter is the name of the datacenter to use in
the vCenter.
description: 'Datacenter is the name of the datacenter to use
in the vCenter. Deprecated: Use FailureDomains.Topology.Datacenter'
type: string
defaultDatastore:
description: DefaultDatastore is the default datastore to use
for provisioning volumes.
description: 'DefaultDatastore is the default datastore to use
for provisioning volumes. Deprecated: Use FailureDomains.Topology.Datastore'
type: string
defaultMachinePlatform:
description: DefaultMachinePlatform is the default configuration
Expand Down Expand Up @@ -3273,7 +3273,7 @@ spec:
properties:
name:
description: name defines the name of the FailureDomain
This name is abritrary but will be used in VSpherePlatformDeploymentZone
This name is arbitrary but will be used in VSpherePlatformDeploymentZone
for association.
maxLength: 256
minLength: 1
Expand Down Expand Up @@ -3352,9 +3352,10 @@ spec:
type: object
type: array
folder:
description: Folder is the absolute path of the folder that will
description: 'Folder is the absolute path of the folder that will
be used and/or created for virtual machines. The absolute path
is of the form /<datacenter>/vm/<folder>/<subfolder>.
is of the form /<datacenter>/vm/<folder>/<subfolder>. Deprecated:
Use FailureDomains.Topology.Folder'
pattern: ^/.*?/vm/.*?
type: string
ingressVIP:
Expand All @@ -3372,24 +3373,26 @@ spec:
type: array
uniqueItems: true
network:
description: Network specifies the name of the network to be used
by the cluster.
description: 'Network specifies the name of the network to be
used by the cluster. Deprecated: Use FailureDomains.Topology.Network'
type: string
password:
description: Password is the password for the user to use to connect
to the vCenter.
description: 'Password is the password for the user to use to
connect to the vCenter. Deprecated: Use VCenters.Password'
type: string
resourcePool:
description: ResourcePool is the absolute path of the resource
description: 'ResourcePool is the absolute path of the resource
pool where virtual machines will be created. The absolute path
is of the form /<datacenter>/host/<cluster>/Resources/<resourcepool>.
Deprecated: Use FailureDomains.Topology.ResourcePool'
type: string
username:
description: Username is the name of the user to use to connect
to the vCenter.
description: 'Username is the name of the user to use to connect
to the vCenter. Deprecated: Use VCenters.Username'
type: string
vCenter:
description: VCenter is the domain name or IP address of the vCenter.
description: 'VCenter is the domain name or IP address of the
vCenter. Deprecated: Use VCenters.Server'
type: string
vcenters:
description: VCenters holds the connection details for services
Expand All @@ -3413,6 +3416,7 @@ spec:
description: port is the TCP port that will be used to communicate
to the vCenter endpoint. This is typically unchanged from
the default of HTTPS TCP/443.
format: int32
maximum: 32767
minimum: 1
type: integer
Expand All @@ -3434,12 +3438,6 @@ spec:
maxItems: 1
minItems: 1
type: array
required:
- datacenter
- defaultDatastore
- password
- username
- vCenter
type: object
type: object
proxy:
Expand Down
62 changes: 33 additions & 29 deletions data/data/vsphere/bootstrap/main.tf
Original file line number Diff line number Diff line change
@@ -1,54 +1,58 @@
locals {
description = "Created By OpenShift Installer"
vcenter_key = keys(var.vsphere_vcenters)[0]
}

provider "vsphere" {
user = var.vsphere_username
password = var.vsphere_password
vsphere_server = var.vsphere_url
user = var.vsphere_vcenters[local.vcenter_key].user
password = var.vsphere_vcenters[local.vcenter_key].password
vsphere_server = var.vsphere_vcenters[local.vcenter_key].server
allow_unverified_ssl = false
}

resource "vsphere_virtual_machine" "vm_bootstrap" {
name = "${var.cluster_id}-bootstrap"
resource_pool_id = var.resource_pool
datastore_id = var.datastore
num_cpus = 4
memory = 16384
guest_id = var.guest_id
folder = var.folder
enable_disk_uuid = "true"
annotation = local.description

wait_for_guest_net_timeout = 0
wait_for_guest_net_routable = false
name = "${var.cluster_id}-bootstrap"
resource_pool_id = var.resource_pool[0].id
datastore_id = var.datastore[0].id
num_cpus = var.vsphere_control_planes[0].numCPUs
num_cores_per_socket = var.vsphere_control_planes[0].numCoresPerSocket
memory = var.vsphere_control_planes[0].memoryMiB
guest_id = var.template[0].guest_id
folder = trimprefix(var.vsphere_control_planes[0].workspace.folder, "/${var.vsphere_control_planes[0].workspace.datacenter}/vm")
enable_disk_uuid = "true"
annotation = local.description
wait_for_guest_net_timeout = "0"
wait_for_guest_net_routable = "false"
tags = var.tags

network_interface {
network_id = var.vsphere_network
network_id = var.template[0].network_interfaces.0.network_id
}

disk {
label = "disk0"
size = 120
eagerly_scrub = var.scrub_disk
thin_provisioned = var.thin_disk
}
lifecycle {
ignore_changes = [
disk[0].eagerly_scrub,
]
}
label = "disk0"
size = var.vsphere_control_planes[0].diskGiB

eagerly_scrub = var.template[0].disks.0.eagerly_scrub
thin_provisioned = var.template[0].disks.0.thin_provisioned
}

clone {
template_uuid = var.template
template_uuid = var.template[0].uuid
}

extra_config = {
"guestinfo.ignition.config.data" = base64encode(var.ignition_bootstrap)
"guestinfo.ignition.config.data.encoding" = "base64"
"guestinfo.hostname" = "${var.cluster_id}-bootstrap"
"guestinfo.domain" = "${var.cluster_domain}"
"stealclock.enable" = "TRUE"
}

// Potential issues on destroy if disk type changes
// underneath terraform.
lifecycle {
ignore_changes = [
disk[0],
]
}
tags = var.tags
}
30 changes: 9 additions & 21 deletions data/data/vsphere/bootstrap/variables.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
variable "resource_pool" {
type = string
type = list(any)
default = []
}

variable "bootstrap_moid" {
Expand All @@ -17,34 +18,21 @@ variable "control_plane_moids" {
default = []
}

variable "folder" {
type = string
}

variable "datastore" {
type = string
type = list(any)
default = []
}

variable "datacenter" {
type = string
type = list(any)
default = []
}

variable "template" {
type = string
}

variable "guest_id" {
type = string
type = list(any)
default = []
}

variable "tags" {
type = list
}

variable "thin_disk" {
type = bool
}

variable "scrub_disk" {
type = bool
type = list(any)
}
58 changes: 38 additions & 20 deletions data/data/vsphere/master/main.tf
Original file line number Diff line number Diff line change
@@ -1,44 +1,64 @@
locals {
description = "Created By OpenShift Installer"
description = "Created By OpenShift Installer"
vcenter_key = keys(var.vsphere_vcenters)[0]
template_map = { for t in var.template : t.name => t }
}

provider "vsphere" {
user = var.vsphere_username
password = var.vsphere_password
vsphere_server = var.vsphere_url
user = var.vsphere_vcenters[local.vcenter_key].user
password = var.vsphere_vcenters[local.vcenter_key].password
vsphere_server = var.vsphere_vcenters[local.vcenter_key].server
allow_unverified_ssl = false
}

data "vsphere_datacenter" "datacenter" {
count = var.master_count
name = var.vsphere_control_planes[count.index].workspace.datacenter
}

data "vsphere_resource_pool" "resource_pool" {
count = var.master_count
name = var.vsphere_control_planes[count.index].workspace.resourcePool
}

data "vsphere_datastore" "datastore" {
count = var.master_count
name = var.vsphere_control_planes[count.index].workspace.datastore
datacenter_id = data.vsphere_datacenter.datacenter[count.index].id
}

resource "vsphere_virtual_machine" "vm_master" {
count = var.master_count

name = "${var.cluster_id}-master-${count.index}"
resource_pool_id = var.resource_pool
datastore_id = var.datastore
num_cpus = var.vsphere_control_plane_num_cpus
num_cores_per_socket = var.vsphere_control_plane_cores_per_socket
memory = var.vsphere_control_plane_memory_mib
guest_id = var.guest_id
folder = var.folder
enable_disk_uuid = "true"
annotation = local.description
resource_pool_id = data.vsphere_resource_pool.resource_pool[count.index].id
datastore_id = data.vsphere_datastore.datastore[count.index].id
num_cpus = var.vsphere_control_planes[0].numCPUs
num_cores_per_socket = var.vsphere_control_planes[0].numCoresPerSocket
memory = var.vsphere_control_planes[0].memoryMiB
folder = trimprefix(var.vsphere_control_planes[count.index].workspace.folder, "/${var.vsphere_control_planes[count.index].workspace.datacenter}/vm")

guest_id = local.template_map[var.vsphere_control_planes[count.index].template].guest_id

enable_disk_uuid = "true"
annotation = local.description
wait_for_guest_net_timeout = "0"
wait_for_guest_net_routable = "false"
tags = var.tags

network_interface {
network_id = var.vsphere_network
network_id = local.template_map[var.vsphere_control_planes[count.index].template].network_interfaces.0.network_id
}

disk {
label = "disk0"
size = var.vsphere_control_plane_disk_gib
eagerly_scrub = var.scrub_disk
thin_provisioned = var.thin_disk
size = var.vsphere_control_planes[0].diskGiB
eagerly_scrub = local.template_map[var.vsphere_control_planes[count.index].template].disks.0.eagerly_scrub
thin_provisioned = local.template_map[var.vsphere_control_planes[count.index].template].disks.0.thin_provisioned
}

clone {
template_uuid = var.template
template_uuid = local.template_map[var.vsphere_control_planes[count.index].template].uuid
}

extra_config = {
Expand All @@ -47,6 +67,4 @@ resource "vsphere_virtual_machine" "vm_master" {
"guestinfo.hostname" = "${var.cluster_id}-master-${count.index}"
"stealclock.enable" = "TRUE"
}

tags = var.tags
}
4 changes: 2 additions & 2 deletions data/data/vsphere/master/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
output "control_plane_ips" {
value = vsphere_virtual_machine.vm_master.*.default_ip_address
value = [for k, v in vsphere_virtual_machine.vm_master : v.default_ip_address]
}

output "control_plane_moids" {
value = vsphere_virtual_machine.vm_master.*.moid
value = [for k, v in vsphere_virtual_machine.vm_master : v.moid]
}
29 changes: 7 additions & 22 deletions data/data/vsphere/master/variables.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
variable "resource_pool" {
type = string
}

variable "folder" {
type = string
type = list(any)
}

variable "bootstrap_moid" {
Expand All @@ -12,29 +8,18 @@ variable "bootstrap_moid" {
}

variable "datastore" {
type = string
type = list(any)
}

variable "datacenter" {
type = string
}

variable "template" {
type = string
}

variable "guest_id" {
type = string
type = list(any)
}

variable "tags" {
type = list
type = list(any)
}

variable "thin_disk" {
type = bool
}

variable "scrub_disk" {
type = bool
variable "template" {
type = list(any)
default = []
}
Loading