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

EKS: Automatically Generated Cluster Name Can Exceed 100 Characters #30632

Open
hakenmt opened this issue Jun 23, 2024 · 1 comment
Open

EKS: Automatically Generated Cluster Name Can Exceed 100 Characters #30632

hakenmt opened this issue Jun 23, 2024 · 1 comment
Labels
@aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service bug This issue is a bug. effort/small Small work item – less than a day of effort p2

Comments

@hakenmt
Copy link

hakenmt commented Jun 23, 2024

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

@hakenmt hakenmt added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jun 23, 2024
@github-actions github-actions bot added the @aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service label Jun 23, 2024
@ashishdhingra ashishdhingra self-assigned this Jun 24, 2024
@ashishdhingra ashishdhingra added investigating This issue is being investigated and/or work is in progress to resolve the issue. and removed needs-triage This issue or PR still needs to be triaged. labels Jun 24, 2024
@pahud
Copy link
Contributor

pahud commented Jun 24, 2024

Yes we probably should fix here

this.clusterName = this.getResourceNameAttribute(resource.ref);

with Names.uniqueResourceName with maxLength: 128

Feel free to submit a PR. Thank you.

@pahud pahud added p2 effort/small Small work item – less than a day of effort labels Jun 24, 2024
@ashishdhingra ashishdhingra removed the investigating This issue is being investigated and/or work is in progress to resolve the issue. label Jun 24, 2024
@ashishdhingra ashishdhingra removed their assignment Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service bug This issue is a bug. effort/small Small work item – less than a day of effort p2
Projects
None yet
Development

No branches or pull requests

3 participants