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

Use cluster name to choose AMI type for EKS MNG launch template #1050

Merged
merged 1 commit into from
Jan 20, 2023

Conversation

Aneurysm9
Copy link
Member

Signed-off-by: Anthony J Mirabella a9@aneurysm9.com

Description: Because we're specifying a launch template for the EKS managed nodegroups we're creating we need to tell it which AMI to use and that AMI needs to match the architecture for the instance type selected. Because all of our clusters include the architecture in the name I have chosen to extract that information from there rather than add a new field to the configuration.

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

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
@Aneurysm9 Aneurysm9 requested a review from a team as a code owner January 19, 2023 23:52
@@ -57,7 +56,8 @@ export function deployClusters(
name: ec2Cluster.name,
vpc: vpc,
version: versionKubernetes,
instance_type: ec2Cluster.instance_type,
instanceTypes: [new InstanceType(ec2Cluster.instance_type.toLowerCase())],
amiType: ec2Cluster.name.match('\-arm64\-') ? NodegroupAmiType.AL2_ARM_64 : NodegroupAmiType.AL2_X86_64,
Copy link
Member

Choose a reason for hiding this comment

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

nit: We could pass the AMI type from the test_cluster.yaml file as well, so that we don't need to rely on the name.

https://github.com/aws/aws-cdk/blob/v1.189.0/packages/@aws-cdk/aws-eks/lib/managed-nodegroup.ts#L24

Copy link
Member Author

Choose a reason for hiding this comment

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

We could, but we already had the convention of including the architecture in the cluster name and matching on that is likely to be less error-prone than correctly copying the magic AMI type string. This also ensures that we only use one of these two AMI types.

@Aneurysm9 Aneurysm9 merged commit 9b03479 into aws-observability:terraform Jan 20, 2023
@Aneurysm9 Aneurysm9 deleted the fix/eksNodeTypes branch January 20, 2023 00:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants