Skip to content

Commit 1c7f0b5

Browse files
Enable nodegroup taints (#239)
* Enable nodegroup taints * terraform-docs: automated action --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent cc667d9 commit 1c7f0b5

6 files changed

Lines changed: 32 additions & 1 deletion

File tree

aws/cluster/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ module "cluster" {
105105
| <a name="input_log_retention_in_days"></a> [log\_retention\_in\_days](#input\_log\_retention\_in\_days) | How many days until control plane logs are purged | `number` | `7` | no |
106106
| <a name="input_name"></a> [name](#input\_name) | Name for this EKS cluster | `string` | n/a | yes |
107107
| <a name="input_namespace"></a> [namespace](#input\_namespace) | Prefix to be applied to created resources | `list(string)` | `[]` | no |
108-
| <a name="input_node_groups"></a> [node\_groups](#input\_node\_groups) | Node groups to create in this cluster | <pre>map(object({<br> capacity_type = optional(string, "ON_DEMAND")<br> instance_types = list(string),<br> enforce_imdsv2 = optional(bool, false)<br> max_size = number<br> max_unavailable = optional(number, 3)<br> min_size = number<br> }))</pre> | n/a | yes |
108+
| <a name="input_node_groups"></a> [node\_groups](#input\_node\_groups) | Node groups to create in this cluster | <pre>map(object({<br> capacity_type = optional(string, "ON_DEMAND")<br> instance_types = list(string),<br> enforce_imdsv2 = optional(bool, false)<br> max_size = number<br> max_unavailable = optional(number, 3)<br> min_size = number<br> taints = optional(list(object({<br> key = string<br> value = optional(string)<br> effect = string<br> })), [])<br> }))</pre> | n/a | yes |
109109
| <a name="input_prevent_log_group_destroy"></a> [prevent\_log\_group\_destroy](#input\_prevent\_log\_group\_destroy) | When true, the CloudWatch log group will be protected from deletion. Terraform will fail if a destroy is attempted on this resource. | `bool` | `false` | no |
110110
| <a name="input_tags"></a> [tags](#input\_tags) | Tags to be applied to all created resources | `map(string)` | `{}` | no |
111111

aws/cluster/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ module "node_groups" {
5757
role = module.node_role.instance
5858
subnets = values(data.aws_subnet.private)
5959
tags = var.tags
60+
taints = each.value.taints
6061

6162
depends_on = [module.node_role]
6263
}

aws/cluster/modules/eks-node-group/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
| <a name="input_role"></a> [role](#input\_role) | IAM role nodes in this group will assume | `object({ arn = string })` | n/a | yes |
3838
| <a name="input_subnets"></a> [subnets](#input\_subnets) | Subnets in which the node group should run | `list(object({ id = string, availability_zone = string }))` | n/a | yes |
3939
| <a name="input_tags"></a> [tags](#input\_tags) | Tags to be applied to created resources | `map(string)` | `{}` | no |
40+
| <a name="input_taints"></a> [taints](#input\_taints) | List of `key`, `value`, `effect` objects representing Kubernetes taints.<br>`effect` must be one of `NO_SCHEDULE`, `NO_EXECUTE`, or `PREFER_NO_SCHEDULE`.<br>`key` and `effect` are required, `value` may be null. | <pre>list(object({<br> key = string<br> value = optional(string)<br> effect = string<br> }))</pre> | `[]` | no |
4041

4142
## Outputs
4243

aws/cluster/modules/eks-node-group/main.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ resource "aws_eks_node_group" "this" {
3535
AvailabilityZone = each.key
3636
})
3737

38+
dynamic "taint" {
39+
for_each = var.taints
40+
content {
41+
key = taint.value["key"]
42+
value = taint.value["value"]
43+
effect = taint.value["effect"]
44+
}
45+
}
46+
3847
lifecycle {
3948
ignore_changes = [scaling_config[0].desired_size]
4049
}

aws/cluster/modules/eks-node-group/variables.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,21 @@ variable "subnets" {
4646
description = "Subnets in which the node group should run"
4747
}
4848

49+
variable "taints" {
50+
type = list(object({
51+
key = string
52+
value = optional(string)
53+
effect = string
54+
}))
55+
description = <<-EOT
56+
List of `key`, `value`, `effect` objects representing Kubernetes taints.
57+
`effect` must be one of `NO_SCHEDULE`, `NO_EXECUTE`, or `PREFER_NO_SCHEDULE`.
58+
`key` and `effect` are required, `value` may be null.
59+
EOT
60+
default = []
61+
nullable = false
62+
}
63+
4964
variable "tags" {
5065
type = map(string)
5166
description = "Tags to be applied to created resources"

aws/cluster/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ variable "node_groups" {
6060
max_size = number
6161
max_unavailable = optional(number, 3)
6262
min_size = number
63+
taints = optional(list(object({
64+
key = string
65+
value = optional(string)
66+
effect = string
67+
})), [])
6368
}))
6469
}
6570

0 commit comments

Comments
 (0)