Skip to content

Commit 2a3bee4

Browse files
authored
feat: Add support for eks addons for vpc cni, kube-proxy, coredns (#54)
* feat: Add support for eks addons for vpc cni, kube-proxy, coredns * fix: Try to fix readme formatting
1 parent 75d724e commit 2a3bee4

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed

modules/eks/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ Create a Kubernetes cluster using EKS.
44

55
## Notes
66

7+
This module supports using EKS "Addons" to maintain and upgrade core resources in the cluster like the VPC CNI, kube-proxy and Core DNS.
8+
9+
See the necessary versions for each EKS version here:
10+
11+
[https://docs.aws.amazon.com/eks/latest/userguide/managing-vpc-cni.html](https://docs.aws.amazon.com/eks/latest/userguide/managing-vpc-cni.html)
12+
13+
[https://docs.aws.amazon.com/eks/latest/userguide/managing-coredns.html](https://docs.aws.amazon.com/eks/latest/userguide/managing-coredns.html)
14+
15+
[https://docs.aws.amazon.com/eks/latest/userguide/managing-kube-proxy.html](https://docs.aws.amazon.com/eks/latest/userguide/managing-kube-proxy.html)
16+
717
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
818
## Requirements
919

@@ -22,6 +32,9 @@ Create a Kubernetes cluster using EKS.
2232

2333
| Name | Description | Type | Default | Required |
2434
|------|-------------|------|---------|:--------:|
35+
| addon\_coredns\_version | Version of CoreDNS to install. If empty you will need to upgrade CoreDNS yourself during a cluster version upgrade | `string` | `""` | no |
36+
| addon\_kube\_proxy\_version | Version of kube proxy to install. If empty you will need to upgrade kube proxy yourself during a cluster version upgrade | `string` | `""` | no |
37+
| addon\_vpc\_cni\_version | Version of the VPC CNI to install. If empty you will need to upgrade the CNI yourself during a cluster version upgrade | `string` | `""` | no |
2538
| cluster\_name | Name to be given to the EKS cluster | `any` | n/a | yes |
2639
| cluster\_version | EKS cluster version number to use. Incrementing this will start a cluster upgrade | `any` | n/a | yes |
2740
| eks\_node\_groups | Map of maps of EKS node group config where keys are node group names | <pre>map(object({<br> instance_types = list(string)<br> asg_min_size = string<br> asg_max_size = string<br> use_spot_instances = bool<br> ami_type = string<br> }))</pre> | n/a | yes |

modules/eks/main.tf

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,30 @@ module "eks" {
7272
environment = var.environment
7373
}
7474
}
75+
76+
resource "aws_eks_addon" "vpc_cni" {
77+
count = var.addon_vpc_cni_version == "" ? 0 : 1
78+
79+
cluster_name = var.cluster_name
80+
addon_name = "vpc-cni"
81+
resolve_conflicts = "OVERWRITE"
82+
addon_version = var.addon_vpc_cni_version
83+
}
84+
85+
resource "aws_eks_addon" "kube_proxy" {
86+
count = var.addon_kube_proxy_version == "" ? 0 : 1
87+
88+
cluster_name = var.cluster_name
89+
addon_name = "kube-proxy"
90+
resolve_conflicts = "OVERWRITE"
91+
addon_version = var.addon_kube_proxy_version
92+
}
93+
94+
resource "aws_eks_addon" "coredns" {
95+
count = var.addon_coredns_version == "" ? 0 : 1
96+
97+
cluster_name = var.cluster_name
98+
addon_name = "coredns"
99+
resolve_conflicts = "OVERWRITE"
100+
addon_version = var.addon_coredns_version
101+
}

modules/eks/variables.tf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,21 @@ variable "iam_role_mapping" {
4646
}))
4747
description = "List of mappings of AWS Roles to Kubernetes Groups"
4848
}
49+
50+
variable "addon_vpc_cni_version" {
51+
description = "Version of the VPC CNI to install. If empty you will need to upgrade the CNI yourself during a cluster version upgrade"
52+
type = string
53+
default = ""
54+
}
55+
56+
variable "addon_kube_proxy_version" {
57+
description = "Version of kube proxy to install. If empty you will need to upgrade kube proxy yourself during a cluster version upgrade"
58+
type = string
59+
default = ""
60+
}
61+
62+
variable "addon_coredns_version" {
63+
description = "Version of CoreDNS to install. If empty you will need to upgrade CoreDNS yourself during a cluster version upgrade"
64+
type = string
65+
default = ""
66+
}

0 commit comments

Comments
 (0)