Skip to content
Closed
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
24 changes: 12 additions & 12 deletions upi/vsphere/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Pre-Requisites

* terraform
* jq
* Terraform >= 0.12
* Jq
* AWS profile set and a region specified. The installation will create AWS route53 resources for routing to the OpenShift cluster.

# Build a Cluster

Expand Down Expand Up @@ -30,30 +31,29 @@ sshKey: YOUR_SSH_KEY

3. Fill out a terraform.tfvars file with the ignition configs generated.
There is an example terraform.tfvars file in this directory named terraform.tfvars.example. The example file is set up for use with the dev cluster running at vcsa.vmware.devcluster.openshift.com. At a minimum, you need to set values for the following variables.

* cluster_id
* cluster_domain
* vsphere_user
* vsphere_password
* ipam_token
* bootstrap_ignition_url
* bootstrap_ignition_url => The bootstrap ignition config must be placed in a location that will be accessible by the bootstrap machine. For example, you could store the bootstrap ignition config in a gist.
* control_plane_ignition
* compute_ignition
The bootstrap ignition config must be placed in a location that will be accessible by the bootstrap machine. For example, you could store the bootstrap ignition config in a gist.

4. Run `terraform init`.

5. Ensure that you have you AWS profile set and a region specified. The installation will use create AWS route53 resources for routing to the OpenShift cluster.
Copy link
Contributor

Choose a reason for hiding this comment

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

Route53 is still being used for DNS, isn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that is correct @vrutkovs is still used hence why i've moved it up in the pre-req section so folks know upfront what is required from the existing code base.

I can extend if y'all okay with to mention why R53 provider is used and not DNS provider, let me know

4. Run `terraform init`.

6. Run `terraform apply -auto-approve`.
5. Run `terraform apply -auto-approve`.
This will reserve IP addresses for the VMs.

7. Run `openshift-install wait-for bootstrap-complete`. Wait for the bootstrapping to complete.
6. Run `openshift-install wait-for bootstrap-complete`. Wait for the bootstrapping to complete.

8. Run `terraform apply -auto-approve -var 'bootstrap_complete=true'`.
7. Run `terraform apply -auto-approve -var 'bootstrap_complete=true'`.
This will destroy the bootstrap VM.

9. Run `openshift-install wait-for install-complete`. Wait for the cluster install to finish.
8. Run `openshift-install wait-for install-complete`. Wait for the cluster install to finish.

10. Enjoy your new OpenShift cluster.
9. Enjoy your new OpenShift cluster.

11. Run `terraform destroy -auto-approve`.
10. Run `terraform destroy -auto-approve`.
4 changes: 2 additions & 2 deletions upi/vsphere/folder/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
resource "vsphere_folder" "folder" {
path = "${var.path}"
path = var.path
type = "vm"
datacenter_id = "${var.datacenter_id}"
datacenter_id = var.datacenter_id
}
2 changes: 1 addition & 1 deletion upi/vsphere/folder/output.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
output "path" {
value = "${vsphere_folder.folder.path}"
value = vsphere_folder.folder.path
}
4 changes: 2 additions & 2 deletions upi/vsphere/folder/variables.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
variable "path" {
type = "string"
type = string
}

variable "datacenter_id" {
type = "string"
type = string
}
20 changes: 10 additions & 10 deletions upi/vsphere/machine/ignition.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
locals {
mask = "${element(split("/", var.machine_cidr), 1)}"
gw = "${cidrhost(var.machine_cidr,1)}"
mask = element(split("/", var.machine_cidr), 1)
gw = cidrhost(var.machine_cidr,1)

ignition_encoded = "data:text/plain;charset=utf-8;base64,${base64encode(var.ignition)}"
}

data "ignition_file" "hostname" {
count = "${var.instance_count}"
count = var.instance_count

filesystem = "root"
path = "/etc/hostname"
Expand All @@ -18,7 +18,7 @@ data "ignition_file" "hostname" {
}

data "ignition_file" "static_ip" {
count = "${var.instance_count}"
count = var.instance_count

filesystem = "root"
path = "/etc/sysconfig/network-scripts/ifcfg-ens192"
Expand All @@ -41,7 +41,7 @@ EOF
}

data "ignition_systemd_unit" "restart" {
count = "${var.instance_count}"
count = var.instance_count

name = "restart.service"

Expand All @@ -57,18 +57,18 @@ EOF
}

data "ignition_config" "ign" {
count = "${var.instance_count}"
count = var.instance_count

append {
source = "${var.ignition_url != "" ? var.ignition_url : local.ignition_encoded}"
source = var.ignition_url != "" ? var.ignition_url : local.ignition_encoded
}

systemd = [
"${data.ignition_systemd_unit.restart.*.id[count.index]}",
data.ignition_systemd_unit.restart.*.id[count.index],
]

files = [
"${data.ignition_file.hostname.*.id[count.index]}",
"${data.ignition_file.static_ip.*.id[count.index]}",
data.ignition_file.hostname.*.id[count.index],
data.ignition_file.static_ip.*.id[count.index],
]
}
16 changes: 8 additions & 8 deletions upi/vsphere/machine/ip.tf
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
locals {
network = "${cidrhost(var.machine_cidr,0)}"
ip_addresses = ["${coalescelist(var.ip_addresses, data.template_file.ip_address.*.rendered)}"]
network = cidrhost(var.machine_cidr,0)
ip_addresses = coalescelist(var.ip_addresses, data.template_file.ip_address.*.rendered)
}

data "external" "ip_address" {
count = "${length(var.ip_addresses) == 0 ? var.instance_count : 0}"
count = length(var.ip_addresses) == 0 ? var.instance_count : 0

program = ["bash", "${path.module}/cidr_to_ip.sh"]

query = {
hostname = "${var.name}-${count.index}.${var.cluster_domain}"
ipam = "${var.ipam}"
ipam_token = "${var.ipam_token}"
ipam = var.ipam
ipam_token = var.ipam_token
}

depends_on = ["null_resource.ip_address"]
}

data "template_file" "ip_address" {
count = "${length(var.ip_addresses) == 0 ? var.instance_count : 0}"
count = length(var.ip_addresses) == 0 ? var.instance_count : 0

template = "${lookup(data.external.ip_address.*.result[count.index], "ip_address")}"
template = lookup(data.external.ip_address.*.result[count.index], "ip_address")
}

resource "null_resource" "ip_address" {
count = "${length(var.ip_addresses) == 0 ? var.instance_count : 0}"
count = length(var.ip_addresses) == 0 ? var.instance_count : 0

provisioner "local-exec" {
command = <<EOF
Expand Down
2 changes: 1 addition & 1 deletion upi/vsphere/machine/output.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
output "ip_addresses" {
value = ["${local.ip_addresses}"]
value = [local.ip_addresses]
}
30 changes: 15 additions & 15 deletions upi/vsphere/machine/variables.tf
Original file line number Diff line number Diff line change
@@ -1,61 +1,61 @@
variable "name" {
type = "string"
type = string
}

variable "instance_count" {
type = "string"
type = string
}

variable "ignition" {
type = "string"
type = string
default = ""
}

variable "ignition_url" {
type = "string"
type = string
default = ""
}

variable "resource_pool_id" {
type = "string"
type = string
}

variable "folder" {
type = "string"
type = string
}

variable "datastore" {
type = "string"
type = string
}

variable "network" {
type = "string"
type = string
}

variable "cluster_domain" {
type = "string"
type = string
}

variable "datacenter_id" {
type = "string"
type = string
}

variable "template" {
type = "string"
type = string
}

variable "machine_cidr" {
type = "string"
type = string
}

variable "ipam" {
type = "string"
type = string
}

variable "ipam_token" {
type = "string"
type = string
}

variable "ip_addresses" {
type = "list"
type = list(string)
}
Loading