Skip to content

Commit f24de33

Browse files
authored
feat: New Karpenter sub-module for easily enabling Karpenter on EKS (#2303)
1 parent 1bc86e1 commit f24de33

File tree

28 files changed

+1334
-160
lines changed

28 files changed

+1334
-160
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Please note that we strive to provide a comprehensive suite of documentation for
2929
- [EKS Managed Node Group](https://docs.aws.amazon.com/eks/latest/userguide/managed-node-groups.html)
3030
- [Self Managed Node Group](https://docs.aws.amazon.com/eks/latest/userguide/worker.html)
3131
- [Fargate Profile](https://docs.aws.amazon.com/eks/latest/userguide/fargate.html)
32+
- Support for creating Karpenter related AWS infrastruture resources (e.g. IAM roles, SQS queue, EventBridge rules, etc.)
3233
- Support for custom AMI, custom launch template, and custom user data including custom user data template
3334
- Support for Amazon Linux 2 EKS Optimized AMI and Bottlerocket nodes
3435
- Windows based node support is limited to a default user data template that is provided due to the lack of Windows support and manual steps required to provision Windows based EKS nodes
@@ -60,7 +61,7 @@ module "eks" {
6061
version = "~> 18.0"
6162
6263
cluster_name = "my-cluster"
63-
cluster_version = "1.22"
64+
cluster_version = "1.24"
6465
6566
cluster_endpoint_private_access = true
6667
cluster_endpoint_public_access = true
@@ -295,7 +296,7 @@ We are grateful to the community for contributing bugfixes and improvements! Ple
295296
| <a name="input_cluster_service_ipv4_cidr"></a> [cluster\_service\_ipv4\_cidr](#input\_cluster\_service\_ipv4\_cidr) | The CIDR block to assign Kubernetes service IP addresses from. If you don't specify a block, Kubernetes assigns addresses from either the 10.100.0.0/16 or 172.20.0.0/16 CIDR blocks | `string` | `null` | no |
296297
| <a name="input_cluster_tags"></a> [cluster\_tags](#input\_cluster\_tags) | A map of additional tags to add to the cluster | `map(string)` | `{}` | no |
297298
| <a name="input_cluster_timeouts"></a> [cluster\_timeouts](#input\_cluster\_timeouts) | Create, update, and delete timeout configurations for the cluster | `map(string)` | `{}` | no |
298-
| <a name="input_cluster_version"></a> [cluster\_version](#input\_cluster\_version) | Kubernetes `<major>.<minor>` version to use for the EKS cluster (i.e.: `1.22`) | `string` | `null` | no |
299+
| <a name="input_cluster_version"></a> [cluster\_version](#input\_cluster\_version) | Kubernetes `<major>.<minor>` version to use for the EKS cluster (i.e.: `1.24`) | `string` | `null` | no |
299300
| <a name="input_control_plane_subnet_ids"></a> [control\_plane\_subnet\_ids](#input\_control\_plane\_subnet\_ids) | A list of subnet IDs where the EKS cluster control plane (ENIs) will be provisioned. Used for expanding the pool of subnets used by nodes/node groups without replacing the EKS control plane | `list(string)` | `[]` | no |
300301
| <a name="input_create"></a> [create](#input\_create) | Controls if EKS resources should be created (affects nearly all resources) | `bool` | `true` | no |
301302
| <a name="input_create_aws_auth_configmap"></a> [create\_aws\_auth\_configmap](#input\_create\_aws\_auth\_configmap) | Determines whether to create the aws-auth configmap. NOTE - this is only intended for scenarios where the configmap does not exist (i.e. - when using only self-managed node groups). Most users should use `manage_aws_auth_configmap` | `bool` | `false` | no |
@@ -363,8 +364,9 @@ We are grateful to the community for contributing bugfixes and improvements! Ple
363364
| <a name="output_cluster_iam_role_arn"></a> [cluster\_iam\_role\_arn](#output\_cluster\_iam\_role\_arn) | IAM role ARN of the EKS cluster |
364365
| <a name="output_cluster_iam_role_name"></a> [cluster\_iam\_role\_name](#output\_cluster\_iam\_role\_name) | IAM role name of the EKS cluster |
365366
| <a name="output_cluster_iam_role_unique_id"></a> [cluster\_iam\_role\_unique\_id](#output\_cluster\_iam\_role\_unique\_id) | Stable and unique string identifying the IAM role |
366-
| <a name="output_cluster_id"></a> [cluster\_id](#output\_cluster\_id) | The name/id of the EKS cluster. Will block on cluster creation until the cluster is really ready |
367+
| <a name="output_cluster_id"></a> [cluster\_id](#output\_cluster\_id) | The id of the EKS cluster. Will block on cluster creation until the cluster is really ready |
367368
| <a name="output_cluster_identity_providers"></a> [cluster\_identity\_providers](#output\_cluster\_identity\_providers) | Map of attribute maps for all EKS identity providers enabled |
369+
| <a name="output_cluster_name"></a> [cluster\_name](#output\_cluster\_name) | The name of the EKS cluster. Will block on cluster creation until the cluster is really ready |
368370
| <a name="output_cluster_oidc_issuer_url"></a> [cluster\_oidc\_issuer\_url](#output\_cluster\_oidc\_issuer\_url) | The URL on the EKS cluster for the OpenID Connect identity provider |
369371
| <a name="output_cluster_platform_version"></a> [cluster\_platform\_version](#output\_cluster\_platform\_version) | Platform version for the cluster |
370372
| <a name="output_cluster_primary_security_group_id"></a> [cluster\_primary\_security\_group\_id](#output\_cluster\_primary\_security\_group\_id) | Cluster security group that was created by Amazon EKS for the cluster. Managed node groups use this security group for control-plane-to-data-plane communication. Referred to as 'Cluster security group' in the EKS console |

docs/compute_resources.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ Refer to the [Self Managed Node Group documentation](https://docs.aws.amazon.com
141141
1. The `self-managed-node-group` uses the latest AWS EKS Optimized AMI (Linux) for the given Kubernetes version by default:
142142

143143
```hcl
144-
cluster_version = "1.22"
144+
cluster_version = "1.24"
145145
146-
# This self managed node group will use the latest AWS EKS Optimized AMI for Kubernetes 1.22
146+
# This self managed node group will use the latest AWS EKS Optimized AMI for Kubernetes 1.24
147147
self_managed_node_groups = {
148148
default = {}
149149
}
@@ -152,7 +152,7 @@ Refer to the [Self Managed Node Group documentation](https://docs.aws.amazon.com
152152
2. To use Bottlerocket, specify the `platform` as `bottlerocket` and supply a Bottlerocket OS AMI:
153153

154154
```hcl
155-
cluster_version = "1.22"
155+
cluster_version = "1.24"
156156
157157
self_managed_node_groups = {
158158
bottlerocket = {

docs/irsa_integration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module "eks" {
88
source = "terraform-aws-modules/eks/aws"
99
1010
cluster_name = "example"
11-
cluster_version = "1.22"
11+
cluster_version = "1.24"
1212
1313
cluster_addons = {
1414
vpc-cni = {

examples/complete/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@ No inputs.
8181
| <a name="output_cluster_iam_role_arn"></a> [cluster\_iam\_role\_arn](#output\_cluster\_iam\_role\_arn) | IAM role ARN of the EKS cluster |
8282
| <a name="output_cluster_iam_role_name"></a> [cluster\_iam\_role\_name](#output\_cluster\_iam\_role\_name) | IAM role name of the EKS cluster |
8383
| <a name="output_cluster_iam_role_unique_id"></a> [cluster\_iam\_role\_unique\_id](#output\_cluster\_iam\_role\_unique\_id) | Stable and unique string identifying the IAM role |
84-
| <a name="output_cluster_id"></a> [cluster\_id](#output\_cluster\_id) | The name/id of the EKS cluster. Will block on cluster creation until the cluster is really ready |
84+
| <a name="output_cluster_id"></a> [cluster\_id](#output\_cluster\_id) | The id of the EKS cluster. Will block on cluster creation until the cluster is really ready |
8585
| <a name="output_cluster_identity_providers"></a> [cluster\_identity\_providers](#output\_cluster\_identity\_providers) | Map of attribute maps for all EKS identity providers enabled |
86+
| <a name="output_cluster_name"></a> [cluster\_name](#output\_cluster\_name) | The name of the EKS cluster. Will block on cluster creation until the cluster is really ready |
8687
| <a name="output_cluster_oidc_issuer_url"></a> [cluster\_oidc\_issuer\_url](#output\_cluster\_oidc\_issuer\_url) | The URL on the EKS cluster for the OpenID Connect identity provider |
8788
| <a name="output_cluster_platform_version"></a> [cluster\_platform\_version](#output\_cluster\_platform\_version) | Platform version for the cluster |
8889
| <a name="output_cluster_security_group_arn"></a> [cluster\_security\_group\_arn](#output\_cluster\_security\_group\_arn) | Amazon Resource Name (ARN) of the cluster security group |

examples/complete/main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ provider "kubernetes" {
1010
api_version = "client.authentication.k8s.io/v1beta1"
1111
command = "aws"
1212
# This requires the awscli to be installed locally where Terraform is executed
13-
args = ["eks", "get-token", "--cluster-name", module.eks.cluster_id]
13+
args = ["eks", "get-token", "--cluster-name", module.eks.cluster_name]
1414
}
1515
}
1616

@@ -267,7 +267,7 @@ module "eks_managed_node_group" {
267267
source = "../../modules/eks-managed-node-group"
268268

269269
name = "separate-eks-mng"
270-
cluster_name = module.eks.cluster_id
270+
cluster_name = module.eks.cluster_name
271271
cluster_version = module.eks.cluster_version
272272

273273
vpc_id = module.vpc.vpc_id
@@ -298,7 +298,7 @@ module "self_managed_node_group" {
298298
source = "../../modules/self-managed-node-group"
299299

300300
name = "separate-self-mng"
301-
cluster_name = module.eks.cluster_id
301+
cluster_name = module.eks.cluster_name
302302
cluster_version = module.eks.cluster_version
303303
cluster_endpoint = module.eks.cluster_endpoint
304304
cluster_auth_base64 = module.eks.cluster_certificate_authority_data
@@ -319,7 +319,7 @@ module "fargate_profile" {
319319
source = "../../modules/fargate-profile"
320320

321321
name = "separate-fargate-profile"
322-
cluster_name = module.eks.cluster_id
322+
cluster_name = module.eks.cluster_name
323323

324324
subnet_ids = module.vpc.private_subnets
325325
selectors = [{

examples/complete/outputs.tf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,13 @@ output "cluster_endpoint" {
1717
value = module.eks.cluster_endpoint
1818
}
1919

20+
output "cluster_name" {
21+
description = "The name of the EKS cluster. Will block on cluster creation until the cluster is really ready"
22+
value = module.eks.cluster_name
23+
}
24+
2025
output "cluster_id" {
21-
description = "The name/id of the EKS cluster. Will block on cluster creation until the cluster is really ready"
26+
description = "The id of the EKS cluster. Will block on cluster creation until the cluster is really ready"
2227
value = module.eks.cluster_id
2328
}
2429

examples/eks_managed_node_group/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,9 @@ No inputs.
115115
| <a name="output_cluster_iam_role_arn"></a> [cluster\_iam\_role\_arn](#output\_cluster\_iam\_role\_arn) | IAM role ARN of the EKS cluster |
116116
| <a name="output_cluster_iam_role_name"></a> [cluster\_iam\_role\_name](#output\_cluster\_iam\_role\_name) | IAM role name of the EKS cluster |
117117
| <a name="output_cluster_iam_role_unique_id"></a> [cluster\_iam\_role\_unique\_id](#output\_cluster\_iam\_role\_unique\_id) | Stable and unique string identifying the IAM role |
118-
| <a name="output_cluster_id"></a> [cluster\_id](#output\_cluster\_id) | The name/id of the EKS cluster. Will block on cluster creation until the cluster is really ready |
118+
| <a name="output_cluster_id"></a> [cluster\_id](#output\_cluster\_id) | The id of the EKS cluster. Will block on cluster creation until the cluster is really ready |
119119
| <a name="output_cluster_identity_providers"></a> [cluster\_identity\_providers](#output\_cluster\_identity\_providers) | Map of attribute maps for all EKS identity providers enabled |
120+
| <a name="output_cluster_name"></a> [cluster\_name](#output\_cluster\_name) | The name of the EKS cluster. Will block on cluster creation until the cluster is really ready |
120121
| <a name="output_cluster_oidc_issuer_url"></a> [cluster\_oidc\_issuer\_url](#output\_cluster\_oidc\_issuer\_url) | The URL on the EKS cluster for the OpenID Connect identity provider |
121122
| <a name="output_cluster_platform_version"></a> [cluster\_platform\_version](#output\_cluster\_platform\_version) | Platform version for the cluster |
122123
| <a name="output_cluster_primary_security_group_id"></a> [cluster\_primary\_security\_group\_id](#output\_cluster\_primary\_security\_group\_id) | Cluster security group that was created by Amazon EKS for the cluster. Managed node groups use this security group for control-plane-to-data-plane communication. Referred to as 'Cluster security group' in the EKS console |

examples/eks_managed_node_group/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ provider "kubernetes" {
1010
api_version = "client.authentication.k8s.io/v1beta1"
1111
command = "aws"
1212
# This requires the awscli to be installed locally where Terraform is executed
13-
args = ["eks", "get-token", "--cluster-name", module.eks.cluster_id]
13+
args = ["eks", "get-token", "--cluster-name", module.eks.cluster_name]
1414
}
1515
}
1616

1717
locals {
1818
name = "ex-${replace(basename(path.cwd), "_", "-")}"
19-
cluster_version = "1.22"
19+
cluster_version = "1.24"
2020
region = "eu-west-1"
2121

2222
tags = {

examples/eks_managed_node_group/outputs.tf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,13 @@ output "cluster_endpoint" {
1717
value = module.eks.cluster_endpoint
1818
}
1919

20+
output "cluster_name" {
21+
description = "The name of the EKS cluster. Will block on cluster creation until the cluster is really ready"
22+
value = module.eks.cluster_name
23+
}
24+
2025
output "cluster_id" {
21-
description = "The name/id of the EKS cluster. Will block on cluster creation until the cluster is really ready"
26+
description = "The id of the EKS cluster. Will block on cluster creation until the cluster is really ready"
2227
value = module.eks.cluster_id
2328
}
2429

examples/fargate_profile/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ No inputs.
6868
| <a name="output_cluster_iam_role_arn"></a> [cluster\_iam\_role\_arn](#output\_cluster\_iam\_role\_arn) | IAM role ARN of the EKS cluster |
6969
| <a name="output_cluster_iam_role_name"></a> [cluster\_iam\_role\_name](#output\_cluster\_iam\_role\_name) | IAM role name of the EKS cluster |
7070
| <a name="output_cluster_iam_role_unique_id"></a> [cluster\_iam\_role\_unique\_id](#output\_cluster\_iam\_role\_unique\_id) | Stable and unique string identifying the IAM role |
71-
| <a name="output_cluster_id"></a> [cluster\_id](#output\_cluster\_id) | The name/id of the EKS cluster. Will block on cluster creation until the cluster is really ready |
71+
| <a name="output_cluster_id"></a> [cluster\_id](#output\_cluster\_id) | The id of the EKS cluster. Will block on cluster creation until the cluster is really ready |
7272
| <a name="output_cluster_identity_providers"></a> [cluster\_identity\_providers](#output\_cluster\_identity\_providers) | Map of attribute maps for all EKS identity providers enabled |
73+
| <a name="output_cluster_name"></a> [cluster\_name](#output\_cluster\_name) | The name of the EKS cluster. Will block on cluster creation until the cluster is really ready |
7374
| <a name="output_cluster_oidc_issuer_url"></a> [cluster\_oidc\_issuer\_url](#output\_cluster\_oidc\_issuer\_url) | The URL on the EKS cluster for the OpenID Connect identity provider |
7475
| <a name="output_cluster_platform_version"></a> [cluster\_platform\_version](#output\_cluster\_platform\_version) | Platform version for the cluster |
7576
| <a name="output_cluster_primary_security_group_id"></a> [cluster\_primary\_security\_group\_id](#output\_cluster\_primary\_security\_group\_id) | Cluster security group that was created by Amazon EKS for the cluster. Managed node groups use this security group for control-plane-to-data-plane communication. Referred to as 'Cluster security group' in the EKS console |

examples/fargate_profile/main.tf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ provider "helm" {
1111
api_version = "client.authentication.k8s.io/v1beta1"
1212
command = "aws"
1313
# This requires the awscli to be installed locally where Terraform is executed
14-
args = ["eks", "get-token", "--cluster-name", module.eks.cluster_id]
14+
args = ["eks", "get-token", "--cluster-name", module.eks.cluster_name]
1515
}
1616
}
1717
}
1818

1919
locals {
2020
name = "ex-${replace(basename(path.cwd), "_", "-")}"
21-
cluster_version = "1.22"
21+
cluster_version = "1.24"
2222
region = "eu-west-1"
2323

2424
tags = {
@@ -104,7 +104,7 @@ module "eks" {
104104
################################################################################
105105

106106
data "aws_eks_cluster_auth" "this" {
107-
name = module.eks.cluster_id
107+
name = module.eks.cluster_name
108108
}
109109

110110
locals {
@@ -113,7 +113,7 @@ locals {
113113
kind = "Config"
114114
current-context = "terraform"
115115
clusters = [{
116-
name = module.eks.cluster_id
116+
name = module.eks.cluster_name
117117
cluster = {
118118
certificate-authority-data = module.eks.cluster_certificate_authority_data
119119
server = module.eks.cluster_endpoint
@@ -122,7 +122,7 @@ locals {
122122
contexts = [{
123123
name = "terraform"
124124
context = {
125-
cluster = module.eks.cluster_id
125+
cluster = module.eks.cluster_name
126126
user = "terraform"
127127
}
128128
}]

examples/fargate_profile/outputs.tf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,13 @@ output "cluster_endpoint" {
1717
value = module.eks.cluster_endpoint
1818
}
1919

20+
output "cluster_name" {
21+
description = "The name of the EKS cluster. Will block on cluster creation until the cluster is really ready"
22+
value = module.eks.cluster_name
23+
}
24+
2025
output "cluster_id" {
21-
description = "The name/id of the EKS cluster. Will block on cluster creation until the cluster is really ready"
26+
description = "The id of the EKS cluster. Will block on cluster creation until the cluster is really ready"
2227
value = module.eks.cluster_id
2328
}
2429

0 commit comments

Comments
 (0)