Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(eks): support Amazon Linux 2023 #29335

Merged
merged 2 commits into from
Mar 1, 2024
Merged

chore(eks): support Amazon Linux 2023 #29335

merged 2 commits into from
Mar 1, 2024

Conversation

pahud
Copy link
Contributor

@pahud pahud commented Mar 1, 2024

Issue # (if applicable)

Closes #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

    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,
    });
$ /tmp/kubectl get no
NAME                           STATUS   ROLES    AGE     VERSION
ip-172-31-1-222.ec2.internal   Ready    <none>   4m53s   v1.29.0-eks-5e0fdde
ip-172-31-2-242.ec2.internal   Ready    <none>   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


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added feature-request A feature should be added or improved. p2 labels Mar 1, 2024
@aws-cdk-automation aws-cdk-automation requested a review from a team March 1, 2024 15:28
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Mar 1, 2024
@pahud pahud marked this pull request as ready for review March 1, 2024 17:13
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 6e4752b
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Copy link
Contributor

mergify bot commented Mar 1, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 6a2747c into aws:main Mar 1, 2024
14 checks passed
mergify bot pushed a commit that referenced this pull request Mar 26, 2024
…r AL2023 AMIs (#29505)

### Issue # (if applicable)

Closes #29546

### Reason for this change

After #29335, `@aws-eks` should receive AL2023 support, despites the [GPU types are not yet supported](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-eks-nodegroup.html#cfn-eks-nodegroup-amitype) it should at least allow user to customize instance type. However, missing support for `NodegroupAmiType[]` causing validation error emit, so that user can only create [default instance types](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-eks-nodegroup.html#cfn-eks-nodegroup-instancetypes) ( `t3.medium` or `t4g.medium` ).

```
$ cat ./lib/cluster.ts
...
    cluster.addNodegroupCapacity("mng-al2023", {
      amiType: eks.NodegroupAmiType.AL2023_X86_64_STANDARD,
      instanceTypes: [new ec2.InstanceType("t3.medium")],
      ...
    });
...
```

```
$ npx cdk version
2.133.0 (build dcc1e75)
```

```
$  npx cdk synth

...
                                                                                                                                                                                ^
Error: The specified AMI does not match the instance types architecture, either specify one of AL2_X86_64, BOTTLEROCKET_X86_64, WINDOWS_CORE_2019_X86_64, WINDOWS_CORE_2022_X86_64, WINDOWS_FULL_2019_X86_64, WINDOWS_FULL_2022_X86_64 or don't specify any
    at new Nodegroup (.../node_modules/aws-cdk-lib/aws-eks/lib/managed-nodegroup.js:1:3921)
    at Cluster.addNodegroupCapacity (.../node_modules/aws-cdk-lib/aws-eks/lib/cluster.js:1:19807)
    at EksCluster.createManagedNodeGroups (.../lib/cluster.ts:85:13)
    at new EksCluster (.../lib/cluster.ts:30:10)
    at Object.<anonymous> (.../bin/eks-basic.ts:10:1)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.m._compile (.../node_modules/ts-node/src/index.ts:1618:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.require.extensions.<computed> [as .ts] (.../node_modules/ts-node/src/index.ts:1621:12)
    at Module.load (node:internal/modules/cjs/loader:1207:32)

Subprocess exited with error 1
```

### Description of changes

Add `eks.NodegroupAmiType.AL2023_X86_64_STANDARD` and `eks.NodegroupAmiType.AL2023_ARM_64_STANDARD` support for node group module.

### Description of how you validated changes

```
$ npx jest aws-eks/test/cluster.test.ts
 PASS  aws-eks/test/cluster.test.ts (37.298 s)
...

=============================== Coverage summary ===============================
Statements   : 48.86% ( 10077/20621 )
Branches     : 27.88% ( 2388/8565 )
Functions    : 33.03% ( 1509/4568 )
Lines        : 49.71% ( 9905/19923 )
================================================================================
Jest: "global" coverage threshold for statements (55%) not met: 48.86%
Jest: "global" coverage threshold for branches (35%) not met: 27.88%
Test Suites: 1 passed, 1 total
Tests:       119 passed, 119 total
Snapshots:   0 total
Time:        41.064 s
```

```
$ npx jest aws-eks/test/nodegroup.test.ts
 RUNS  aws-eks/test/nodegroup.test.ts
...
=============================== Coverage summary ===============================
Statements   : 43.94% ( 9062/20621 )
Branches     : 22.08% ( 1892/8565 )
Functions    : 27.16% ( 1241/4568 )
Lines        : 44.8% ( 8927/19923 )
================================================================================
Jest: "global" coverage threshold for statements (55%) not met: 43.94%
Jest: "global" coverage threshold for branches (35%) not met: 22.08%
Test Suites: 1 passed, 1 total
Tests:       59 passed, 59 total
Snapshots:   0 total
Time:        23.334 s
```

### 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*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS. feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

eks: Amazon Linux 2023 support
3 participants