Skip to content

Commit

Permalink
Merge pull request #26 from msfidelis/feature/eks_1.29
Browse files Browse the repository at this point in the history
Upgrade EKS to Kubernetes 1.29
  • Loading branch information
msfidelis authored Jan 25, 2024
2 parents 2dc907b + 9af603f commit f32389e
Show file tree
Hide file tree
Showing 34 changed files with 832 additions and 759 deletions.
69 changes: 36 additions & 33 deletions README.md

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions addons.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
resource "aws_eks_addon" "cni" {
cluster_name = aws_eks_cluster.eks_cluster.name
addon_name = "vpc-cni"
cluster_name = aws_eks_cluster.eks_cluster.name
addon_name = "vpc-cni"

addon_version = var.addon_cni_version
resolve_conflicts = "OVERWRITE"
Expand All @@ -12,8 +12,8 @@ resource "aws_eks_addon" "cni" {
}

resource "aws_eks_addon" "coredns" {
cluster_name = aws_eks_cluster.eks_cluster.name
addon_name = "coredns"
cluster_name = aws_eks_cluster.eks_cluster.name
addon_name = "coredns"

addon_version = var.addon_coredns_version
resolve_conflicts = "OVERWRITE"
Expand All @@ -25,8 +25,8 @@ resource "aws_eks_addon" "coredns" {
}

resource "aws_eks_addon" "kubeproxy" {
cluster_name = aws_eks_cluster.eks_cluster.name
addon_name = "kube-proxy"
cluster_name = aws_eks_cluster.eks_cluster.name
addon_name = "kube-proxy"

addon_version = var.addon_kubeproxy_version
resolve_conflicts = "OVERWRITE"
Expand All @@ -37,8 +37,8 @@ resource "aws_eks_addon" "kubeproxy" {
}

resource "aws_eks_addon" "csi_driver" {
cluster_name = aws_eks_cluster.eks_cluster.name
addon_name = "aws-ebs-csi-driver"
cluster_name = aws_eks_cluster.eks_cluster.name
addon_name = "aws-ebs-csi-driver"

addon_version = var.addon_csi_version
resolve_conflicts = "OVERWRITE"
Expand Down
6 changes: 3 additions & 3 deletions aws-auth-config.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
resource "kubernetes_config_map" "aws-auth" {
metadata {
name = "aws-auth"
namespace = "kube-system"
name = "aws-auth"
namespace = "kube-system"
}

data = {
mapRoles = <<YAML
mapRoles = <<YAML
- rolearn: ${aws_iam_role.eks_nodes_roles.arn}
username: system:node:{{EC2PrivateDNSName}}
groups:
Expand Down
122 changes: 61 additions & 61 deletions eks.tf
Original file line number Diff line number Diff line change
@@ -1,90 +1,90 @@

resource "aws_eks_cluster" "eks_cluster" {

name = var.cluster_name
version = var.k8s_version
role_arn = aws_iam_role.eks_cluster_role.arn
name = var.cluster_name
version = var.k8s_version
role_arn = aws_iam_role.eks_cluster_role.arn

vpc_config {
vpc_config {

security_group_ids = [
aws_security_group.cluster_sg.id,
aws_security_group.cluster_nodes_sg.id
]
security_group_ids = [
aws_security_group.cluster_sg.id,
aws_security_group.cluster_nodes_sg.id
]

subnet_ids = [
aws_subnet.private_subnet_1a.id,
aws_subnet.private_subnet_1b.id,
aws_subnet.private_subnet_1c.id
]

subnet_ids = [
aws_subnet.private_subnet_1a.id,
aws_subnet.private_subnet_1b.id,
aws_subnet.private_subnet_1c.id
]
}

encryption_config {
provider {
key_arn = aws_kms_key.eks.arn
}
resources = ["secrets"]
}

encryption_config {
provider {
key_arn = aws_kms_key.eks.arn
}
resources = ["secrets"]
}
enabled_cluster_log_types = [
"api", "audit", "authenticator", "controllerManager", "scheduler"
]

enabled_cluster_log_types = [
"api", "audit", "authenticator", "controllerManager", "scheduler"
]

tags = {
"kubernetes.io/cluster/${var.cluster_name}" = "shared"
"k8s.io/cluster-autoscaler/${var.cluster_name}" = "owned",
"k8s.io/cluster-autoscaler/enabled" = true
}
tags = {
"kubernetes.io/cluster/${var.cluster_name}" = "shared"
"k8s.io/cluster-autoscaler/${var.cluster_name}" = "owned",
"k8s.io/cluster-autoscaler/enabled" = true
}

}

resource "aws_security_group" "cluster_sg" {
name = format("%s-sg", var.cluster_name)
vpc_id = aws_vpc.cluster_vpc.id
name = format("%s-sg", var.cluster_name)
vpc_id = aws_vpc.cluster_vpc.id

egress {
from_port = 0
to_port = 0
egress {
from_port = 0
to_port = 0

protocol = "-1"
cidr_blocks = [ "0.0.0.0/0" ]
}
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}

tags = {
Name = format("%s-sg", var.cluster_name)
}
tags = {
Name = format("%s-sg", var.cluster_name)
}

}

resource "aws_security_group_rule" "cluster_ingress_https" {
cidr_blocks = ["0.0.0.0/0"]
from_port = 443
to_port = 443
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
from_port = 443
to_port = 443
protocol = "tcp"

security_group_id = aws_security_group.cluster_sg.id
type = "ingress"
security_group_id = aws_security_group.cluster_sg.id
type = "ingress"
}

resource "aws_security_group_rule" "nodeport_cluster" {
cidr_blocks = ["0.0.0.0/0"]
from_port = 30000
to_port = 32768
description = "nodeport"
protocol = "tcp"

security_group_id = aws_eks_cluster.eks_cluster.vpc_config[0].cluster_security_group_id
type = "ingress"
cidr_blocks = ["0.0.0.0/0"]
from_port = 30000
to_port = 32768
description = "nodeport"
protocol = "tcp"

security_group_id = aws_eks_cluster.eks_cluster.vpc_config[0].cluster_security_group_id
type = "ingress"
}

resource "aws_security_group_rule" "nodeport_cluster_udp" {
cidr_blocks = ["0.0.0.0/0"]
from_port = 30000
to_port = 32768
description = "nodeport"
protocol = "udp"

security_group_id = aws_eks_cluster.eks_cluster.vpc_config[0].cluster_security_group_id
type = "ingress"
cidr_blocks = ["0.0.0.0/0"]
from_port = 30000
to_port = 32768
description = "nodeport"
protocol = "udp"

security_group_id = aws_eks_cluster.eks_cluster.vpc_config[0].cluster_security_group_id
type = "ingress"
}
86 changes: 43 additions & 43 deletions helm_alb_ingress_controller.tf
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
resource "helm_release" "alb_ingress_controller" {
name = "aws-load-balancer-controller"
repository = "https://aws.github.io/eks-charts"
chart = "aws-load-balancer-controller"
namespace = "kube-system"
create_namespace = true

set {
name = "clusterName"
value = var.cluster_name
}

set {
name = "serviceAccount.create"
value = true
}

set {
name = "serviceAccount.name"
value = "aws-load-balancer-controller"
}

set {
name = "serviceAccount.annotations.eks\\.amazonaws\\.com/role-arn"
value = aws_iam_role.alb_controller.arn
}

set {
name = "region"
value = var.aws_region
}


set {
name = "vpcId"
value = aws_vpc.cluster_vpc.id

}

depends_on = [
aws_eks_cluster.eks_cluster,
aws_eks_node_group.cluster,
kubernetes_config_map.aws-auth
]
name = "aws-load-balancer-controller"
repository = "https://aws.github.io/eks-charts"
chart = "aws-load-balancer-controller"
namespace = "kube-system"
create_namespace = true

set {
name = "clusterName"
value = var.cluster_name
}

set {
name = "serviceAccount.create"
value = true
}

set {
name = "serviceAccount.name"
value = "aws-load-balancer-controller"
}

set {
name = "serviceAccount.annotations.eks\\.amazonaws\\.com/role-arn"
value = aws_iam_role.alb_controller.arn
}

set {
name = "region"
value = var.aws_region
}


set {
name = "vpcId"
value = aws_vpc.cluster_vpc.id

}

depends_on = [
aws_eks_cluster.eks_cluster,
aws_eks_node_group.cluster,
kubernetes_config_map.aws-auth
]
}
Loading

0 comments on commit f32389e

Please sign in to comment.