-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
feat(eks): support CUSTOM amiType #30660
Conversation
There was a problem hiding this 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.
b8792a2
to
578ac1c
Compare
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks 👍 Left some comments for minor adjustments
@@ -426,7 +430,7 @@ export class Nodegroup extends Resource implements INodegroup { | |||
* 1. instance types of different CPU architectures are not mixed(e.g. X86 with ARM). | |||
* 2. user-specified amiType should be included in `possibleAmiTypes`. | |||
*/ | |||
possibleAmiTypes = getPossibleAmiTypes(instanceTypes); | |||
possibleAmiTypes = getPossibleAmiTypes(instanceTypes).concat(NodegroupAmiType.CUSTOM); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please concatenate inside the method for reusability?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved :)
@@ -442,6 +446,11 @@ export class Nodegroup extends Resource implements INodegroup { | |||
} | |||
} | |||
|
|||
// custom AMI type can be used only when there's a launch template that picks an AMI | |||
if (props.amiType === NodegroupAmiType.CUSTOM && !props.launchTemplateSpec) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a little bit of clarification in both places.
@@ -227,6 +227,27 @@ cluster.addNodegroupCapacity('custom-node-group', { | |||
}); | |||
``` | |||
|
|||
To use a custom AMI for the node group, you can set `amiType` to `eks.NodegroupAmiType.CUSTOM` and provide a launch template. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To use a custom AMI for the node group, you can set `amiType` to `eks.NodegroupAmiType.CUSTOM` and provide a launch template. | |
To use a custom AMI for the node group, you can set `amiType` to `CUSTOM`. | |
A launch template must be provided. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change applied
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for making the changes. Left some comments and questions.
@@ -651,5 +662,5 @@ function getPossibleAmiTypes(instanceTypes: InstanceType[]): NodegroupAmiType[] | |||
throw new Error('instanceTypes of different architectures is not allowed'); | |||
} | |||
|
|||
return archAmiMap.get(Array.from(architectures)[0])!; | |||
return archAmiMap.get(Array.from(architectures)[0])!.concat(NodegroupAmiType.CUSTOM); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of concat here, should we just add it directly to the x8664AmiTypes, arm64AmiTypes, etc. Otherwise this line of code would be easily missed and maintainers and other contributors may not realize those amiTypes are not accurate and complete.
* The AMI type for your node group. If you explicitly specify the launchTemplate with custom AMI, either set this property to `CUSTOM` or leave | ||
* it undefined, otherwise the node group deployment will fail. In other cases, you will need to specify correct amiType for the nodegroup. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just so for my own understanding, CUSTOM
ami type is supported now if we leave it unset?
To use a custom AMI for the node group, you can set `amiType` to `CUSTOM`. | ||
A launch template must be provided. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related to the comment above, if custom AMI is supported now leaving the amiType
property unset, we should call that out in the README too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
marking it as requested changes based on previous feedback provided by @GavinZZ
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. |
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. |
Comments on closed issues and PRs are hard for our team to see. |
Issue # (if applicable)
Closes #30641.
Reason for this change
Node groups with custom AMI are supported by CloudFormation, but not by CDK. This adds that support.
Description of changes
CUSTOM
to theNodegroupAmiType
enumCUSTOM
topossibleAmiTypes
when validatinginstanceTypes
CPU architecture againstamiType
launchTemplateSpec
is defined when usingCUSTOM
Description of how you validated changes
Added unit tests checking valid deployment as well as failure when
CUSTOM
is used, butlaunchTemplateSpec
isn't defined.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license