From b900bd6e94a0e1aac597501abd3557595c1f504b Mon Sep 17 00:00:00 2001 From: Andreas Holmsten Date: Thu, 28 Jun 2018 16:32:59 +0200 Subject: [PATCH] [contrib/terraform/openstack] Add supplementary node groups * Add supplementary node groups To add additional ansible groups to the k8s nodes, such as `kube-ingress` for running ingress controller pods. Empty by default. --- contrib/terraform/openstack/README.md | 1 + contrib/terraform/openstack/kubespray.tf | 1 + contrib/terraform/openstack/modules/compute/main.tf | 4 ++-- contrib/terraform/openstack/modules/compute/variables.tf | 4 ++++ contrib/terraform/openstack/variables.tf | 5 +++++ 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/contrib/terraform/openstack/README.md b/contrib/terraform/openstack/README.md index de717fb69..6a93645f6 100644 --- a/contrib/terraform/openstack/README.md +++ b/contrib/terraform/openstack/README.md @@ -219,6 +219,7 @@ For your cluster, edit `inventory/$CLUSTER/cluster.tf`. |`number_of_gfs_nodes_no_floating_ip` | Number of gluster servers to provision. | | `gfs_volume_size_in_gb` | Size of the non-ephemeral volumes to be attached to store the GlusterFS bricks | |`supplementary_master_groups` | To add ansible groups to the masters, such as `kube-node` for tainting them as nodes, empty by default. | +|`supplementary_node_groups` | To add ansible groups to the nodes, such as `kube-ingress` for running ingress controller pods, empty by default. | #### Terraform state files diff --git a/contrib/terraform/openstack/kubespray.tf b/contrib/terraform/openstack/kubespray.tf index c501302de..02ebed631 100644 --- a/contrib/terraform/openstack/kubespray.tf +++ b/contrib/terraform/openstack/kubespray.tf @@ -49,6 +49,7 @@ module "compute" { k8s_node_fips = "${module.ips.k8s_node_fips}" bastion_fips = "${module.ips.bastion_fips}" supplementary_master_groups = "${var.supplementary_master_groups}" + supplementary_node_groups = "${var.supplementary_node_groups}" network_id = "${module.network.router_id}" } diff --git a/contrib/terraform/openstack/modules/compute/main.tf b/contrib/terraform/openstack/modules/compute/main.tf index 940049aa9..e88ad530e 100644 --- a/contrib/terraform/openstack/modules/compute/main.tf +++ b/contrib/terraform/openstack/modules/compute/main.tf @@ -231,7 +231,7 @@ resource "openstack_compute_instance_v2" "k8s_node" { metadata = { ssh_user = "${var.ssh_user}" - kubespray_groups = "kube-node,k8s-cluster" + kubespray_groups = "kube-node,k8s-cluster,${var.supplementary_node_groups}" depends_on = "${var.network_id}" } @@ -258,7 +258,7 @@ resource "openstack_compute_instance_v2" "k8s_node_no_floating_ip" { metadata = { ssh_user = "${var.ssh_user}" - kubespray_groups = "kube-node,k8s-cluster,no-floating" + kubespray_groups = "kube-node,k8s-cluster,no-floating,${var.supplementary_node_groups}" depends_on = "${var.network_id}" } diff --git a/contrib/terraform/openstack/modules/compute/variables.tf b/contrib/terraform/openstack/modules/compute/variables.tf index 58ab17067..f4edf9fc9 100644 --- a/contrib/terraform/openstack/modules/compute/variables.tf +++ b/contrib/terraform/openstack/modules/compute/variables.tf @@ -59,3 +59,7 @@ variable "bastion_fips" { variable "supplementary_master_groups" { default = "" } + +variable "supplementary_node_groups" { + default = "" +} diff --git a/contrib/terraform/openstack/variables.tf b/contrib/terraform/openstack/variables.tf index d49746c92..f7ea23834 100644 --- a/contrib/terraform/openstack/variables.tf +++ b/contrib/terraform/openstack/variables.tf @@ -116,3 +116,8 @@ variable "supplementary_master_groups" { description = "supplementary kubespray ansible groups for masters, such kube-node" default = "" } + +variable "supplementary_node_groups" { + description = "supplementary kubespray ansible groups for worker nodes, such as kube-ingress" + default = "" +}