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

fix(eks): nodegroupName incorrectly assigned #25278

Closed
wants to merge 4 commits into from
Closed

Conversation

bhaskerv
Copy link

This PR fixes the EKS nodegroupName attribute that was incorrectly being assigned.
Old: cluster-name/nodegroup-name
New: nodegroup-name

Fixes: #22442


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

@gitpod-io
Copy link

gitpod-io bot commented Apr 25, 2023

@github-actions github-actions bot added the p2 label Apr 25, 2023
@aws-cdk-automation aws-cdk-automation requested a review from a team April 25, 2023 05:55
@github-actions github-actions bot added the beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK label Apr 25, 2023
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@bhaskerv bhaskerv changed the title fix(aws-eks): nodegroupName incorrectly assigned fix(eks): nodegroupName incorrectly assigned Apr 25, 2023
@aws-cdk-automation aws-cdk-automation dismissed their stale review April 27, 2023 02:54

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@corymhall corymhall added the @aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service label May 8, 2023
@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label May 8, 2023
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@@ -476,7 +476,7 @@ export class Nodegroup extends Resource implements INodegroup {
resource: 'nodegroup',
resourceName: this.physicalName,
});
this.nodegroupName = this.getResourceNameAttribute(resource.ref);
this.nodegroupName = resource.getAtt('NodegroupName').toString();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
this.nodegroupName = resource.getAtt('NodegroupName').toString();
this.nodegroupName = this.getResourceNameAttribute(resource.attrNodegroupName);

Can we do this instead?

@corymhall corymhall removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label May 24, 2023
@aws-cdk-automation
Copy link
Collaborator

This PR has been in the CHANGES REQUESTED state for 3 weeks, and looks abandoned. To keep this PR from being closed, please continue work on it. If not, it will automatically be closed in a week.

@aws-cdk-automation
Copy link
Collaborator

This PR has been deemed to be abandoned, and will be automatically closed. Please create a new PR for these changes if you think this decision has been made in error.

@aws-cdk-automation aws-cdk-automation added the closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. label Jun 22, 2023
mergify bot pushed a commit that referenced this pull request Apr 19, 2024
### Issue # (if applicable)

As #22910 and #25278 were closed for staleness. I am opening a new PR to fix #22442.

To avoid breaking change, this PR introduces a new feature flag for the bug fix.

Closes #22442

### The Code for verification

```ts
import {
  App, Stack,
  aws_eks as eks,
  aws_ec2 as ec2,
  CfnOutput, cx_api,
} from 'aws-cdk-lib';

const app = new App();
const env = { region: process.env.CDK_DEFAULT_REGION, account: process.env.CDK_DEFAULT_ACCOUNT };
const stack = new Stack(app, 'my-test-stack2', { env });

stack.node.setContext(cx_api.EKS_NODEGROUP_NAME, true);

const vpc = ec2.Vpc.fromLookup(stack, 'Vpc', { isDefault: true });

const cluster = new eks.Cluster(stack, 'Cluster', {
  vpc,
  version: eks.KubernetesVersion.V1_29,
  defaultCapacity: 0,
});

const ng1 = new eks.Nodegroup(stack, 'ng-1', {
  cluster,
});

const ng2 = cluster.addNodegroupCapacity('ng-2', {
  nodegroupName: 'custom-name',
});

new CfnOutput(stack, 'ng1-name', { value: ng1.nodegroupName });
new CfnOutput(stack, 'ng2-name', { value: ng2.nodegroupName });
```

The output is like

```
Outputs:
my-test-stack2.ng1name = ng19F1EA947-sSziNMzPVkik
my-test-stack2.ng2name = custom-name
```

Console:

<img width="315" alt="image" src="https://github.com/aws/aws-cdk/assets/278432/019255bd-7d05-43ad-8624-baf5b6eea725">



### 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
@aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws-eks: Nodegroup.nodegroupName is not the nodegroup's name
3 participants