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

aws-eks: Nodegroup.nodegroupName is not the nodegroup's name #22442

Closed
plumdog opened this issue Oct 10, 2022 · 3 comments · Fixed by #29794
Closed

aws-eks: Nodegroup.nodegroupName is not the nodegroup's name #22442

plumdog opened this issue Oct 10, 2022 · 3 comments · Fixed by #29794
Assignees
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

@plumdog
Copy link
Contributor

plumdog commented Oct 10, 2022

Describe the bug

The result of myNodegroup.nodegroupName is something like mycluster/mynodegroup. This is not the nodegroup's name.

Eg, if I try to pass this to an SDK call to describe the nodegroup, I get:

$ aws eks describe-nodegroup --cluster-name mycluster --nodegroup-name mycluster/mynodegroup

An error occurred (InvalidParameterException) when calling the DescribeNodegroup operation: The nodegroup name parameter contains invalid characters. It should begin with letter or digit and can have any of the following characters: the set of Unicode letters, digits, hyphens and underscores.

Expected Behavior

myNodegroup.nodegroupName to give the name of the nodegroup.

Current Behavior

myNodegroup.nodegroupName is the "physical resource ID", see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-eks-nodegroup.html#aws-resource-eks-nodegroup-return-values, because it uses .ref not attrNodegroupName. See eg https://github.com/aws/aws-cdk/blob/v2.33.0/packages/@aws-cdk/aws-eks/lib/managed-nodegroup.ts#L455

Reproduction Steps

Roughly, something like:

const vpc = new ec2.Vpc(this, 'Vpc');
const cluster = new eks.Cluster(this, 'Cluster', {
    clusterName: 'mycluster',
});
const nodegroup = cluster.addNodegroup(...);
new CfnOutput(this, 'NodegroupName', {
    value: nodegroup.nodegroupName,
});

Then call aws eks describe-nodegroup --cluster-name mycluster --nodegroup-name [value from output] and see that it errors.

Possible Solution

Change .nodegroupName to be .attrNodegroupName.

Maybe add .nodegroupPhysicalResourceId as .ref?

Additional Information/Context

This would be a breaking change.

CDK CLI Version

2.33.0

Framework Version

No response

Node.js Version

16

OS

Linux

Language

Typescript

Language Version

No response

Other information

No response

@plumdog plumdog added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Oct 10, 2022
@github-actions github-actions bot added the @aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service label Oct 10, 2022
@pahud pahud added the investigating This issue is being investigated and/or work is in progress to resolve the issue. label Nov 14, 2022
@pahud
Copy link
Contributor

pahud commented Nov 14, 2022

Hi @plumdog

Yes you are right. This seems to be a bug. I am assigning this to myself as p2 and the PR will be underway shortly.

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

@pahud pahud assigned pahud and unassigned otaviomacedo Nov 14, 2022
@pahud pahud added p2 effort/small Small work item – less than a day of effort and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. needs-triage This issue or PR still needs to be triaged. labels Nov 14, 2022
@mergify mergify bot closed this as completed in #29794 Apr 19, 2024
@mergify mergify bot closed this as completed in 8bb8c55 Apr 19, 2024
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.

1 similar comment
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.

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
3 participants