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

Managed Node Group Launch Template Improvements #1225

Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion nodejs/eks/nodegroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1544,6 +1544,33 @@ export type ManagedNodeGroupOptions = Omit<
* - maxSize: 2
*/
scalingConfig?: pulumi.Input<awsInputs.eks.NodeGroupScalingConfig>;

/**
* 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>;
};

/**
Expand Down Expand Up @@ -1668,6 +1695,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;
Expand Down Expand Up @@ -1740,7 +1775,7 @@ 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) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to create a custom launch template if amiType is set? That's a valid input for aws.eks.NodeGroup on its own.

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);
}

Expand Down
Loading