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

Add support for Launch Templates, custom AMI and more features for Managed Nodegroups #2544

Merged
merged 35 commits into from
Aug 17, 2020

Conversation

cPu1
Copy link
Collaborator

@cPu1 cPu1 commented Aug 14, 2020

Description

Adds launch template support for managed nodegroups. Also adds support for the following features for managed nodegroups:

  • Custom AMI (ami)
  • instancePrefix and instanceName to configure the EC2 instance name for a nodegroup
  • securityGroups.attachIDs to add custom security groups
  • ebsOptimized, volumeType, volumeName, volumeEncrypted, volumeKmsKeyID and volumeIOPS
  • maxPodsPerNode
  • preBootstrapCommands and overrideBootstrapCommand
  • disableIMDSv1

To use the launch templates features, specify an existing launch template:

apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
  name: cluster
  region: us-west-2
managedNodeGroups:
- name: launch-template-ng
  launchTemplate:
    id: lt-<id>
    version: "1" # (optional) defaults to the default launch template version

TODO:

  • Add documentation

Closes #2551

Checklist

  • Added tests that cover your change (if possible)
  • Added/modified documentation as required (such as the README.md, or the userdocs directory)
  • Manually tested
  • Added labels for change area (e.g. area/nodegroup), target version (e.g. version/0.12.0) and kind (e.g. kind/improvement)
  • Make sure the title of the PR is a good description that can go into the release notes

@cPu1 cPu1 added kind/feature New feature or request area/managed-nodegroup EKS Managed Nodegroups labels Aug 14, 2020
@cPu1 cPu1 force-pushed the launch-template-managed-nodegroups branch from b12e84b to f8f49f0 Compare August 14, 2020 14:02
Some tests are breaking in ginkgo v1.14.0
@cPu1 cPu1 force-pushed the launch-template-managed-nodegroups branch from 45d5ca3 to ca07ffe Compare August 14, 2020 14:54
Expect(err).ToNot(HaveOccurred())
Expect(template).ToNot(BeNil())

actual, err := json.Marshal(template.Resources)
Copy link
Contributor

Choose a reason for hiding this comment

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

Am I reading this correctly that the tests unmarshal and marshal and then compare the json? Why not match on the structs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's right. The unmarshalling (goformation.ParseJSON(bytes)) and marshalling is actually testing goformation's ability to preserve isomorphism, to ensure no types or values are lost or are interpreted differently.

Why not match on the structs?

Matching on the structs will require more code than matching on the expected JSON output. This is also close to an end-to-end test.

Copy link
Contributor

Choose a reason for hiding this comment

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

makes sense!

err := stack.AddAllResources()
assert.Nil(err)
require.Nil(err)
Copy link
Contributor

Choose a reason for hiding this comment

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

😯 What's the difference?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The methods in require stop the test (calling FailNow) when an assertion fails.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah ok so probably it should always be require 👍

@michaelbeaumont
Copy link
Contributor

Can we also add some integration tests?

@cPu1 cPu1 force-pushed the launch-template-managed-nodegroups branch from 3efe52e to e0b6773 Compare August 17, 2020 12:58
@cPu1
Copy link
Collaborator Author

cPu1 commented Aug 17, 2020

Can we also add some integration tests?

I was planning to but couldn't get to it. I'll address it in a separate PR. WDYT?

@cPu1 cPu1 force-pushed the launch-template-managed-nodegroups branch from c92d99c to 006fd3b Compare August 17, 2020 13:15
@cPu1 cPu1 force-pushed the launch-template-managed-nodegroups branch from 006fd3b to e23dba1 Compare August 17, 2020 13:20
@cPu1 cPu1 changed the title Add support for Launch Templates and more features for Managed Nodegroups Add support for Launch Templates, custom AMI and more features for Managed Nodegroups Aug 17, 2020
@cPu1 cPu1 merged commit 9e3fba0 into eksctl-io:release-0.26 Aug 17, 2020
@kkl-acies
Copy link

Did this PR remove the network interface from the created launch template? If yes why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/managed-nodegroup EKS Managed Nodegroups kind/feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants