aws / aws/aws-cdk

EKS: Automatically Generated Cluster Name Can Exceed 100 Characters

Open
#30,632 1 comment 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-eks bug effort/small p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

The automatic naming of a cluster is impacted by the path of the resource. In some circumstances this can cause the cluster name to exceed 100 characters, which exceeds the limit for EKS, https://docs.aws.amazon.com/eks/latest/userguide/create-cluster.html and results in an error from the `onEventHandler` function: `InvalidParameterException: The parameter name should not be greater than 100 characters.`

### Expected Behavior

I would expect the construct to trim the name down to 100 characters or fail to synth and provide a meaningful error.

### Current Behavior

A name of more than 100 characters can be produced through the automatic name generation.

### Reproduction Steps

Have a sufficiently nested EKS cluster without a cluster name specified. For example, this is what was produced: `multi-az-workshop-EKSNestedStackEKSNestedStackResourceAE427C53-1UH8V2OQX83GX-EKSCluster7638EADC-132IJXPSLXM72`

Given a parent stack name of "multi-az-workshop", a nested stack in that parent of "EKSNestedStack", and naming the EKS cluster resource "EKSCluster".

### Possible Solution

While certainly possible to name the cluster yourself, would hope there to be some safety checking before actually trying to create the cluster leading to failure.

### Additional Information/Context

_No response_

### CDK CLI Version

2.147.0

### Framework Version

_No response_

### Node.js Version

v20.9.0

### OS

darwin

### Language

.NET

### Language Version

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Reproduce the nested EKS cluster case without an explicit cluster name and trace the automatic naming path to the onEventHandler failure. Check the AWS EKS 100-character limit and determine whether synthesis should trim the name or report a meaningful error; done means the reproduction no longer reaches the invalid-name failure and the chosen behavior is covered by an appropriate test.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.