From bd8d144829de41a21e505466a8a0010bc1371801 Mon Sep 17 00:00:00 2001 From: rptaylor <1686627+rptaylor@users.noreply.github.com> Date: Tue, 13 Sep 2022 00:13:08 -0700 Subject: [PATCH] add optional parameter extra_groups for k8s_nodes (#9211) --- contrib/terraform/openstack/README.md | 4 +++- contrib/terraform/openstack/modules/compute/main.tf | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/contrib/terraform/openstack/README.md b/contrib/terraform/openstack/README.md index 0e144c2beb0..5566b1c65b4 100644 --- a/contrib/terraform/openstack/README.md +++ b/contrib/terraform/openstack/README.md @@ -294,7 +294,8 @@ For your cluster, edit `inventory/$CLUSTER/cluster.tfvars`. Allows a custom definition of worker nodes giving the operator full control over individual node flavor and availability zone placement. To enable the use of this mode set the `number_of_k8s_nodes` and `number_of_k8s_nodes_no_floating_ip` variables to 0. Then define your desired worker node configuration -using the `k8s_nodes` variable. +using the `k8s_nodes` variable. The `az`, `flavor` and `floating_ip` parameters are mandatory. +The optional parameter `extra_groups` (a comma-delimited string) can be used to define extra inventory group memberships for specific nodes. For example: @@ -314,6 +315,7 @@ k8s_nodes = { "az" = "sto3" "flavor" = "83d8b44a-26a0-4f02-a981-079446926445" "floating_ip" = true + "extra_groups" = "calico_rr" } } ``` diff --git a/contrib/terraform/openstack/modules/compute/main.tf b/contrib/terraform/openstack/modules/compute/main.tf index 15470dc2e26..82cbbb4dd1a 100644 --- a/contrib/terraform/openstack/modules/compute/main.tf +++ b/contrib/terraform/openstack/modules/compute/main.tf @@ -742,7 +742,7 @@ resource "openstack_compute_instance_v2" "k8s_nodes" { metadata = { ssh_user = var.ssh_user - kubespray_groups = "kube_node,k8s_cluster,%{if each.value.floating_ip == false}no_floating,%{endif}${var.supplementary_node_groups}" + kubespray_groups = "kube_node,k8s_cluster,%{if each.value.floating_ip == false}no_floating,%{endif}${var.supplementary_node_groups},${try(each.value.extra_groups, "")}" depends_on = var.network_router_id use_access_ip = var.use_access_ip }