Skip to content

Commit

Permalink
feat: Update to 1.29 (aws-samples#817)
Browse files Browse the repository at this point in the history
* Updates to EKS 1.29.0 and eksctl to 0.169.0
Added scripts to automate updates

* Added alias k and bash completion for it
  • Loading branch information
ROunofF authored Feb 4, 2024
1 parent 47081e9 commit a9079eb
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 36 deletions.
44 changes: 19 additions & 25 deletions cluster/eksctl/cluster.yaml
Original file line number Diff line number Diff line change
@@ -1,44 +1,38 @@
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig

availabilityZones:
- ${AWS_REGION}a
- ${AWS_REGION}b
- ${AWS_REGION}c

- ${AWS_REGION}a
- ${AWS_REGION}b
- ${AWS_REGION}c
metadata:
name: ${EKS_CLUSTER_NAME}
region: ${AWS_REGION}
version: '1.27'
version: '1.29'
tags:
karpenter.sh/discovery: ${EKS_CLUSTER_NAME}
created-by: eks-workshop-v2
env: ${EKS_CLUSTER_NAME}

iam:
withOIDC: true

vpc:
cidr: 10.42.0.0/16
clusterEndpoints:
privateAccess: true
publicAccess: true

addons:
- name: vpc-cni
version: 1.14.1
configurationValues: "{\"env\":{\"ENABLE_PREFIX_DELEGATION\":\"true\", \"ENABLE_POD_ENI\":\"true\", \"POD_SECURITY_GROUP_ENFORCING_MODE\":\"standard\"},\"enableNetworkPolicy\": \"true\"}"
resolveConflicts: overwrite

- name: vpc-cni
version: 1.14.1
configurationValues: "{\"env\":{\"ENABLE_PREFIX_DELEGATION\":\"true\", \"ENABLE_POD_ENI\":\"true\", \"POD_SECURITY_GROUP_ENFORCING_MODE\":\"standard\"},\"enableNetworkPolicy\": \"true\"}"
resolveConflicts: overwrite
managedNodeGroups:
- name: default
desiredCapacity: 3
minSize: 3
maxSize: 6
instanceType: m5.large
privateNetworking: true
releaseVersion: 1.27.3-20230816
updateConfig:
maxUnavailablePercentage: 50
labels:
workshop-default: 'yes'
- name: default
desiredCapacity: 3
minSize: 3
maxSize: 6
instanceType: m5.large
privateNetworking: true
releaseVersion: "1.29.0-20240129"
updateConfig:
maxUnavailablePercentage: 50
labels:
workshop-default: 'yes'
4 changes: 2 additions & 2 deletions cluster/terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ variable "cluster_name" {
variable "cluster_version" {
description = "EKS cluster version."
type = string
default = "1.27"
default = "1.29"
}

variable "ami_release_version" {
description = "Default EKS AMI release version for node groups"
type = string
default = "1.27.3-20230816"
default = "1.29.0-20240129"
}

variable "vpc_cidr" {
Expand Down
2 changes: 1 addition & 1 deletion docs/eks_version_upgrades.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ There are various places that reference the Kubernetes versions (Kubernetes, kub
1. IDE installer: `lab/scripts/installer.sh`
1. eksctl: `cluster/eksctl/cluster.yaml`
1. Terraform: `cluster/terraform/variables.tf`
1. Common kubectl: `/hack/lib/kubectl-version.sh`
1. Common kubectl: `hack/lib/kubectl-version.sh`
2 changes: 1 addition & 1 deletion hack/lib/kubectl-version.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export KUBECTL_VERSION='v1.27.7'
export KUBECTL_VERSION='v1.29.0'
41 changes: 41 additions & 0 deletions hack/upgrade-k8s.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/sh -x

if [ -z "$1" ] || [ -z "$2" ]; then
echo "We need a k8s version and eksctl version to update to, e.g. ./$0 1.29.0 0.169.0"
exit 1
fi

K8SLong=$1
K8S="${K8SLong%.*}"
EKSCTL=$2

ARCH=amd64
PLATFORM=$(uname -s)_$ARCH

#AMI=`aws ec2 describe-images --owners amazon --filters "Name=name,Values=amazon-eks-node-$K8S*" --query "Images[1].[Name,Description]" --output text`
AMI_API=`aws ec2 describe-images --owners amazon --filters "Name=name,Values=amazon-eks-node-$K8S*" --query "Images[1].[Name]" --output text`

AMI=$( echo ${AMI_API} | sed "s/amazon-eks-node-.*-v\(.*\)/$K8SLong-\\1/")


sed -i "s/KUBERNETES_VERSION: '.*'/KUBERNETES_VERSION: '$K8S'/" website/docusaurus.config.js
sed -i "s/KUBERNETES_NODE_VERSION: '.*'/KUBERNETES_NODE_VERSION: '$K8S-eks-tbdl'/" website/docusaurus.config.js #Find the right version

sed -i "s/kubectl_version='.*'/kubectl_version='$K8SLong'/" lab/scripts/installer.sh
kubectl_checksum=`curl -L "https://dl.k8s.io/release/v$K8SLong/bin/linux/amd64/kubectl.sha256"`
sed -i "s/kubectl_checksum='.*'/kubectl_checksum='$kubectl_checksum'/" lab/scripts/installer.sh

sed -i "s/eksctl_version='.*'/eksctl_version='$EKSCTL'/" lab/scripts/installer.sh
EKSCTL_CHECKSUM=`curl -sL "https://github.com/eksctl-io/eksctl/releases/download/v$EKSCTL/eksctl_checksums.txt" | grep $PLATFORM | cut -f1 -d" "`
sed -i "s/eksctl_checksum='.*'/eksctl_checksum='$EKSCTL_CHECKSUM'/" lab/scripts/installer.sh

#sed -i "s/version: '.*'/version: '$K8S'/" cluster/eksctl/cluster.yaml
yq -i ".metadata.version = \"$K8S\"" cluster/eksctl/cluster.yaml
yq -i ".managedNodeGroups[0].releaseVersion = \"$AMI\"" cluster/eksctl/cluster.yaml

# Using line numbers in Terraform to target only the right resources
sed -i "9s/default.*= \".*\"/default = \"$K8S\"/" cluster/terraform/variables.tf
sed -i "15s/default.*= \".*\"/default = \"$AMI\"/" cluster/terraform/variables.tf


sed -i "s/KUBECTL_VERSION='.*'/KUBECTL_VERSION='v$K8SLong'/" hack/lib/kubectl-version.sh
8 changes: 4 additions & 4 deletions lab/scripts/installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

set -e

kubectl_version='1.27.7'
kubectl_checksum='e5fe510ba6f421958358d3d43b3f0b04c2957d4bc3bb24cf541719af61a06d79'
kubectl_version='1.29.0'
kubectl_checksum='0e03ab096163f61ab610b33f37f55709d3af8e16e4dcc1eb682882ef80f96fd5'

helm_version='3.10.1'
helm_checksum='c12d2cd638f2d066fec123d0bd7f010f32c643afdf288d39a4610b1f9cb32af3'

eksctl_version='0.164.0'
eksctl_checksum='2ed5de811dd26a3ed041ca3e6f26717288dc02dfe87ac752ae549ed69576d03e'
eksctl_version='0.169.0'
eksctl_checksum='0491ed2ddbeeb73c226ca2b1f99fc1b401dc638f17343d955a4b9797c2e540d9'

kubeseal_version='0.18.4'
kubeseal_checksum='2e765b87889bfcf06a6249cde8e28507e3b7be29851e4fac651853f7638f12f3'
Expand Down
4 changes: 3 additions & 1 deletion lab/scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,6 @@ echo "export RESOURCES_PRECREATED='${RESOURCES_PRECREATED}'" > ~/.bashrc.d/infra

echo "export ANALYTICS_ENDPOINT='${ANALYTICS_ENDPOINT}'" > ~/.bashrc.d/analytics.bash

/usr/local/bin/kubectl completion bash >> ~/.bashrc.d/kubectl_completion.bash
/usr/local/bin/kubectl completion bash >> ~/.bashrc.d/kubectl_completion.bash
echo "alias k=kubectl" >> ~/.bashrc.d/kubectl_completion.bash
echo "complete -F __start_kubectl k" >> ~/.bashrc.d/kubectl_completion.bash
4 changes: 2 additions & 2 deletions website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ const config = {
MANIFESTS_REF: manifestsRef,
MANIFESTS_OWNER: manifestsOwner,
MANIFESTS_REPOSITORY: manifestsRepository,
KUBERNETES_VERSION: '1.27',
KUBERNETES_NODE_VERSION: '1.27.3-eks-48e63af'
KUBERNETES_VERSION: '1.29',
KUBERNETES_NODE_VERSION: '1.29-eks-tbdl'
}
}],
[remarkIncludeCode, { manifestsDir }],
Expand Down

0 comments on commit a9079eb

Please sign in to comment.