From 6a2747cf7ae88e7ba3c17c23b1af420104c476cb Mon Sep 17 00:00:00 2001 From: Pahud Hsieh Date: Fri, 1 Mar 2024 12:29:52 -0500 Subject: [PATCH] chore(eks): support Amazon Linux 2023 (#29335) ### Issue # (if applicable) Closes https://github.com/aws/aws-cdk/issues/29334 ### Reason for this change To support Amazon Linux 2023 nodegroup. ### Description of changes Allow the AmiType to select Amazon Linux 2023 for both x86_64 and ARM_64. ### Description of how you validated changes ```ts const mastersRole = new iam.Role(this, 'AdminRole', { assumedBy: new iam.AccountRootPrincipal(), }); const vpc = ec2.Vpc.fromLookup(this, 'Vpc', { isDefault: true }); const cluster = new eks.Cluster(this, 'Cluster', { vpc, mastersRole, kubectlLayer: new KubectlV29Layer(this, 'KubectlLayer'), version: eks.KubernetesVersion.V1_29, defaultCapacity: 0, }); cluster.addNodegroupCapacity('NG-X86', { amiType: eks.NodegroupAmiType.AL2023_X86_64_STANDARD, desiredSize: 1, }); cluster.addNodegroupCapacity('NG-ARM', { amiType: eks.NodegroupAmiType.AL2023_ARM_64_STANDARD, desiredSize: 1, }); ``` ```sh $ /tmp/kubectl get no NAME STATUS ROLES AGE VERSION ip-172-31-1-222.ec2.internal Ready 4m53s v1.29.0-eks-5e0fdde ip-172-31-2-242.ec2.internal Ready 4m46s v1.29.0-eks-5e0fdde ``` ``` $ /tmp/kubectl get nodes ip-172-31-1-222.ec2.internal -o jsonpath="{ .status.nodeInfo}" | jq -r . { "architecture": "amd64", "bootID": "f65b39c5-f1c6-4b75-8f62-8424c29302ca", "containerRuntimeVersion": "containerd://1.7.11", "kernelVersion": "6.1.77-99.164.amzn2023.x86_64", "kubeProxyVersion": "v1.29.0-eks-5e0fdde", "kubeletVersion": "v1.29.0-eks-5e0fdde", "machineID": "ec23037a57eb6be59d03137fbe1c2625", "operatingSystem": "linux", "osImage": "Amazon Linux 2023", "systemUUID": "ec23037a-57eb-6be5-9d03-137fbe1c2625" } $ /tmp/kubectl get nodes ip-172-31-2-242.ec2.internal -o jsonpath="{ .status.nodeInfo}" | jq -r . { "architecture": "arm64", "bootID": "a2d15e6f-c48c-474b-aad5-510712c41153", "containerRuntimeVersion": "containerd://1.7.11", "kernelVersion": "6.1.77-99.164.amzn2023.aarch64", "kubeProxyVersion": "v1.29.0-eks-5e0fdde", "kubeletVersion": "v1.29.0-eks-5e0fdde", "machineID": "ec2b26d85fe443884398704c3b82887b", "operatingSystem": "linux", "osImage": "Amazon Linux 2023", "systemUUID": "ec2b26d8-5fe4-4388-4398-704c3b82887b" } ``` ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/aws-cdk-lib/aws-eks/lib/managed-nodegroup.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/aws-cdk-lib/aws-eks/lib/managed-nodegroup.ts b/packages/aws-cdk-lib/aws-eks/lib/managed-nodegroup.ts index 9aee08d143e68..4e3d4c7751d8a 100644 --- a/packages/aws-cdk-lib/aws-eks/lib/managed-nodegroup.ts +++ b/packages/aws-cdk-lib/aws-eks/lib/managed-nodegroup.ts @@ -70,6 +70,14 @@ export enum NodegroupAmiType { * Windows Full 2022 (x86-64) */ WINDOWS_FULL_2022_X86_64 = 'WINDOWS_FULL_2022_x86_64', + /** + * Amazon Linux 2023 (x86-64) + */ + AL2023_X86_64_STANDARD = 'AL2023_x86_64_STANDARD', + /** + * Amazon Linux 2023 (ARM-64) + */ + AL2023_ARM_64_STANDARD = 'AL2023_ARM_64_STANDARD', } /**