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

feat(eks): managed nodegroup support #6759

Merged
merged 36 commits into from
Mar 25, 2020
Merged

feat(eks): managed nodegroup support #6759

merged 36 commits into from
Mar 25, 2020

Conversation

pahud
Copy link
Contributor

@pahud pahud commented Mar 17, 2020

Description

  • implement the Nodegroup resource from AWS::EKS::Nodegroup
  • support cluster.addNodegroup(id, {...}) which creates a default nodegroup for the cluster
  • integ test
  • unit tests
  • 100% test coverage
  • update README

Commit Message

feat(aws-eks): managed nodegroup support (#6759 )

BREAKING CHANGE: Cluster now creates a default managed nodegroup as its default capacity. Set the new cluster property defaultCapacityType to DefaultCapacityType.EC2 to preserve EC2 as its default capacity.

Closes #5086

End Commit Message


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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 1686081
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

- minor fix
@pahud
Copy link
Contributor Author

pahud commented Mar 17, 2020

copy @eladb

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: d28b856
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 0fd3398
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

packages/@aws-cdk/aws-eks/lib/cluster.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-eks/lib/managed-nodegroup.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-eks/lib/managed-nodegroup.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-eks/lib/managed-nodegroup.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-eks/lib/managed-nodegroup.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-eks/lib/managed-nodegroup.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-eks/lib/managed-nodegroup.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-eks/lib/managed-nodegroup.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-eks/lib/managed-nodegroup.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-eks/lib/managed-nodegroup.ts Outdated Show resolved Hide resolved
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 17a34ac
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 7662429
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 3075be0
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 7662429
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 055a918
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 055a918
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 29d5907
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: c5e77b6
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: f060878
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: f52094d
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 433ce36
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@pahud pahud requested a review from eladb March 23, 2020 05:49
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: a3ba7ca
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Copy link
Contributor

@eladb eladb left a comment

Choose a reason for hiding this comment

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

I believe we should add a BREAKING CHANGE notice in the commit message.

@pahud
Copy link
Contributor Author

pahud commented Mar 25, 2020

I believe we should add a BREAKING CHANGE notice in the commit message.

OK. In the commit message now.

@pahud pahud requested a review from eladb March 25, 2020 00:52
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: c267cb1
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

packages/@aws-cdk/aws-eks/README.md Outdated Show resolved Hide resolved
@@ -312,7 +320,7 @@ export class Cluster extends Resource implements ICluster {
* The auto scaling group that hosts the default capacity for this cluster.
* This will be `undefined` if the default capacity is set to 0.
*/
public readonly defaultCapacity?: autoscaling.AutoScalingGroup;
public readonly defaultCapacity?: Nodegroup | autoscaling.AutoScalingGroup;
Copy link
Contributor

Choose a reason for hiding this comment

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

Sadly this won’t work with jsii languages like Java so we don’t use unions.

Let’s just use defaultNodegroup for the nodegroup version.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure! Let me fix it.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 5c6a74b
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@pahud
Copy link
Contributor Author

pahud commented Mar 25, 2020

@eladb

Now we have both defaultCapacity and defaultNodegroup. Please review again.

@pahud pahud requested a review from eladb March 25, 2020 10:42
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: e13286d
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Copy link
Contributor

@eladb eladb left a comment

Choose a reason for hiding this comment

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

😍

@mergify
Copy link
Contributor

mergify bot commented Mar 25, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@pahud
Copy link
Contributor Author

pahud commented Mar 25, 2020

😍

I am crying ! Have learned a lot from it. Thanks!!

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 9f7df9a
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented Mar 25, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 74169bf into aws:master Mar 25, 2020
@pahud
Copy link
Contributor Author

pahud commented Apr 3, 2020

Hi @eladb

I just noticed this blog post from EKS team:

Upcoming Changes to IP Assignment for EKS Managed Node Groups
https://aws.amazon.com/tw/blogs/containers/upcoming-changes-to-ip-assignment-for-eks-managed-node-groups/

Today, an EKS managed node group automatically assigns public IP addresses to all nodes that it launches. When a public IP address is assigned using the AssociatePublicIpAddress flag on an EC2 instance or launch template, it overrides the settings in the subnet. This means that if your VPC is configured with the public + private subnet or private only subnet architectures, public IPs are still assigned to the nodes that are instantiated in the private subnets.

I am afraid users would be confused as we deploy the Nodegroup by default in the private subnets while they still see public IP addresses being assigned.

subnets: this.cluster.vpc.selectSubnets(props.subnets).subnetIds,

However, this behavior, according to the blog post, will be changed starting April 20, 2020. And CDK doesn't have to do anything for it. By that time, all clusters created by CDK will by default have a managed nodegroup in private subnet and no public IP addresses will be automatically assigned.

Do we need to note this somewhere?

@farshadniayeshpour
Copy link

farshadniayeshpour commented Apr 3, 2020

Hi @eladb I am trying to add a managed nodegroup to my cluster but I cannot find the eks.NodeGroup anywhere on the API documentation. Can you help me with how to create a managed node group with CDK in Python?

https://github.com/aws/aws-cdk/tree/master/packages/%40aws-cdk/aws-eks

@farshadniayeshpour
Copy link

Also, do I need to create an AutoScalingGroup to make sure I have a manged node group?

@farshadniayeshpour
Copy link

@pahud can you help me figure out how to enable managed node groups in eks?

@pahud
Copy link
Contributor Author

pahud commented Apr 4, 2020

@FarshadNiayesh

I think we can't use it in Python until CDK 1.32.0 released(should be in the next few days). According to the document, we will have a new addNodeGroup() method to create managed nodegroups with cluster. I believe in python we can do something like this

# create a cluster with default managed nodegroup
cluster = aws_eks.Cluster()
# add an extra manaded nodegroup
cluster.add_nodegroup()

@farshadniayeshpour
Copy link

Thank you for your answer. @pahud I had another question. When I try to install helm charts in specific namespaces, I always get an error from the Cloudformation console when the stack is in "Create in progress" mode. Seems like the helm chart cannot create the specified namespace.

Do you know how I can pre-create namespaces with eks.cluster() and then pass them to the eks.chart()?

@pahud
Copy link
Contributor Author

pahud commented Apr 5, 2020

Thank you for your answer. @pahud I had another question. When I try to install helm charts in specific namespaces, I always get an error from the Cloudformation console when the stack is in "Create in progress" mode. Seems like the helm chart cannot create the specified namespace.

Do you know how I can pre-create namespaces with eks.cluster() and then pass them to the eks.chart()?

If you create Helm Charts with addChart() method, you may specify namespace.

see the python reference here
https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_eks/Cluster.html#aws_cdk.aws_eks.Cluster.add_chart

Given this thread is for managed nodegroup, let's discuss Helm Chart on gitter(awslabs/aws-cdk) or create another issue if necessary.

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.

[aws-eks] Managed NodeGroups
4 participants