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
4 changes: 3 additions & 1 deletion environments/site/tofu/additional.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ module "additional" {
security_group_ids = lookup(each.value, "security_group_ids", [for o in data.openstack_networking_secgroup_v2.nonlogin: o.id])
additional_cloud_config = lookup(each.value, "additional_cloud_config", var.additional_cloud_config)
additional_cloud_config_vars = lookup(each.value, "additional_cloud_config_vars", var.additional_cloud_config_vars)
server_group_id = lookup(each.value, "server_group_id", null)

# can't be set for additional nodes
compute_init_enable = []
Expand Down Expand Up @@ -68,6 +69,7 @@ module "additional" {
"nodename_template",
"security_group_ids",
"additional_cloud_config",
"additional_cloud_config_vars"
"additional_cloud_config_vars",
"server_group_id"
]
}
4 changes: 3 additions & 1 deletion environments/site/tofu/compute.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ module "compute" {
match_ironic_node = lookup(each.value, "match_ironic_node", null)
availability_zone = lookup(each.value, "availability_zone", null)
ip_addresses = lookup(each.value, "ip_addresses", null)
server_group_id = lookup(each.value, "server_group_id", null)

# computed
# not using openstack_compute_instance_v2.control.access_ip_v4 to avoid
Expand Down Expand Up @@ -63,7 +64,8 @@ module "compute" {
"gateway_ip",
"nodename_template",
"additional_cloud_config",
"additional_cloud_config_vars"
"additional_cloud_config_vars",
"server_group_id"
]

}
7 changes: 7 additions & 0 deletions environments/site/tofu/control.tf
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ resource "openstack_compute_instance_v2" "control" {
}
}

dynamic "scheduler_hints" {
for_each = var.control_server_group_id != null ? [true] : []
content {
group = var.control_server_group_id
}
}

metadata = {
environment_root = var.environment_root
access_ip = openstack_networking_port_v2.control[var.cluster_networks[0].network].all_fixed_ips[0]
Expand Down
4 changes: 3 additions & 1 deletion environments/site/tofu/login.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ module "login" {
match_ironic_node = lookup(each.value, "match_ironic_node", null)
availability_zone = lookup(each.value, "availability_zone", null)
ip_addresses = lookup(each.value, "ip_addresses", null)
server_group_id = lookup(each.value, "server_group_id", null)

# can't be set for login
compute_init_enable = []
Expand Down Expand Up @@ -68,7 +69,8 @@ module "login" {
"nodename_template",
"additional_cloud_config",
"additional_cloud_config_vars",
"security_group_ids"
"security_group_ids",
"server_group_id"
]

}
14 changes: 14 additions & 0 deletions environments/site/tofu/node_group/nodes.tf
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ resource "openstack_compute_instance_v2" "compute_fixed_image" {
}
}

dynamic "scheduler_hints" {
for_each = var.server_group_id != null ? [true] : []
content {
group = var.server_group_id
}
}

metadata = merge(
{
environment_root = var.environment_root
Expand Down Expand Up @@ -164,6 +171,13 @@ resource "openstack_compute_instance_v2" "compute" {
}
}

dynamic "scheduler_hints" {
for_each = var.server_group_id != null ? [true] : []
content {
group = var.server_group_id
}
}

metadata = merge(
{
environment_root = var.environment_root
Expand Down
5 changes: 5 additions & 0 deletions environments/site/tofu/node_group/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,8 @@ variable "additional_cloud_config_vars" {
default = {}
nullable = false
}

variable "server_group_id" {
type = string
default = null
}
8 changes: 8 additions & 0 deletions environments/site/tofu/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ variable "login" {
if match_ironic_node is true, defered to OpenStack otherwise
gateway_ip: Address to add default route via
nodename_template: Overrides variable cluster_nodename_template
server_group_id: String ID of server group to use for scheduler hint
EOF

type = any
Expand Down Expand Up @@ -129,6 +130,7 @@ variable "compute" {
if match_ironic_node is true, defered to OpenStack otherwise
gateway_ip: Address to add default route via
nodename_template: Overrides variable cluster_nodename_template
server_group_id: String ID of server group to use for scheduler hint

Nodes are added to the following inventory groups:
- $group_name
Expand Down Expand Up @@ -340,3 +342,9 @@ variable "additional_cloud_config_vars" {
type = map(any)
default = {}
}

variable "control_server_group_id" {
description = "ID of server group to use for control node scheduler hint"
type = string
default = null
}