Skip to content

Commit

Permalink
Add support for node_groups taints
Browse files Browse the repository at this point in the history
  • Loading branch information
nauxliu committed Jun 2, 2021
1 parent bf4fd83 commit dce64ae
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
7 changes: 7 additions & 0 deletions examples/managed_node_groups/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ module "eks" {
additional_tags = {
ExtraTag = "example"
}
taints = [
{
key = "dedicated"
value = "gpuGroup"
effect = "NO_SCHEDULE"
}
]
}
}

Expand Down
5 changes: 3 additions & 2 deletions modules/node_groups/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,21 @@ The role ARN specified in `var.default_iam_role_arn` will be used by default. In
| source\_security\_group\_ids | Source security groups for remote access to workers | list(string) | If key\_name is specified: THE REMOTE ACCESS WILL BE OPENED TO THE WORLD |
| subnets | Subnets to contain workers | list(string) | `var.workers_group_defaults[subnets]` |
| version | Kubernetes version | string | Provider default behavior |
| taints | Kubernetes node taints | list(map) | empty |

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.40.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.43.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.40.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.43.0 |
| <a name="provider_cloudinit"></a> [cloudinit](#provider\_cloudinit) | n/a |

## Modules
Expand Down
1 change: 1 addition & 0 deletions modules/node_groups/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ locals {
public_ip = var.workers_group_defaults["public_ip"]
pre_userdata = var.workers_group_defaults["pre_userdata"]
additional_security_group_ids = var.workers_group_defaults["additional_security_group_ids"]
taints = []
},
var.node_groups_defaults,
v,
Expand Down
10 changes: 10 additions & 0 deletions modules/node_groups/node_groups.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ resource "aws_eks_node_group" "workers" {
}
}

dynamic "taint" {
for_each = each.value["taints"]

content {
key = taint.value["key"]
value = taint.value["value"]
effect = taint.value["effect"]
}
}

version = lookup(each.value, "version", null)

labels = merge(
Expand Down
2 changes: 1 addition & 1 deletion modules/node_groups/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ terraform {
required_version = ">= 0.13.1"

required_providers {
aws = ">= 3.40.0"
aws = ">= 3.43.0"
}
}

0 comments on commit dce64ae

Please sign in to comment.