Skip to content

Commit bdaf163

Browse files
authored
feat(DATAGO-109609): enable node pools that span AZs and allow specifying AMI type for EKS (#117)
1 parent 9ce853b commit bdaf163

File tree

6 files changed

+34
-12
lines changed

6 files changed

+34
-12
lines changed

aks/terraform/modules/broker-node-pool/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ No modules.
3535
| <a name="input_node_pool_max_size"></a> [node\_pool\_max\_size](#input\_node\_pool\_max\_size) | The maximum worker node count for each node pool. | `string` | n/a | yes |
3636
| <a name="input_node_pool_name"></a> [node\_pool\_name](#input\_node\_pool\_name) | The name prefix of the node pools. | `string` | n/a | yes |
3737
| <a name="input_node_pool_taints"></a> [node\_pool\_taints](#input\_node\_pool\_taints) | Kubernetes taints added to worker nodes in the node pools. | `list(string)` | n/a | yes |
38+
| <a name="input_split_node_group"></a> [split\_node\_group](#input\_split\_node\_group) | Whether to split the nodegroup into a nodegroup per availability zone. | `bool` | `true` | no |
3839
| <a name="input_subnet_id"></a> [subnet\_id](#input\_subnet\_id) | The subnet that will contain the worker nodes in each node pool. | `string` | n/a | yes |
3940
| <a name="input_worker_node_disk_size"></a> [worker\_node\_disk\_size](#input\_worker\_node\_disk\_size) | The OS disk size (in GB) used for the worker nodes in each node pool. | `string` | n/a | yes |
4041
| <a name="input_worker_node_disk_type"></a> [worker\_node\_disk\_type](#input\_worker\_node\_disk\_type) | The type of the OS disk for the worker nodes in each node pool. | `string` | `"Ephemeral"` | no |
@@ -43,4 +44,4 @@ No modules.
4344
## Outputs
4445

4546
No outputs.
46-
<!-- END_TF_DOCS -->
47+
<!-- END_TF_DOCS -->

aks/terraform/modules/broker-node-pool/main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
resource "azurerm_kubernetes_cluster_node_pool" "this" {
2-
count = length(var.availability_zones)
2+
count = var.split_node_group ? length(var.availability_zones) : 1
33

44
name = "${var.node_pool_name}${count.index}"
55
tags = var.common_tags
@@ -18,7 +18,7 @@ resource "azurerm_kubernetes_cluster_node_pool" "this" {
1818

1919
max_pods = var.max_pods_per_node
2020

21-
zones = [var.availability_zones[count.index]]
21+
zones = var.split_node_group ? [var.availability_zones[count.index]] : var.availability_zones
2222
vnet_subnet_id = var.subnet_id
2323

2424
vm_size = var.worker_node_vm_size
@@ -27,4 +27,4 @@ resource "azurerm_kubernetes_cluster_node_pool" "this" {
2727

2828
node_labels = var.node_pool_labels
2929
node_taints = var.node_pool_taints
30-
}
30+
}

aks/terraform/modules/broker-node-pool/variables.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ variable "availability_zones" {
2020
description = "The availability zones for the node pools - one pool is created in each zone."
2121
}
2222

23+
variable "split_node_group" {
24+
type = bool
25+
description = "Whether to split the nodegroup into a nodegroup per availability zone."
26+
default = true
27+
}
28+
2329
variable "subnet_id" {
2430
type = string
2531
description = "The subnet that will contain the worker nodes in each node pool."
@@ -65,4 +71,4 @@ variable "max_pods_per_node" {
6571
variable "kubernetes_version" {
6672
type = string
6773
description = "The Kubernetes version for the node pools."
68-
}
74+
}

eks/terraform/modules/broker-node-group/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@ No modules.
4141
| <a name="input_node_group_resources_tags"></a> [node\_group\_resources\_tags](#input\_node\_group\_resources\_tags) | Resources tags added to the node groups as hints for the autoscaler. | `list(map(string))` | n/a | yes |
4242
| <a name="input_node_group_taints"></a> [node\_group\_taints](#input\_node\_group\_taints) | Kubernetes taints added to worker nodes in the node groups. | `list(map(string))` | n/a | yes |
4343
| <a name="input_security_group_ids"></a> [security\_group\_ids](#input\_security\_group\_ids) | The security groups that will be attached to the worker nodes. | `list(string)` | n/a | yes |
44+
| <a name="input_split_node_group"></a> [split\_node\_group](#input\_split\_node\_group) | Whether to split the nodegroup into a nodegroup per subnet. | `bool` | `true` | no |
4445
| <a name="input_subnet_ids"></a> [subnet\_ids](#input\_subnet\_ids) | The subnets that the node groups will use - a node group is created in each subnet. | `list(string)` | n/a | yes |
45-
| <a name="input_worker_node_ami_version"></a> [worker\_node\_ami\_version](#input\_worker\_node\_ami\_version) | Value of the the AMI to use for the worker nodes. | `string` | n/a | yes |
46+
| <a name="input_worker_node_ami_type"></a> [worker\_node\_ami\_type](#input\_worker\_node\_ami\_type) | Value of the AMI type to use for the worker nodes. | `string` | `"AL2023_x86_64_STANDARD"` | no |
47+
| <a name="input_worker_node_ami_version"></a> [worker\_node\_ami\_version](#input\_worker\_node\_ami\_version) | Value of the the AMI version to use for the worker nodes. | `string` | n/a | yes |
4648
| <a name="input_worker_node_instance_type"></a> [worker\_node\_instance\_type](#input\_worker\_node\_instance\_type) | The instance type of the worker nodes. | `string` | n/a | yes |
4749
| <a name="input_worker_node_role_arn"></a> [worker\_node\_role\_arn](#input\_worker\_node\_role\_arn) | The ARN of the IAM role assigned to each worker node via an instance profile. | `string` | n/a | yes |
4850
| <a name="input_worker_node_tags"></a> [worker\_node\_tags](#input\_worker\_node\_tags) | Tags that are added to worker nodes. | `map(string)` | `{}` | no |
@@ -54,4 +56,4 @@ No modules.
5456
| Name | Description |
5557
|------|-------------|
5658
| <a name="output_node_group_arns"></a> [node\_group\_arns](#output\_node\_group\_arns) | n/a |
57-
<!-- END_TF_DOCS -->
59+
<!-- END_TF_DOCS -->

eks/terraform/modules/broker-node-group/main.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,16 @@ resource "aws_launch_template" "this" {
3333
}
3434

3535
resource "aws_eks_node_group" "this" {
36-
count = length(var.subnet_ids)
36+
count = var.split_node_group ? length(var.subnet_ids) : 1
3737

3838
cluster_name = var.cluster_name
3939
node_group_name = "${var.node_group_name_prefix}-${count.index}"
4040
node_role_arn = var.worker_node_role_arn
41-
subnet_ids = [var.subnet_ids[count.index]]
41+
subnet_ids = var.split_node_group ? [var.subnet_ids[count.index]] : var.subnet_ids
4242

4343
version = var.kubernetes_version
4444
release_version = var.worker_node_ami_version
45+
ami_type = var.worker_node_ami_type
4546

4647
scaling_config {
4748
desired_size = var.node_group_desired_size
@@ -148,4 +149,4 @@ resource "aws_autoscaling_group_tag" "taints_tags" {
148149
value = "${local.taints_tags_asg[count.index].taint.value}:${local.taints_tags_asg[count.index].taint.effect}"
149150
propagate_at_launch = true
150151
}
151-
}
152+
}

eks/terraform/modules/broker-node-group/variables.tf

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ variable "node_group_resources_tags" {
6161
description = "Resources tags added to the node groups as hints for the autoscaler."
6262
}
6363

64+
variable "split_node_group" {
65+
type = bool
66+
description = "Whether to split the nodegroup into a nodegroup per subnet."
67+
default = true
68+
}
69+
6470
variable "worker_node_volume_size" {
6571
type = number
6672
description = "The size of the worker node root disk."
@@ -83,5 +89,11 @@ variable "worker_node_instance_type" {
8389

8490
variable "worker_node_ami_version" {
8591
type = string
86-
description = "Value of the the AMI to use for the worker nodes."
87-
}
92+
description = "Value of the the AMI version to use for the worker nodes."
93+
}
94+
95+
variable "worker_node_ami_type" {
96+
type = string
97+
description = "Value of the AMI type to use for the worker nodes."
98+
default = "AL2023_x86_64_STANDARD"
99+
}

0 commit comments

Comments
 (0)