Skip to content
New issue

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

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

Already on GitHub? # to your account

eks: Amazon Linux 2023 is not fully supported in nodegroup #29546

Closed
arlampin opened this issue Mar 20, 2024 · 3 comments · Fixed by #29505
Closed

eks: Amazon Linux 2023 is not fully supported in nodegroup #29546

arlampin opened this issue Mar 20, 2024 · 3 comments · Fixed by #29505
Assignees
Labels
@aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service bug This issue is a bug. effort/medium Medium work item – several days of effort p1

Comments

@arlampin
Copy link

Describe the bug

#29335 added support for Amazon Linux 2023 NodegroupAmiType, but it only added the enum values. They are not listed as valid types in managed-nodegroup.ts arm64AmiTypes or x8664AmiTypes, thus they can't be used alongside instanceTypes nodegroup parameter.

Expected Behavior

Defining both amiType: AL2023_X86_64_STANDARD / AL2023_ARM_64_STANDARD and instanceTypes should work.

Current Behavior

Using both instanceTypes and AL2023 amiType results in following error:

Error: The specified AMI does not match the instance types architecture, either specify one of AL2_ARM_64, BOTTLEROCKET_ARM_64 or don't specify any

Reproduction Steps

cluster.addNodegroupCapacity('Arm64', {
  instanceTypes: [
    ec2.InstanceType.of(ec2.InstanceClass.T4G, ec2.InstanceSize.XLARGE), 
  ],
  amiType: NodegroupAmiType.AL2023_ARM_64_STANDARD
});

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.133.0 (build dcc1e75)

Framework Version

No response

Node.js Version

v18.18.2

OS

macos

Language

TypeScript

Language Version

No response

Other information

No response

@arlampin arlampin added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Mar 20, 2024
@github-actions github-actions bot added the @aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service label Mar 20, 2024
@pahud
Copy link
Contributor

pahud commented Mar 20, 2024

Yes we should add a PR for that.

@pahud pahud added feature-request A feature should be added or improved. p1 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. feature-request A feature should be added or improved. labels Mar 20, 2024
@pahud pahud self-assigned this Mar 20, 2024
@pahud
Copy link
Contributor

pahud commented Mar 20, 2024

I will submit a PR for this.

@mergify mergify bot closed this as completed in #29505 Mar 26, 2024
mergify bot pushed a commit that referenced this issue 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*
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
@aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service bug This issue is a bug. effort/medium Medium work item – several days of effort p1
Projects
None yet
2 participants