From a657c1cb7e65fa34b454178fba66460169d962d3 Mon Sep 17 00:00:00 2001 From: Mao Geng Date: Tue, 2 Aug 2022 17:55:50 -0700 Subject: [PATCH 1/3] Add extra_node_pool_instance_types var --- main.tf | 7 ++++--- variables.tf | 6 ++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/main.tf b/main.tf index 09dc5d8..1d3f93d 100644 --- a/main.tf +++ b/main.tf @@ -77,9 +77,10 @@ locals { taints = [] } - snc_node_config = { for i, v in var.private_subnet_ids : "snc-node-pool${i}" => merge(local.node_pool_defaults, { subnets = [var.private_subnet_ids[i]], name = "snc-node-pool${i}" }) } - snc_func_config = { for i, v in var.private_subnet_ids : "snc-func-pool${i}" => merge(local.func_pool_defaults, { subnets = [var.private_subnet_ids[i]], name = "snc-func-pool${i}" }) } - node_groups = (var.enable_func_pool ? merge(local.snc_node_config, local.snc_func_config) : local.snc_node_config) + snc_node_config = { for i, v in var.private_subnet_ids : "snc-node-pool${i}" => merge(local.node_pool_defaults, { subnets = [var.private_subnet_ids[i]], name = "snc-node-pool${i}" }) } + snc_extra_node_config = (length(var.extra_node_pool_instance_types) == 0 ? {} : { for i, v in var.private_subnet_ids : "snc-extra-node-pool$[i]" => merge(local.node_pool_defaults, { subnets = [var.private_subnet_ids[i]], name = "snc-extra-node-pool${i}", instance_types = var.extra_node_pool_instance_types }) }) + snc_func_config = { for i, v in var.private_subnet_ids : "snc-func-pool${i}" => merge(local.func_pool_defaults, { subnets = [var.private_subnet_ids[i]], name = "snc-func-pool${i}" }) } + node_groups = (var.enable_func_pool ? merge(local.snc_node_config, local.snc_func_config, local.snc_extra_node_config) : merge(local.snc_node_config, local.snc_extra_node_config)) } module "eks" { diff --git a/variables.tf b/variables.tf index 75f3d06..b9fd559 100644 --- a/variables.tf +++ b/variables.tf @@ -575,6 +575,12 @@ variable "node_pool_instance_types" { type = list(string) } +variable "extra_node_pool_instance_types" { + default = [] + description = "Set of instance types of an extra node pool. Same properties as default node pool except name and instance types." + type = list(string) +} + variable "node_pool_labels" { default = {} description = "A map of kubernetes labels to add to the node pool." From aad7caecf76071970c6641e47e82d42bec5ca2d6 Mon Sep 17 00:00:00 2001 From: Mao Geng Date: Tue, 2 Aug 2022 18:06:44 -0700 Subject: [PATCH 2/3] fix [] to {} --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 1d3f93d..8035c38 100644 --- a/main.tf +++ b/main.tf @@ -78,7 +78,7 @@ locals { } snc_node_config = { for i, v in var.private_subnet_ids : "snc-node-pool${i}" => merge(local.node_pool_defaults, { subnets = [var.private_subnet_ids[i]], name = "snc-node-pool${i}" }) } - snc_extra_node_config = (length(var.extra_node_pool_instance_types) == 0 ? {} : { for i, v in var.private_subnet_ids : "snc-extra-node-pool$[i]" => merge(local.node_pool_defaults, { subnets = [var.private_subnet_ids[i]], name = "snc-extra-node-pool${i}", instance_types = var.extra_node_pool_instance_types }) }) + snc_extra_node_config = (length(var.extra_node_pool_instance_types) == 0 ? {} : { for i, v in var.private_subnet_ids : "snc-extra-node-pool${i}" => merge(local.node_pool_defaults, { subnets = [var.private_subnet_ids[i]], name = "snc-extra-node-pool${i}", instance_types = var.extra_node_pool_instance_types }) }) snc_func_config = { for i, v in var.private_subnet_ids : "snc-func-pool${i}" => merge(local.func_pool_defaults, { subnets = [var.private_subnet_ids[i]], name = "snc-func-pool${i}" }) } node_groups = (var.enable_func_pool ? merge(local.snc_node_config, local.snc_func_config, local.snc_extra_node_config) : merge(local.snc_node_config, local.snc_extra_node_config)) } From be9c1dafd980e7a88163080f3b3ab5eb69528907 Mon Sep 17 00:00:00 2001 From: Mao Geng Date: Tue, 2 Aug 2022 21:47:54 -0700 Subject: [PATCH 3/3] Update doc --- README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 0fb4bfe..c29a5d2 100644 --- a/README.md +++ b/README.md @@ -74,13 +74,14 @@ variable "region" { module "sn_cluster" { source = "streamnative/cloud/aws" - cluster_name = "sn-cluster-${var.region}" - cluster_version = "1.20" - hosted_zone_id = "Z04554535IN8Z31SKDVQ2" # Change this to your hosted zone ID - node_pool_instance_types = ["c6i.xlarge"] - node_pool_desired_size = 2 - node_pool_min_size = 1 - node_pool_max_size = 6 + cluster_name = "sn-cluster-${var.region}" + cluster_version = "1.20" + hosted_zone_id = "Z04554535IN8Z31SKDVQ2" # Change this to your hosted zone ID + node_pool_instance_types = ["c6i.xlarge"] + extra_node_pool_instance_types = ["c6i.2xlarge"] # Defaults to empty list. Means don't create extra node pool + node_pool_desired_size = 2 + node_pool_min_size = 1 + node_pool_max_size = 6 ## Note: EKS requires two subnets, each in their own availability zone public_subnet_ids = ["subnet-abcde012", "subnet-bcde012a"] @@ -403,6 +404,7 @@ You can also disable `kubernetes-external-secrets` by setting the input `enable- | [node\_pool\_disk\_size](#input\_node\_pool\_disk\_size) | Disk size in GiB for worker nodes in the node pool. Defaults to 50. | `number` | `50` | no | | [node\_pool\_disk\_type](#input\_node\_pool\_disk\_type) | Disk type for worker nodes in the node pool. Defaults to gp3. | `string` | `"gp3"` | no | | [node\_pool\_instance\_types](#input\_node\_pool\_instance\_types) | Set of instance types associated with the EKS Node Group. Defaults to ["c6i.large"]. | `list(string)` |
[
"c6i.large"
]
| no | +| [extra\_node\_pool\_instance\_types](#input\_extra\_node\_pool\_instance\_types) | Set of instance types of an extra node pool. Same properties as default node pool except name and instance types. Defaults to []. | `list(string)` |
[]
| no | | [node\_pool\_labels](#input\_node\_pool\_labels) | A map of kubernetes labels to add to the node pool. | `map(string)` | `{}` | no | | [node\_pool\_max\_size](#input\_node\_pool\_max\_size) | The maximum size of the node pool Autoscaling group. | `number` | n/a | yes | | [node\_pool\_min\_size](#input\_node\_pool\_min\_size) | The minimum size of the node pool AutoScaling group. | `number` | `1` | no |