diff --git a/IaC-test/nodes.tf b/IaC-test/nodes.tf index 36890d7..30a9ae1 100644 --- a/IaC-test/nodes.tf +++ b/IaC-test/nodes.tf @@ -56,15 +56,10 @@ resource "openstack_compute_instance_v2" "controller-nodes" { # Worker node resources # - -# -# Controller node resources -# - resource "openstack_networking_port_v2" "kubewport" { name = "${var.worker_name}${count.index+1}-${replace(var.dns_suffix,".","-")}-port" # We create as many ports as there are instances created - count = var.controller_instance_count + count = var.worker_instance_count network_id = data.openstack_networking_network_v2.public.id # A list of security group ID security_group_ids = [ @@ -76,7 +71,7 @@ resource "openstack_networking_port_v2" "kubewport" { } resource "openstack_blockstorage_volume_v3" "kubewvolumeboot" { - count = var.controller_instance_count # size of cluster + count = var.worker_instance_count # size of cluster name = "${var.worker_name}${count.index+1}-${replace(var.dns_suffix,".","-")}-vol" description = "OS volume for kubernetes worker node ${count.index + 1}" size = 100 @@ -84,6 +79,14 @@ resource "openstack_blockstorage_volume_v3" "kubewvolumeboot" { enable_online_resize = true # Allow us to resize volume while attached. } +resource "openstack_blockstorage_volume_v3" "kubewvolumerook" { + count = var.worker_instance_count # size of cluster + name = "${var.worker_name}${count.index+1}-${replace(var.dns_suffix,".","-")}-rook-vol" + description = "Rook storage volume for kubernetes worker node ${count.index + 1}" + size = 100 + enable_online_resize = true # Allow us to resize volume while attached. +} + resource "openstack_compute_instance_v2" "worker-nodes" { count = var.worker_instance_count @@ -102,6 +105,13 @@ resource "openstack_compute_instance_v2" "worker-nodes" { destination_type = "volume" boot_index = 0 } + block_device { + uuid = resource.openstack_blockstorage_volume_v3.kubewvolumerook[count.index].id + source_type = "volume" + destination_type = "volume" + boot_index = 1 + } + scheduler_hints { group = openstack_compute_servergroup_v2.workers.id } diff --git a/IaC-test/vars.tf b/IaC-test/vars.tf index bc5f172..e0c3703 100644 --- a/IaC-test/vars.tf +++ b/IaC-test/vars.tf @@ -9,7 +9,7 @@ variable "keyname" { } variable "worker_instance_count" { - default = "3" + default = "4" } variable "controller_instance_count" { default = "3"