From f3013f00a07b85e2644b148faa48c0bfa4da6eac Mon Sep 17 00:00:00 2001 From: Steve Brasier Date: Thu, 7 Aug 2025 12:12:26 +0000 Subject: [PATCH 1/4] allow setting volume type for extra_volumes --- environments/site/tofu/node_group/nodes.tf | 1 + environments/site/tofu/node_group/variables.tf | 2 ++ environments/site/tofu/variables.tf | 8 +++++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/environments/site/tofu/node_group/nodes.tf b/environments/site/tofu/node_group/nodes.tf index f3f9ab91f..340a6c952 100644 --- a/environments/site/tofu/node_group/nodes.tf +++ b/environments/site/tofu/node_group/nodes.tf @@ -36,6 +36,7 @@ resource "openstack_blockstorage_volume_v3" "compute" { name = "${var.cluster_name}-${each.key}" description = "Compute node ${each.value.node} volume ${each.value.volume}" size = var.extra_volumes[each.value.volume].size + volume_type = var.extra_volumes[each.value.volume].volume_type } resource "openstack_compute_volume_attach_v2" "compute" { diff --git a/environments/site/tofu/node_group/variables.tf b/environments/site/tofu/node_group/variables.tf index deb174b91..110ba8115 100644 --- a/environments/site/tofu/node_group/variables.tf +++ b/environments/site/tofu/node_group/variables.tf @@ -60,11 +60,13 @@ variable "extra_volumes" { Keys are unique volume name. Values are a mapping with: size: Size of volume in GB + volume_type: Optional. Type of volume, or cloud default **NB**: The order in /dev is not guaranteed to match the mapping EOF type = map( object({ size = number + volume_type = optional(string) }) ) default = {} diff --git a/environments/site/tofu/variables.tf b/environments/site/tofu/variables.tf index a6626ab6e..a6a78bcb1 100644 --- a/environments/site/tofu/variables.tf +++ b/environments/site/tofu/variables.tf @@ -65,10 +65,11 @@ variable "login" { volume_backed_instances: Overrides variable volume_backed_instances root_volume_size: Overrides variable root_volume_size extra_volumes: Mapping defining additional volumes to create and attach - Keys are unique volume name. - Values are a mapping with: + Keys are unique volume name. + Values are a mapping with: size: Size of volume in GB - **NB**: The order in /dev is not guaranteed to match the mapping + volume_type: Optional. Type of volume, or cloud default + **NB**: The order in /dev is not guaranteed to match the mapping fip_addresses: List of addresses of floating IPs to associate with nodes, in the same order as nodes parameter. The floating IPs must already be allocated to the project. @@ -117,6 +118,7 @@ variable "compute" { Keys are unique volume name. Values are a mapping with: size: Size of volume in GB + volume_type: Optional. Type of volume, or cloud default **NB**: The order in /dev is not guaranteed to match the mapping ip_addresses: Mapping of list of fixed IP addresses for nodes, keyed by network name, in same order as nodes parameter. From f095b502263d953a5f2faea22cc5ae126dc891b0 Mon Sep 17 00:00:00 2001 From: wtripp180901 Date: Thu, 7 Aug 2025 15:13:33 +0100 Subject: [PATCH 2/4] Added config drive option to tofu --- environments/site/tofu/compute.tf | 3 +++ environments/site/tofu/control.tf | 2 ++ environments/site/tofu/login.tf | 3 +++ environments/site/tofu/node_group/nodes.tf | 4 ++++ environments/site/tofu/node_group/variables.tf | 9 +++++++++ environments/site/tofu/variables.tf | 9 +++++++++ 6 files changed, 30 insertions(+) diff --git a/environments/site/tofu/compute.tf b/environments/site/tofu/compute.tf index 4e6186e35..d73c8ee12 100644 --- a/environments/site/tofu/compute.tf +++ b/environments/site/tofu/compute.tf @@ -60,4 +60,7 @@ module "compute" { "gateway_ip", "nodename_template", ] + + config_drive = var.config_drive + } diff --git a/environments/site/tofu/control.tf b/environments/site/tofu/control.tf index 2c7174452..811e781b7 100644 --- a/environments/site/tofu/control.tf +++ b/environments/site/tofu/control.tf @@ -94,4 +94,6 @@ resource "openstack_compute_instance_v2" "control" { %{endif} EOF + config_drive = var.config_drive + } diff --git a/environments/site/tofu/login.tf b/environments/site/tofu/login.tf index b8abe4ea3..b3aa382e8 100644 --- a/environments/site/tofu/login.tf +++ b/environments/site/tofu/login.tf @@ -64,4 +64,7 @@ module "login" { "gateway_ip", "nodename_template", ] + + config_drive = var.config_drive + } diff --git a/environments/site/tofu/node_group/nodes.tf b/environments/site/tofu/node_group/nodes.tf index 340a6c952..062d979c9 100644 --- a/environments/site/tofu/node_group/nodes.tf +++ b/environments/site/tofu/node_group/nodes.tf @@ -120,6 +120,8 @@ resource "openstack_compute_instance_v2" "compute_fixed_image" { availability_zone = var.match_ironic_node ? "${local.baremetal_az}::${var.baremetal_nodes[each.key]}" : var.availability_zone + config_drive = var.config_drive + lifecycle { ignore_changes = [ image_id, @@ -175,6 +177,8 @@ resource "openstack_compute_instance_v2" "compute" { availability_zone = var.match_ironic_node ? "${local.baremetal_az}::${var.baremetal_nodes[each.key]}" : var.availability_zone + config_drive = var.config_drive + } resource "openstack_networking_floatingip_associate_v2" "fip" { diff --git a/environments/site/tofu/node_group/variables.tf b/environments/site/tofu/node_group/variables.tf index 110ba8115..8ce104e8f 100644 --- a/environments/site/tofu/node_group/variables.tf +++ b/environments/site/tofu/node_group/variables.tf @@ -192,3 +192,12 @@ variable "allowed_keys" { type = list # don't provide a default here as allowed keys may depend on module use } + +variable "config_drive" { + description = <<-EOT + Whether to enable Nova config drives on all nodes, which will mount a drive containing + information that would usually be available through the metadata service. + EOT + type = bool + default = false +} diff --git a/environments/site/tofu/variables.tf b/environments/site/tofu/variables.tf index a6a78bcb1..09698e585 100644 --- a/environments/site/tofu/variables.tf +++ b/environments/site/tofu/variables.tf @@ -313,3 +313,12 @@ variable "cluster_nodename_template" { type = string default = "$${cluster_name}-$${node}.$${cluster_name}.$${cluster_domain_suffix}" } + +variable "config_drive" { + description = <<-EOT + Whether to enable Nova config drives on all nodes, which will mount a drive containing + information that would usually be available through the metadata service. + EOT + type = bool + default = false +} From 4d33c7d119057740b1871bc369088b0a4fcce359 Mon Sep 17 00:00:00 2001 From: wtripp180901 <78219569+wtripp180901@users.noreply.github.com> Date: Tue, 12 Aug 2025 09:17:24 +0100 Subject: [PATCH 3/4] docs suggestions Co-authored-by: Steve Brasier <33413598+sjpb@users.noreply.github.com> --- environments/site/tofu/variables.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/environments/site/tofu/variables.tf b/environments/site/tofu/variables.tf index 09698e585..e589fab56 100644 --- a/environments/site/tofu/variables.tf +++ b/environments/site/tofu/variables.tf @@ -316,8 +316,8 @@ variable "cluster_nodename_template" { variable "config_drive" { description = <<-EOT - Whether to enable Nova config drives on all nodes, which will mount a drive containing - information that would usually be available through the metadata service. + Whether to enable Nova config drives on all nodes, which will attach a drive containing + information usually provided through the metadata service. EOT type = bool default = false From d2e07ff53ba451f3ef9ad22bfb1e929e5761795c Mon Sep 17 00:00:00 2001 From: wtripp180901 Date: Tue, 12 Aug 2025 09:38:24 +0100 Subject: [PATCH 4/4] config drive defaults to null + added to additional nodegroups --- environments/site/tofu/additional.tf | 1 + environments/site/tofu/compute.tf | 3 +-- environments/site/tofu/login.tf | 3 +-- environments/site/tofu/node_group/variables.tf | 5 ----- environments/site/tofu/variables.tf | 2 +- 5 files changed, 4 insertions(+), 10 deletions(-) diff --git a/environments/site/tofu/additional.tf b/environments/site/tofu/additional.tf index 1f7c48ce5..20e363cf0 100644 --- a/environments/site/tofu/additional.tf +++ b/environments/site/tofu/additional.tf @@ -12,6 +12,7 @@ module "additional" { cluster_domain_suffix = var.cluster_domain_suffix key_pair = var.key_pair environment_root = var.environment_root + config_drive = var.config_drive # can be set for group, defaults to top-level value: image_id = lookup(each.value, "image_id", var.cluster_image_id) diff --git a/environments/site/tofu/compute.tf b/environments/site/tofu/compute.tf index d73c8ee12..a5b5d9010 100644 --- a/environments/site/tofu/compute.tf +++ b/environments/site/tofu/compute.tf @@ -12,6 +12,7 @@ module "compute" { cluster_domain_suffix = var.cluster_domain_suffix key_pair = var.key_pair environment_root = var.environment_root + config_drive = var.config_drive # can be set for group, defaults to top-level value: image_id = lookup(each.value, "image_id", var.cluster_image_id) @@ -60,7 +61,5 @@ module "compute" { "gateway_ip", "nodename_template", ] - - config_drive = var.config_drive } diff --git a/environments/site/tofu/login.tf b/environments/site/tofu/login.tf index b3aa382e8..687fd584e 100644 --- a/environments/site/tofu/login.tf +++ b/environments/site/tofu/login.tf @@ -12,6 +12,7 @@ module "login" { cluster_domain_suffix = var.cluster_domain_suffix key_pair = var.key_pair environment_root = var.environment_root + config_drive = var.config_drive # can be set for group, defaults to top-level value: image_id = lookup(each.value, "image_id", var.cluster_image_id) @@ -64,7 +65,5 @@ module "login" { "gateway_ip", "nodename_template", ] - - config_drive = var.config_drive } diff --git a/environments/site/tofu/node_group/variables.tf b/environments/site/tofu/node_group/variables.tf index 8ce104e8f..eed7238ad 100644 --- a/environments/site/tofu/node_group/variables.tf +++ b/environments/site/tofu/node_group/variables.tf @@ -194,10 +194,5 @@ variable "allowed_keys" { } variable "config_drive" { - description = <<-EOT - Whether to enable Nova config drives on all nodes, which will mount a drive containing - information that would usually be available through the metadata service. - EOT type = bool - default = false } diff --git a/environments/site/tofu/variables.tf b/environments/site/tofu/variables.tf index e589fab56..54d750f5d 100644 --- a/environments/site/tofu/variables.tf +++ b/environments/site/tofu/variables.tf @@ -320,5 +320,5 @@ variable "config_drive" { information usually provided through the metadata service. EOT type = bool - default = false + default = null }