Skip to content

Commit d6c0f4f

Browse files
committed
Add input option for taints in nodegroups
1 parent 834e7e4 commit d6c0f4f

4 files changed

Lines changed: 29 additions & 1 deletion

File tree

aws/cluster/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ module "node_groups" {
4848
role = module.node_role.instance
4949
subnets = values(data.aws_subnet.private)
5050
tags = var.tags
51+
taints = each.value.taints
5152

5253
depends_on = [module.node_role]
5354
}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ resource "aws_eks_node_group" "this" {
2020
lifecycle {
2121
ignore_changes = [scaling_config[0].desired_size]
2222
}
23+
24+
dynamic "taint" {
25+
for_each = var.taints
26+
content {
27+
key = taint.value["key"]
28+
value = taint.value["value"]
29+
effect = taint.value["effect"]
30+
}
31+
}
2332
}
2433

2534
locals {

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,20 @@ variable "subnets" {
3939
type = list(object({ id = string, availability_zone = string }))
4040
description = "Subnets in which the node group should run"
4141
}
42+
variable "taints" {
43+
type = list(object({
44+
key = string
45+
value = optional(string)
46+
effect = string
47+
}))
48+
description = <<-EOT
49+
List of `key`, `value`, `effect` objects representing Kubernetes taints.
50+
`effect` must be one of `NO_SCHEDULE`, `NO_EXECUTE`, or `PREFER_NO_SCHEDULE`.
51+
`key` and `effect` are required, `value` may be null.
52+
EOT
53+
default = []
54+
nullable = false
55+
}
4256

4357
variable "tags" {
4458
type = map(string)

aws/cluster/variables.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,13 @@ variable "node_groups" {
3333
instance_types = list(string),
3434
max_size = number
3535
min_size = number
36+
taints = optional(list(object({
37+
key = string
38+
value = optional(string)
39+
effect = string
40+
})), [])
3641
}))
3742
}
38-
3943
variable "tags" {
4044
type = map(string)
4145
description = "Tags to be applied to all created resources"

0 commit comments

Comments
 (0)