Skip to content
Snippets Groups Projects
Unverified Commit 277b3476 authored by rptaylor's avatar rptaylor Committed by GitHub
Browse files

add az_list_node variable to specify different AZs for kubelets (#5413)

* rebase and add az_list_node variable to specify different AZs for kubelets

* fix missing variable name change
parent 12bc634e
No related branches found
No related tags found
No related merge requests found
...@@ -32,6 +32,7 @@ module "compute" { ...@@ -32,6 +32,7 @@ module "compute" {
cluster_name = "${var.cluster_name}" cluster_name = "${var.cluster_name}"
az_list = "${var.az_list}" az_list = "${var.az_list}"
az_list_node = "${var.az_list_node}"
number_of_k8s_masters = "${var.number_of_k8s_masters}" number_of_k8s_masters = "${var.number_of_k8s_masters}"
number_of_k8s_masters_no_etcd = "${var.number_of_k8s_masters_no_etcd}" number_of_k8s_masters_no_etcd = "${var.number_of_k8s_masters_no_etcd}"
number_of_etcd = "${var.number_of_etcd}" number_of_etcd = "${var.number_of_etcd}"
......
...@@ -546,7 +546,7 @@ resource "openstack_compute_instance_v2" "k8s_master_no_floating_ip_no_etcd_cust ...@@ -546,7 +546,7 @@ resource "openstack_compute_instance_v2" "k8s_master_no_floating_ip_no_etcd_cust
resource "openstack_compute_instance_v2" "k8s_node" { resource "openstack_compute_instance_v2" "k8s_node" {
name = "${var.cluster_name}-k8s-node-${count.index+1}" name = "${var.cluster_name}-k8s-node-${count.index+1}"
count = "${var.node_root_volume_size_in_gb == 0 ? var.number_of_k8s_nodes : 0}" count = "${var.node_root_volume_size_in_gb == 0 ? var.number_of_k8s_nodes : 0}"
availability_zone = "${element(var.az_list, count.index)}" availability_zone = "${element(var.az_list_node, count.index)}"
image_name = "${var.image}" image_name = "${var.image}"
flavor_id = "${var.flavor_k8s_node}" flavor_id = "${var.flavor_k8s_node}"
key_pair = "${openstack_compute_keypair_v2.k8s.name}" key_pair = "${openstack_compute_keypair_v2.k8s.name}"
...@@ -581,7 +581,7 @@ resource "openstack_compute_instance_v2" "k8s_node" { ...@@ -581,7 +581,7 @@ resource "openstack_compute_instance_v2" "k8s_node" {
resource "openstack_compute_instance_v2" "k8s_node_custom_volume_size" { resource "openstack_compute_instance_v2" "k8s_node_custom_volume_size" {
name = "${var.cluster_name}-k8s-node-${count.index+1}" name = "${var.cluster_name}-k8s-node-${count.index+1}"
count = "${var.node_root_volume_size_in_gb > 0 ? var.number_of_k8s_nodes : 0}" count = "${var.node_root_volume_size_in_gb > 0 ? var.number_of_k8s_nodes : 0}"
availability_zone = "${element(var.az_list, count.index)}" availability_zone = "${element(var.az_list_node, count.index)}"
image_name = "${var.image}" image_name = "${var.image}"
flavor_id = "${var.flavor_k8s_node}" flavor_id = "${var.flavor_k8s_node}"
key_pair = "${openstack_compute_keypair_v2.k8s.name}" key_pair = "${openstack_compute_keypair_v2.k8s.name}"
...@@ -625,7 +625,7 @@ resource "openstack_compute_instance_v2" "k8s_node_custom_volume_size" { ...@@ -625,7 +625,7 @@ resource "openstack_compute_instance_v2" "k8s_node_custom_volume_size" {
resource "openstack_compute_instance_v2" "k8s_node_no_floating_ip" { resource "openstack_compute_instance_v2" "k8s_node_no_floating_ip" {
name = "${var.cluster_name}-k8s-node-nf-${count.index+1}" name = "${var.cluster_name}-k8s-node-nf-${count.index+1}"
count = "${var.node_root_volume_size_in_gb == 0 ? var.number_of_k8s_nodes_no_floating_ip : 0}" count = "${var.node_root_volume_size_in_gb == 0 ? var.number_of_k8s_nodes_no_floating_ip : 0}"
availability_zone = "${element(var.az_list, count.index)}" availability_zone = "${element(var.az_list_node, count.index)}"
image_name = "${var.image}" image_name = "${var.image}"
flavor_id = "${var.flavor_k8s_node}" flavor_id = "${var.flavor_k8s_node}"
key_pair = "${openstack_compute_keypair_v2.k8s.name}" key_pair = "${openstack_compute_keypair_v2.k8s.name}"
...@@ -656,7 +656,7 @@ resource "openstack_compute_instance_v2" "k8s_node_no_floating_ip" { ...@@ -656,7 +656,7 @@ resource "openstack_compute_instance_v2" "k8s_node_no_floating_ip" {
resource "openstack_compute_instance_v2" "k8s_node_no_floating_ip_custom_volume_size" { resource "openstack_compute_instance_v2" "k8s_node_no_floating_ip_custom_volume_size" {
name = "${var.cluster_name}-k8s-node-nf-${count.index+1}" name = "${var.cluster_name}-k8s-node-nf-${count.index+1}"
count = "${var.node_root_volume_size_in_gb > 0 ? var.number_of_k8s_nodes_no_floating_ip : 0}" count = "${var.node_root_volume_size_in_gb > 0 ? var.number_of_k8s_nodes_no_floating_ip : 0}"
availability_zone = "${element(var.az_list, count.index)}" availability_zone = "${element(var.az_list_node, count.index)}"
image_name = "${var.image}" image_name = "${var.image}"
flavor_id = "${var.flavor_k8s_node}" flavor_id = "${var.flavor_k8s_node}"
key_pair = "${openstack_compute_keypair_v2.k8s.name}" key_pair = "${openstack_compute_keypair_v2.k8s.name}"
......
variable "cluster_name" {} variable "cluster_name" {}
variable "az_list" { variable "az_list" {
type = "list" type = list(string)
}
variable "az_list_node" {
type = list(string)
} }
variable "number_of_k8s_masters" {} variable "number_of_k8s_masters" {}
...@@ -110,4 +114,4 @@ variable "use_access_ip" {} ...@@ -110,4 +114,4 @@ variable "use_access_ip" {}
variable "use_server_groups" { variable "use_server_groups" {
type = bool type = bool
} }
\ No newline at end of file
...@@ -3,8 +3,14 @@ variable "cluster_name" { ...@@ -3,8 +3,14 @@ variable "cluster_name" {
} }
variable "az_list" { variable "az_list" {
description = "List of Availability Zones available in your OpenStack cluster" description = "List of Availability Zones to use for masters in your OpenStack cluster"
type = "list" type = list(string)
default = ["nova"]
}
variable "az_list_node" {
description = "List of Availability Zones to use for nodes in your OpenStack cluster"
type = list(string)
default = ["nova"] default = ["nova"]
} }
...@@ -213,4 +219,4 @@ variable "use_access_ip" { ...@@ -213,4 +219,4 @@ variable "use_access_ip" {
variable "use_server_groups" { variable "use_server_groups" {
default = false default = false
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment