Skip to content

feat: add capacity type node groups to allow for spot nodes #152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ _Note: Since this module manages all of the Kubernetes addon dependencies requir
| <a name="input_node_pool_ami_id"></a> [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 |
| <a name="input_node_pool_azs"></a> [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 |
| <a name="input_node_pool_block_device_name"></a> [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 |
| <a name="input_node_pool_capacity_type"></a> [node\_pool\_capacity\_type](#input\_node\_pool\_capacity\_type) | The capacity type for the node group. | `string` | `ON_DEMAND` | no |
| <a name="input_node_pool_desired_size"></a> [node\_pool\_desired\_size](#input\_node\_pool\_desired\_size) | Desired number of worker nodes in the node pool. | `number` | `0` | no |
| <a name="input_node_pool_disk_iops"></a> [node\_pool\_disk\_iops](#input\_node\_pool\_disk\_iops) | The amount of provisioned IOPS for the worker node root EBS volume. | `number` | `3000` | no |
| <a name="input_node_pool_disk_size"></a> [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 |
Expand Down
3 changes: 3 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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.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
Expand All @@ -127,6 +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.node_pool_capacity_type
name = "snc-${split(".", instance_type)[1]}-${data.aws_subnet.private_subnets[i].availability_zone}"
use_name_prefix = true
taints = {}
Expand All @@ -151,6 +153,7 @@ locals {
"snc-core" = {
subnet_ids = local.node_group_subnet_ids
instance_types = [var.v3_node_group_core_instance_type]
capacity_type = var.node_pool_capacity_type
name = "snc-core"
use_name_prefix = true
taints = local.v3_node_taints
Expand Down
7 changes: 7 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
Loading