Skip to content

Commit ebc91bc

Browse files
authored
feat: Add support for specifying conrol plane subnets separate from those used by node groups (data plane) (#2113)
1 parent d10b173 commit ebc91bc

File tree

12 files changed

+30
-21
lines changed

12 files changed

+30
-21
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.68.1
3+
rev: v1.72.1
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_validate
@@ -23,7 +23,7 @@ repos:
2323
- '--args=--only=terraform_standard_module_structure'
2424
- '--args=--only=terraform_workspace_remote'
2525
- repo: https://github.com/pre-commit/pre-commit-hooks
26-
rev: v4.2.0
26+
rev: v4.3.0
2727
hooks:
2828
- id: check-merge-conflict
2929
- id: end-of-file-fixer

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ module "eks" {
6060
version = "~> 18.0"
6161
6262
cluster_name = "my-cluster"
63-
cluster_version = "1.21"
63+
cluster_version = "1.22"
6464
6565
cluster_endpoint_private_access = true
6666
cluster_endpoint_public_access = true
@@ -292,7 +292,8 @@ We are grateful to the community for contributing bugfixes and improvements! Ple
292292
| <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 |
293293
| <a name="input_cluster_tags"></a> [cluster\_tags](#input\_cluster\_tags) | A map of additional tags to add to the cluster | `map(string)` | `{}` | no |
294294
| <a name="input_cluster_timeouts"></a> [cluster\_timeouts](#input\_cluster\_timeouts) | Create, update, and delete timeout configurations for the cluster | `map(string)` | `{}` | no |
295-
| <a name="input_cluster_version"></a> [cluster\_version](#input\_cluster\_version) | Kubernetes `<major>.<minor>` version to use for the EKS cluster (i.e.: `1.21`) | `string` | `null` | no |
295+
| <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 |
296+
| <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 |
296297
| <a name="input_create"></a> [create](#input\_create) | Controls if EKS resources should be created (affects nearly all resources) | `bool` | `true` | no |
297298
| <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 |
298299
| <a name="input_create_cloudwatch_log_group"></a> [create\_cloudwatch\_log\_group](#input\_create\_cloudwatch\_log\_group) | Determines whether a log group is created by this module for the cluster logs. If not, AWS will automatically create one if logging is enabled | `bool` | `true` | no |
@@ -327,7 +328,7 @@ We are grateful to the community for contributing bugfixes and improvements! Ple
327328
| <a name="input_putin_khuylo"></a> [putin\_khuylo](#input\_putin\_khuylo) | Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo! | `bool` | `true` | no |
328329
| <a name="input_self_managed_node_group_defaults"></a> [self\_managed\_node\_group\_defaults](#input\_self\_managed\_node\_group\_defaults) | Map of self-managed node group default configurations | `any` | `{}` | no |
329330
| <a name="input_self_managed_node_groups"></a> [self\_managed\_node\_groups](#input\_self\_managed\_node\_groups) | Map of self-managed node group definitions to create | `any` | `{}` | no |
330-
| <a name="input_subnet_ids"></a> [subnet\_ids](#input\_subnet\_ids) | A list of subnet IDs where the EKS cluster (ENIs) will be provisioned along with the nodes/node groups. Node groups can be deployed within a different set of subnet IDs from within the node group configuration | `list(string)` | `[]` | no |
331+
| <a name="input_subnet_ids"></a> [subnet\_ids](#input\_subnet\_ids) | A list of subnet IDs where the nodes/node groups will be provisioned. If `control_plane_subnet_ids` is not provided, the EKS cluster control plane (ENIs) will be provisioned in these subnets | `list(string)` | `[]` | no |
331332
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to add to all resources | `map(string)` | `{}` | no |
332333
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | ID of the VPC where the cluster and its nodes will be provisioned | `string` | `null` | no |
333334

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.21"
144+
cluster_version = "1.22"
145145
146-
# This self managed node group will use the latest AWS EKS Optimized AMI for Kubernetes 1.21
146+
# This self managed node group will use the latest AWS EKS Optimized AMI for Kubernetes 1.22
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.21"
155+
cluster_version = "1.22"
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.21"
11+
cluster_version = "1.22"
1212
1313
cluster_addons = {
1414
vpc-cni = {

examples/complete/main.tf

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ provider "kubernetes" {
1313
cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data)
1414

1515
exec {
16-
api_version = "client.authentication.k8s.io/v1alpha1"
16+
api_version = "client.authentication.k8s.io/v1beta1"
1717
command = "aws"
1818
# This requires the awscli to be installed locally where Terraform is executed
1919
args = ["eks", "get-token", "--cluster-name", module.eks.cluster_id]
@@ -57,8 +57,9 @@ module "eks" {
5757
resources = ["secrets"]
5858
}]
5959

60-
vpc_id = module.vpc.vpc_id
61-
subnet_ids = module.vpc.private_subnets
60+
vpc_id = module.vpc.vpc_id
61+
subnet_ids = module.vpc.private_subnets
62+
control_plane_subnet_ids = module.vpc.intra_subnets
6263

6364
# Extend cluster security group rules
6465
cluster_security_group_additional_rules = {
@@ -331,6 +332,7 @@ module "vpc" {
331332
azs = ["${local.region}a", "${local.region}b", "${local.region}c"]
332333
private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
333334
public_subnets = ["10.0.4.0/24", "10.0.5.0/24", "10.0.6.0/24"]
335+
intra_subnets = ["10.0.7.0/28", "10.0.7.16/28", "10.0.7.32/28"]
334336

335337
enable_nat_gateway = true
336338
single_nat_gateway = true

examples/eks_managed_node_group/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ provider "kubernetes" {
77
cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data)
88

99
exec {
10-
api_version = "client.authentication.k8s.io/v1alpha1"
10+
api_version = "client.authentication.k8s.io/v1beta1"
1111
command = "aws"
1212
# This requires the awscli to be installed locally where Terraform is executed
1313
args = ["eks", "get-token", "--cluster-name", module.eks.cluster_id]

examples/karpenter/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ provider "helm" {
7777
cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data)
7878

7979
exec {
80-
api_version = "client.authentication.k8s.io/v1alpha1"
80+
api_version = "client.authentication.k8s.io/v1beta1"
8181
command = "aws"
8282
# This requires the awscli to be installed locally where Terraform is executed
8383
args = ["eks", "get-token", "--cluster-name", module.eks.cluster_id]
@@ -92,7 +92,7 @@ provider "kubectl" {
9292
load_config_file = false
9393

9494
exec {
95-
api_version = "client.authentication.k8s.io/v1alpha1"
95+
api_version = "client.authentication.k8s.io/v1beta1"
9696
command = "aws"
9797
# This requires the awscli to be installed locally where Terraform is executed
9898
args = ["eks", "get-token", "--cluster-name", module.eks.cluster_id]

examples/self_managed_node_group/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ provider "kubernetes" {
77
cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data)
88

99
exec {
10-
api_version = "client.authentication.k8s.io/v1alpha1"
10+
api_version = "client.authentication.k8s.io/v1beta1"
1111
command = "aws"
1212
# This requires the awscli to be installed locally where Terraform is executed
1313
args = ["eks", "get-token", "--cluster-name", module.eks.cluster_id]

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ resource "aws_eks_cluster" "this" {
1818

1919
vpc_config {
2020
security_group_ids = compact(distinct(concat(var.cluster_additional_security_group_ids, [local.cluster_security_group_id])))
21-
subnet_ids = var.subnet_ids
21+
subnet_ids = coalescelist(var.control_plane_subnet_ids, var.subnet_ids)
2222
endpoint_private_access = var.cluster_endpoint_private_access
2323
endpoint_public_access = var.cluster_endpoint_public_access
2424
public_access_cidrs = var.cluster_endpoint_public_access_cidrs

modules/eks-managed-node-group/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module "eks_managed_node_group" {
1010
1111
name = "separate-eks-mng"
1212
cluster_name = "my-cluster"
13-
cluster_version = "1.21"
13+
cluster_version = "1.22"
1414
1515
vpc_id = "vpc-1234556abcdef"
1616
subnet_ids = ["subnet-abcde012", "subnet-bcde012a", "subnet-fghi345a"]

0 commit comments

Comments
 (0)