Skip to content

Commit

Permalink
chore: Update EKS version to 1.30 where applicable (#1952)
Browse files Browse the repository at this point in the history
  • Loading branch information
bryantbiggs authored May 25, 2024
1 parent 1586ff9 commit 3bfc0f0
Show file tree
Hide file tree
Showing 23 changed files with 103 additions and 98 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/streetsidesoftware/cspell-cli
rev: v8.8.0
rev: v8.8.2
hooks:
- id: cspell
args: [--exclude, 'ADOPTERS.md', --exclude, '.pre-commit-config.yaml', --exclude, '.gitignore', --exclude, '*.drawio', --exclude, 'mkdocs.yml', --exclude, '.helmignore', --exclude, '.github/workflows/*', --exclude, 'patterns/istio-multi-cluster/*', --exclude, 'patterns/blue-green-upgrade/*']
Expand All @@ -19,7 +19,7 @@ repos:
- id: detect-aws-credentials
args: [--allow-missing-credentials]
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.89.1
rev: v1.90.0
hooks:
- id: terraform_fmt
- id: terraform_docs
Expand Down
2 changes: 2 additions & 0 deletions docs/cSpell_dict.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ cainjector
chdir
cidrsubnet
ciliumnetworkpolicy
cloudinit
clusterip
clusterissuer
clusterrole
Expand Down Expand Up @@ -111,6 +112,7 @@ mtls
nccl
netcat
nics
nodeadm
nodegroup
nodeport
nvme
Expand Down
6 changes: 2 additions & 4 deletions patterns/agones-game-controller/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ locals {
name = basename(path.cwd)
region = "us-west-2"

cluster_version = "1.29"

vpc_cidr = "10.0.0.0/16"
azs = slice(data.aws_availability_zones.available.names, 0, 3)

Expand All @@ -42,10 +40,10 @@ locals {

module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "~> 20.8"
version = "~> 20.11"

cluster_name = local.name
cluster_version = local.cluster_version
cluster_version = "1.30"
cluster_endpoint_public_access = true

# Give the Terraform identity admin access to the cluster
Expand Down
4 changes: 2 additions & 2 deletions patterns/aws-vpc-cni-network-policy/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ locals {

module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "~> 20.8"
version = "~> 20.11"

cluster_name = local.name
cluster_version = "1.29" # Must be 1.25 or higher
cluster_version = "1.30" # Must be 1.25 or higher
cluster_endpoint_public_access = true

# Give the Terraform identity admin access to the cluster
Expand Down
4 changes: 2 additions & 2 deletions patterns/external-secrets/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ locals {

module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "~> 20.8"
version = "~> 20.11"

cluster_name = local.name
cluster_version = "1.29"
cluster_version = "1.30"
cluster_endpoint_public_access = true

# Give the Terraform identity admin access to the cluster
Expand Down
4 changes: 2 additions & 2 deletions patterns/fargate-serverless/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ locals {

module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "~> 20.8"
version = "~> 20.11"

cluster_name = local.name
cluster_version = "1.29"
cluster_version = "1.30"
cluster_endpoint_public_access = true

# Give the Terraform identity admin access to the cluster
Expand Down
4 changes: 2 additions & 2 deletions patterns/fully-private-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ locals {

module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "~> 20.8"
version = "~> 20.11"

cluster_name = local.name
cluster_version = "1.29"
cluster_version = "1.30"

# EKS Addons
cluster_addons = {
Expand Down
4 changes: 2 additions & 2 deletions patterns/ipv6-eks-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ locals {

module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "~> 20.8"
version = "~> 20.11"

cluster_name = local.name
cluster_version = "1.29"
cluster_version = "1.30"
cluster_endpoint_public_access = true

# IPV6
Expand Down
4 changes: 2 additions & 2 deletions patterns/istio/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ locals {

module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "~> 20.8"
version = "~> 20.11"

cluster_name = local.name
cluster_version = "1.29"
cluster_version = "1.30"
cluster_endpoint_public_access = true

# Give the Terraform identity admin access to the cluster
Expand Down
8 changes: 4 additions & 4 deletions patterns/karpenter-mng/eks.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "~> 20.10"
version = "~> 20.11"

cluster_name = local.name
cluster_version = "1.29"
cluster_version = "1.30"

# Give the Terraform identity admin access to the cluster
# which will allow it to deploy resources into the cluster
Expand Down Expand Up @@ -82,7 +82,7 @@ output "configure_kubectl" {

module "karpenter" {
source = "terraform-aws-modules/eks/aws//modules/karpenter"
version = "~> 20.9"
version = "~> 20.11"

cluster_name = module.eks.cluster_name

Expand All @@ -105,7 +105,7 @@ resource "helm_release" "karpenter" {
repository_username = data.aws_ecrpublic_authorization_token.token.user_name
repository_password = data.aws_ecrpublic_authorization_token.token.password
chart = "karpenter"
version = "0.36.1"
version = "0.36.2"
wait = false

values = [
Expand Down
4 changes: 2 additions & 2 deletions patterns/karpenter/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ locals {

module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "~> 20.8"
version = "~> 20.11"

cluster_name = local.name
cluster_version = "1.29"
cluster_version = "1.30"
cluster_endpoint_public_access = true

vpc_id = module.vpc.vpc_id
Expand Down
4 changes: 2 additions & 2 deletions patterns/kubecost/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ locals {

module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "~> 20.8"
version = "~> 20.11"

cluster_name = local.name
cluster_version = "1.29"
cluster_version = "1.30"
cluster_endpoint_public_access = true

# Give the Terraform identity admin access to the cluster
Expand Down
4 changes: 2 additions & 2 deletions patterns/ml-capacity-block/eks.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ variable "capacity_reservation_id" {

module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "~> 20.9"
version = "~> 20.11"

cluster_name = local.name
cluster_version = "1.29"
cluster_version = "1.30"

# Give the Terraform identity admin access to the cluster
# which will allow it to deploy resources into the cluster
Expand Down
4 changes: 2 additions & 2 deletions patterns/nvidia-gpu-efa/eks.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "~> 20.9"
version = "~> 20.11"

cluster_name = local.name
cluster_version = "1.29"
cluster_version = "1.30"

# Give the Terraform identity admin access to the cluster
# which will allow it to deploy resources into the cluster
Expand Down
4 changes: 2 additions & 2 deletions patterns/private-public-ingress/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ locals {

module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "~> 20.8"
version = "~> 20.11"

cluster_name = local.name
cluster_version = "1.29"
cluster_version = "1.30"
cluster_endpoint_public_access = true

# Give the Terraform identity admin access to the cluster
Expand Down
4 changes: 2 additions & 2 deletions patterns/privatelink-access/eks.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ provider "kubernetes" {

module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "~> 20.8"
version = "~> 20.11"

cluster_name = local.name
cluster_version = "1.29"
cluster_version = "1.30"

cluster_endpoint_public_access = false
enable_cluster_creator_admin_permissions = true
Expand Down
4 changes: 2 additions & 2 deletions patterns/sso-iam-identity-center/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ locals {

module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "~> 20.8"
version = "~> 20.11"

cluster_name = local.name
cluster_version = "1.29"
cluster_version = "1.30"
cluster_endpoint_public_access = true

# EKS Addons
Expand Down
4 changes: 2 additions & 2 deletions patterns/sso-okta/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ locals {

module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "~> 20.8"
version = "~> 20.11"

cluster_name = local.name
cluster_version = "1.29"
cluster_version = "1.30"
cluster_endpoint_public_access = true

# EKS Addons
Expand Down
109 changes: 57 additions & 52 deletions patterns/stateful/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ locals {

module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "~> 20.8"
version = "~> 20.11"

cluster_name = local.name
cluster_version = "1.29"
cluster_version = "1.30"
cluster_endpoint_public_access = true

# Give the Terraform identity admin access to the cluster
Expand Down Expand Up @@ -112,42 +112,47 @@ module "eks" {
# is dedicated to just containerd. You can read more about the practice and why
# here https://aws.github.io/aws-eks-best-practices/scalability/docs/data-plane/#use-multiple-ebs-volumes-for-containers
# and https://github.com/containerd/containerd/blob/main/docs/ops.md#base-configuration
pre_bootstrap_user_data = <<-EOT
# Wait for second volume to attach before trying to mount paths
TOKEN=$(curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600")
EC2_INSTANCE_ID=$(curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/meta-data/instance-id)
DATA_STATE="unknown"
until [ "$${DATA_STATE}" == "attached" ]; do
DATA_STATE=$(aws ec2 describe-volumes \
--region ${local.region} \
--filters \
Name=attachment.instance-id,Values=$${EC2_INSTANCE_ID} \
Name=attachment.device,Values=${local.second_volume_name} \
--query Volumes[].Attachments[].State \
--output text)
sleep 5
done

# Get the volume ID
VOLUME_ID=$(aws ec2 describe-volumes \
--region ${local.region} \
--filters \
Name=attachment.instance-id,Values=$${EC2_INSTANCE_ID} \
Name=attachment.device,Values=${local.second_volume_name} \
--query Volumes[].Attachments[].VolumeId \
--output text | sed 's/-//')

# Mount the containerd directories to the 2nd volume
SECOND_VOL=$(lsblk -o NAME,SERIAL -d |awk -v id="$${VOLUME_ID}" '$2 ~ id {print $1}')
systemctl stop containerd
mkfs -t ext4 /dev/$${SECOND_VOL}
rm -rf /var/lib/containerd/*
rm -rf /run/containerd/*

mount /dev/$${SECOND_VOL} /var/lib/containerd/
mount /dev/$${SECOND_VOL} /run/containerd/
systemctl start containerd
EOT
cloudinit_pre_nodeadm = [
{
content_type = "text/x-shellscript"
content = <<-EOT
# Wait for second volume to attach before trying to mount paths
TOKEN=$(curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600")
EC2_INSTANCE_ID=$(curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/meta-data/instance-id)
DATA_STATE="unknown"
until [ "$${DATA_STATE}" == "attached" ]; do
DATA_STATE=$(aws ec2 describe-volumes \
--region ${local.region} \
--filters \
Name=attachment.instance-id,Values=$${EC2_INSTANCE_ID} \
Name=attachment.device,Values=${local.second_volume_name} \
--query Volumes[].Attachments[].State \
--output text)
sleep 5
done

# Get the volume ID
VOLUME_ID=$(aws ec2 describe-volumes \
--region ${local.region} \
--filters \
Name=attachment.instance-id,Values=$${EC2_INSTANCE_ID} \
Name=attachment.device,Values=${local.second_volume_name} \
--query Volumes[].Attachments[].VolumeId \
--output text | sed 's/-//')

# Mount the containerd directories to the 2nd volume
SECOND_VOL=$(lsblk -o NAME,SERIAL -d |awk -v id="$${VOLUME_ID}" '$2 ~ id {print $1}')
systemctl stop containerd
mkfs -t ext4 /dev/$${SECOND_VOL}
rm -rf /var/lib/containerd/*
rm -rf /run/containerd/*

mount /dev/$${SECOND_VOL} /var/lib/containerd/
mount /dev/$${SECOND_VOL} /run/containerd/
systemctl start containerd
EOT
}
]
}

instance-store = {
Expand All @@ -172,20 +177,20 @@ module "eks" {
}
}

# NVMe instance store volumes are automatically enumerated and assigned a device
pre_bootstrap_user_data = <<-EOT
cat <<-EOF > /etc/profile.d/bootstrap.sh
#!/bin/sh

# Configure NVMe volumes in RAID0 configuration
# https://github.com/awslabs/amazon-eks-ami/blob/056e31f8c7477e893424abce468cb32bbcd1f079/files/bootstrap.sh#L35C121-L35C126
# Mount will be: /mnt/k8s-disks
export LOCAL_DISKS='raid0'
EOF

# Source extra environment variables in bootstrap script
sed -i '/^set -o errexit/a\\nsource /etc/profile.d/bootstrap.sh' /etc/eks/bootstrap.sh
EOT
cloudinit_pre_nodeadm = [
{
content_type = "application/node.eks.aws"
content = <<-EOT
---
apiVersion: node.eks.aws/v1alpha1
kind: NodeConfig
spec:
instance:
localStorage:
strategy: RAID0
EOT
}
]
}
}

Expand Down
Loading

0 comments on commit 3bfc0f0

Please sign in to comment.