From 3f0f2ab3256f852bf942100f7791393413219946 Mon Sep 17 00:00:00 2001 From: Darrell Pappa Date: Sun, 26 Jan 2025 16:06:07 -0500 Subject: [PATCH 1/4] Added capacity_type to select spot instances for node groups --- main.tf | 2 ++ variables.tf | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/main.tf b/main.tf index 70b0313..0fed599 100644 --- a/main.tf +++ b/main.tf @@ -127,6 +127,7 @@ locals { for i, j in data.aws_subnet.private_subnets : { subnet_ids = [data.aws_subnet.private_subnets[i].id] instance_types = [instance_type] + capacity_type = var.capacity_type name = "snc-${split(".", instance_type)[1]}-${data.aws_subnet.private_subnets[i].availability_zone}" use_name_prefix = true taints = {} @@ -151,6 +152,7 @@ locals { "snc-core" = { subnet_ids = local.node_group_subnet_ids instance_types = [var.v3_node_group_core_instance_type] + capacity_type = var.capacity_type name = "snc-core" use_name_prefix = true taints = local.v3_node_taints diff --git a/variables.tf b/variables.tf index 937dbe9..5740987 100644 --- a/variables.tf +++ b/variables.tf @@ -747,3 +747,10 @@ variable "node_groups" { type = any default = null } + +variable "capacity_type" { + description = "The capacity type for the node group. Defaults to \"ON_DEMAND\". If set to \"SPOT\", the node group will be a spot instance node group." + type = string + default = "ON_DEMAND" + +} From 0a31f13c40ec80b79b20e6fd3497b17765ebb6a0 Mon Sep 17 00:00:00 2001 From: Darrell Pappa Date: Fri, 31 Jan 2025 10:57:29 -0500 Subject: [PATCH 2/4] Added capacity type to default node group. --- main.tf | 1 + 1 file changed, 1 insertion(+) diff --git a/main.tf b/main.tf index 0fed599..29fe88c 100644 --- a/main.tf +++ b/main.tf @@ -109,6 +109,7 @@ locals { desired_size = var.node_pool_desired_size ebs_optimized = var.node_pool_ebs_optimized enable_monitoring = var.enable_node_pool_monitoring + capacity_type = var.capacity_type min_size = var.node_pool_min_size max_size = var.node_pool_max_size pre_bootstrap_user_data = var.node_pool_pre_userdata From da5f50f6a0035147d24823c1010ac089c0ef5a50 Mon Sep 17 00:00:00 2001 From: Darrell Pappa Date: Fri, 31 Jan 2025 11:19:03 -0500 Subject: [PATCH 3/4] Added docs, changed var name --- README.md | 1 + main.tf | 6 +++--- variables.tf | 14 +++++++------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 1165ac3..4257ba1 100644 --- a/README.md +++ b/README.md @@ -343,6 +343,7 @@ _Note: Since this module manages all of the Kubernetes addon dependencies requir | [node\_pool\_ami\_id](#input\_node\_pool\_ami\_id) | The AMI ID to use for the EKS cluster nodes. Defaults to the latest EKS Optimized AMI provided by AWS. | `string` | `""` | no | | [node\_pool\_azs](#input\_node\_pool\_azs) | A list of availability zones to use for the EKS node group. If not set, the module will use the same availability zones with the cluster. | `list(string)` | `[]` | no | | [node\_pool\_block\_device\_name](#input\_node\_pool\_block\_device\_name) | The name of the block device to use for the EKS cluster nodes. | `string` | `"/dev/nvme0n1"` | no | +| [node\_pool\_capacity\_type](#input\_node\_pool\_capacity\_type) | The capacity type for the node group. | `string` | `ON_DEMAND` | no | | [node\_pool\_desired\_size](#input\_node\_pool\_desired\_size) | Desired number of worker nodes in the node pool. | `number` | `0` | no | | [node\_pool\_disk\_iops](#input\_node\_pool\_disk\_iops) | The amount of provisioned IOPS for the worker node root EBS volume. | `number` | `3000` | no | | [node\_pool\_disk\_size](#input\_node\_pool\_disk\_size) | Disk size in GiB for worker nodes in the node pool. Defaults to 50. | `number` | `100` | no | diff --git a/main.tf b/main.tf index 29fe88c..5b49c04 100644 --- a/main.tf +++ b/main.tf @@ -109,7 +109,7 @@ locals { desired_size = var.node_pool_desired_size ebs_optimized = var.node_pool_ebs_optimized enable_monitoring = var.enable_node_pool_monitoring - capacity_type = var.capacity_type + capacity_type = var.node_pool_capacity_type min_size = var.node_pool_min_size max_size = var.node_pool_max_size pre_bootstrap_user_data = var.node_pool_pre_userdata @@ -128,7 +128,7 @@ locals { for i, j in data.aws_subnet.private_subnets : { subnet_ids = [data.aws_subnet.private_subnets[i].id] instance_types = [instance_type] - capacity_type = var.capacity_type + capacity_type = var.node_pool_capacity_type name = "snc-${split(".", instance_type)[1]}-${data.aws_subnet.private_subnets[i].availability_zone}" use_name_prefix = true taints = {} @@ -153,7 +153,7 @@ locals { "snc-core" = { subnet_ids = local.node_group_subnet_ids instance_types = [var.v3_node_group_core_instance_type] - capacity_type = var.capacity_type + capacity_type = var.node_pool_capacity_type name = "snc-core" use_name_prefix = true taints = local.v3_node_taints diff --git a/variables.tf b/variables.tf index 5740987..00cdb95 100644 --- a/variables.tf +++ b/variables.tf @@ -471,6 +471,13 @@ variable "node_pool_block_device_name" { type = string } +variable "node_pool_capacity_type" { + description = "The capacity type for the node group. Defaults to \"ON_DEMAND\". If set to \"SPOT\", the node group will be a spot instance node group." + type = string + default = "ON_DEMAND" + +} + variable "node_pool_desired_size" { default = 0 description = "Desired number of worker nodes in the node pool." @@ -747,10 +754,3 @@ variable "node_groups" { type = any default = null } - -variable "capacity_type" { - description = "The capacity type for the node group. Defaults to \"ON_DEMAND\". If set to \"SPOT\", the node group will be a spot instance node group." - type = string - default = "ON_DEMAND" - -} From babf7b0b1ff050d4769ba29777086bea55dbdfc5 Mon Sep 17 00:00:00 2001 From: Max Xu Date: Wed, 24 Dec 2025 17:31:40 +0800 Subject: [PATCH 4/4] Update Signed-off-by: Max Xu --- README.md | 1 - variables.tf | 6 ------ 2 files changed, 7 deletions(-) diff --git a/README.md b/README.md index 79007b7..6b22c00 100644 --- a/README.md +++ b/README.md @@ -242,7 +242,6 @@ _Note: Since this module manages all of the Kubernetes addon dependencies requir | [node\_groups](#input\_node\_groups) | Map of EKS managed node group definitions to create | `any` | `null` | no | | [node\_pool\_ami\_id](#input\_node\_pool\_ami\_id) | The AMI ID to use for the EKS cluster nodes. Defaults to the latest EKS Optimized AMI provided by AWS. | `string` | `""` | no | | [node\_pool\_azs](#input\_node\_pool\_azs) | A list of availability zones to use for the EKS node group. If not set, the module will use the same availability zones with the cluster. | `list(string)` | `[]` | no | -| [node\_pool\_block\_device\_name](#input\_node\_pool\_block\_device\_name) | The name of the block device to use for the EKS cluster nodes. | `string` | `"/dev/nvme0n1"` | no | | [node\_pool\_capacity\_type](#input\_node\_pool\_capacity\_type) | The capacity type for the node group. Defaults to "ON\_DEMAND". If set to "SPOT", the node group will be a spot instance node group. | `string` | `"ON_DEMAND"` | no | | [node\_pool\_desired\_size](#input\_node\_pool\_desired\_size) | Desired number of worker nodes in the node pool. | `number` | `0` | no | | [node\_pool\_disk\_iops](#input\_node\_pool\_disk\_iops) | The amount of provisioned IOPS for the worker node root EBS volume. | `number` | `3000` | no | diff --git a/variables.tf b/variables.tf index b54a8f9..9992259 100644 --- a/variables.tf +++ b/variables.tf @@ -333,12 +333,6 @@ variable "node_pool_ebs_optimized" { type = bool } -variable "node_pool_block_device_name" { - default = "/dev/nvme0n1" - description = "The name of the block device to use for the EKS cluster nodes." - type = string -} - variable "node_pool_capacity_type" { description = "The capacity type for the node group. Defaults to \"ON_DEMAND\". If set to \"SPOT\", the node group will be a spot instance node group." type = string