-
Notifications
You must be signed in to change notification settings - Fork 80
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
Managed Node Group Launch Template Improvements #1225
Closed
JustASquid
wants to merge
5
commits into
pulumi:master
from
JustASquid:feature/mng-launch-template-improvements
Closed
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b749708
Add ability to specify gpu/amiId/amiType to a managed node group, and…
JustASquid 94fd33c
Removed disk size changes
JustASquid 9c05537
Removed AmiType as it's already on the node group options
JustASquid 1723d4a
Merge branch 'pulumi:master' into feature/mng-launch-template-improve…
JustASquid e5561eb
#1225 - Integration tests and source generation updated
JustASquid File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1544,6 +1544,43 @@ export type ManagedNodeGroupOptions = Omit< | |
* - maxSize: 2 | ||
*/ | ||
scalingConfig?: pulumi.Input<awsInputs.eks.NodeGroupScalingConfig>; | ||
|
||
/** | ||
* The AMI type for the instance. | ||
* | ||
* If you are passing an amiId that is `arm64` type, then we need to ensure | ||
* that this value is set as `amazon-linux-2-arm64`. | ||
* | ||
* Note: `amiType` and `gpu` are mutually exclusive. | ||
*/ | ||
amiType?: pulumi.Input<string>; | ||
|
||
/** | ||
* The AMI ID to use for the worker nodes. | ||
* | ||
* Defaults to the latest recommended EKS Optimized Linux AMI from the | ||
* AWS Systems Manager Parameter Store. | ||
* | ||
* Note: `amiId` and `gpu` are mutually exclusive. | ||
* | ||
* See for more details: | ||
* - https://docs.aws.amazon.com/eks/latest/userguide/eks-optimized-ami.html. | ||
*/ | ||
amiId?: pulumi.Input<string>; | ||
JustASquid marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/** | ||
* Use the latest recommended EKS Optimized Linux AMI with GPU support for | ||
* the worker nodes from the AWS Systems Manager Parameter Store. | ||
* | ||
* Defaults to false. | ||
* | ||
* Note: `gpu` and `amiId` are mutually exclusive. | ||
* | ||
* See for more details: | ||
* - https://docs.aws.amazon.com/eks/latest/userguide/eks-optimized-ami.html. | ||
* - https://docs.aws.amazon.com/eks/latest/userguide/retrieve-ami-id.html | ||
*/ | ||
gpu?: pulumi.Input<boolean>; | ||
}; | ||
|
||
/** | ||
|
@@ -1668,6 +1705,14 @@ function createManagedNodeGroupInternal( | |
); | ||
} | ||
|
||
if (args.amiId && args.gpu) { | ||
throw new pulumi.ResourceError("amiId and gpu are mutually exclusive.", parent); | ||
} | ||
|
||
if (args.amiType && args.gpu) { | ||
throw new pulumi.ResourceError("amiType and gpu are mutually exclusive.", parent); | ||
} | ||
|
||
let roleArn: pulumi.Input<string>; | ||
if (args.nodeRoleArn) { | ||
roleArn = args.nodeRoleArn; | ||
|
@@ -1740,8 +1785,11 @@ function createManagedNodeGroupInternal( | |
} | ||
|
||
let launchTemplate: aws.ec2.LaunchTemplate | undefined; | ||
if (args.kubeletExtraArgs || args.bootstrapExtraArgs || args.enableIMDSv2) { | ||
if (args.kubeletExtraArgs || args.bootstrapExtraArgs || args.enableIMDSv2 || args.gpu || args.amiId || args.amiType) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need to create a custom launch template if Aside from that, the list here gets a bit long now. What do you think about creating a method for deciding whether to create a custom launch template? |
||
launchTemplate = createMNGCustomLaunchTemplate(name, args, core, parent, provider); | ||
|
||
// Disk size is specified in the launch template. | ||
delete nodeGroupArgs.diskSize; | ||
JustASquid marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
// Make the aws-auth configmap a dependency of the node group. | ||
|
@@ -1836,9 +1884,20 @@ Content-Type: text/x-shellscript; charset="us-ascii" | |
? { httpTokens: "required", httpPutResponseHopLimit: 2, httpEndpoint: "enabled" } | ||
: undefined; | ||
|
||
const blockDeviceMappings = [ | ||
{ | ||
deviceName: "/dev/xvda", | ||
ebs: { | ||
volumeSize: args.diskSize, | ||
volumeType: "gp2" | ||
}, | ||
}, | ||
]; | ||
|
||
return new aws.ec2.LaunchTemplate( | ||
`${name}-launchTemplate`, | ||
{ | ||
blockDeviceMappings, | ||
userData, | ||
metadataOptions, | ||
// We need to always supply an imageId, otherwise AWS will attempt to merge the user data which will result in | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
These looks like something copied over from NodeGroupBaseOptions, I wonder if we could factor this out in TypeScript somehow.
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.
I had a look, this inherits directly from the AWS config so I figured we shouldn't mess with it too much.