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(aws-eks): Add L2 Construct for Amazon EKS clusters and worker nodes #991

Closed
wants to merge 67 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
c5d4676
create initial dependencies for EKS Construct
Oct 18, 2018
0c049d8
Create eks construct
Oct 18, 2018
c4c85c6
create example and dependencies for EKS Construct
Oct 18, 2018
c126a38
update documentation & remove redundant checks for mandatory properties
Oct 18, 2018
942877e
optimize creation and reference to securityGroup
Oct 18, 2018
26ddaa5
cleanup redundant fields and implement IConnectable
Oct 18, 2018
1aade1a
add new AMI mappings based on testing and running of sample code
Oct 19, 2018
9fa4cef
Add instance data to use in node group creation
Oct 19, 2018
bfe3569
work on example file, not currently working
Oct 19, 2018
f0bba75
add instance data export
Oct 19, 2018
86dc5f6
Make an attempt at creating the worker nodes
Oct 19, 2018
6475ffd
Merge branch 'master' into ipyandy/aws-eks
Oct 19, 2018
9c2dbb2
resolve conflict from edited files
Oct 19, 2018
d1b6c44
change case to PascalCase for enum
Oct 19, 2018
8f44986
initia implmentation of IConnectable and ISecurityGroupRule
Oct 19, 2018
1ded6ce
update examples to show multiple worker node autoscaling groups
Oct 20, 2018
401b689
update documentation to instance data
Oct 20, 2018
34969a1
properly tag worker nodes and update documentation
Oct 20, 2018
8e7d651
set defaults in Nodes so all INodeProps are optional
Oct 20, 2018
1252310
Updated documentation and remove update Type for now
Oct 20, 2018
c62b704
Make various code changes and optimizations
Oct 21, 2018
c173ab5
Add documentation to eks example and using new properties for Nodes
Oct 21, 2018
8360f75
push new nodeGroups into array for tracking
Oct 21, 2018
087c8ee
continue documenting code and cleanup of some properties
Oct 21, 2018
99af1d2
continue code commenting for documentation
Oct 21, 2018
1435470
change k8sversion string to more generic version
Oct 21, 2018
60abab7
remove unnecessary ISecurityGroupRule methods instead just IConnectable
Oct 21, 2018
0ea4322
include README file
Oct 21, 2018
7d233da
merge from original repo
Oct 21, 2018
047a35f
fix simple problem with jsdoc formatting
Oct 22, 2018
a345efa
Implement eks tests
Oct 22, 2018
05fc921
implement integ test
Oct 22, 2018
9df96d5
add integ test expected output file
Oct 22, 2018
9016535
add roadmap details to readme
Oct 22, 2018
bd3db55
fix markdown syntax
Oct 22, 2018
c445ffe
Add package to dev dependencies
Oct 22, 2018
2f00418
Add pythons virtual env directory to ignore
Oct 23, 2018
d88cc2e
update the dependencies
Oct 23, 2018
0b94ceb
group properties closer to match intent
Oct 23, 2018
593780f
comment property name in preparation for new generated code
Oct 23, 2018
021fa3c
Delete integration tests for now, failing due to "default" acount error
Oct 23, 2018
732975b
Merge branch 'awslabs-master'
Oct 23, 2018
4f3a873
Merge branch 'master' of github.com:IPyandy/aws-cdk
Oct 23, 2018
856359f
update generated property name, was broken with recent master changes
Oct 23, 2018
2079abf
Merge branch 'master' into ipyandy/aws-eks
Oct 23, 2018
4f5b074
bootstrap dev enviroment
Oct 23, 2018
e4404e3
fix dev dependency version issue
Oct 23, 2018
76c547d
Merge branch 'ipyandy/aws-eks' of github.com:IPyandy/aws-cdk into ipy…
Oct 23, 2018
eebaf95
damn this dependeny error
Oct 23, 2018
d823381
Merge branch 'master' into ipyandy/aws-eks
Oct 23, 2018
bde4025
Merge branch 'master' of github.com:IPyandy/aws-cdk into ipyandy/aws-eks
Oct 23, 2018
468c016
fix max pod values as they were truncated by mistake for some instances
Oct 23, 2018
3b684a8
Merge branch 'ipyandy/aws-eks' of github.com:IPyandy/aws-cdk into ipy…
Oct 23, 2018
4a194d1
Merge branch 'awslabs-master'
Oct 23, 2018
360236b
Fix where not enough security group rules were created
Oct 24, 2018
1f5bcf4
use AllConnections for interal traffic, from the same securityGroup.
Oct 24, 2018
7066ed1
re-wrote tests based on new connection rules and methods
Oct 24, 2018
ee4999e
Merge branch 'awslabs-master'
Oct 26, 2018
1329d87
Merge branch 'awslabs-master'
Oct 26, 2018
56bbadd
Merge tag 'v0.14.1' into ipyandy/aws-eks
Oct 27, 2018
777692f
add eks dependency since it's not part of main distribution yet
Oct 27, 2018
cca308d
integrate changes from v0.14.0 and re-do tests to make sure they pass
Oct 27, 2018
b4645b2
merge update to max pods per node
Oct 29, 2018
e27aa0e
Merge branch 'awslabs-master'
Oct 30, 2018
38abbe1
Merge branch 'master' of https://github.com/awslabs/aws-cdk
Nov 6, 2018
9c4313d
Merge branch 'master' into ipyandy/aws-eks
Nov 7, 2018
b2f9e12
fix for v0.15.0 IConnectable array changes
Nov 7, 2018
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
15 changes: 15 additions & 0 deletions examples/cdk-examples-typescript/eks-cluster/cdk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

The context in this file should not be committed.

I know, it's a pain.

Copy link
Author

Choose a reason for hiding this comment

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

crap, yea will fix.

"app": "node index",
"context": {
"availability-zones:413174413047:us-east-1": [
"us-east-1a",
"us-east-1b",
"us-east-1c",
"us-east-1d",
"us-east-1e",
"us-east-1f"
],
"ssm:413174413047:us-east-1:/aws/service/ami-amazon-linux-latest/amzn-ami-hvm-x86_64-gp2": "ami-0ff8a91507f77f867",
"ssm:413174413047:us-east-1:/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2": "ami-0922553b7b0369273"
}
}
99 changes: 99 additions & 0 deletions examples/cdk-examples-typescript/eks-cluster/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import ec2 = require("@aws-cdk/aws-ec2");
import eks = require("@aws-cdk/aws-eks");
import cdk = require("@aws-cdk/cdk");

const ENV = "dev";
const app = new cdk.App();

/**
* Ths stack creates the VPC and network for the cluster
*
* @default single public subnet per availability zone (3)
* This creates three (3) total subnets with an Internet Gateway
* The subnets could be private with a Nat Gateway
* they must not be isolated, as instances later need to
* have outbound internet access to contact the API Server
*/
const networkStack = new cdk.Stack(app, "Network");

const vpc = new ec2.VpcNetwork(networkStack, "VPC", {
cidr: "10.244.0.0/16",
maxAZs: 3,
natGateways: 0,
subnetConfiguration: [
{
name: "pub",
cidrMask: 24,
subnetType: ec2.SubnetType.Public
}
],
tags: {
env: `${ENV}`
}
});
const vpcExport = vpc.export();

/**
* This stack creates the EKS Cluster with the imported VPC
* above, and puts the cluster inside the chosen placement
*
* clusterName can be set (not recommended), let cfn generate
* version can be specified, only 1.10 supported now
* will become useful when more versions are supported
*
* It also creates a group of 3 worker nodes with default types
* and given min, max and sshKeys
*/
const clusterStack = new cdk.Stack(app, "Cluster");

const clusterVpc = ec2.VpcNetworkRef.import(
clusterStack,
"ClusterVpc",
vpcExport
);
const cluster = new eks.Cluster(clusterStack, "Cluster", {
vpc: clusterVpc,
vpcPlacement: {
subnetsToUse: ec2.SubnetType.Public
}
});

/**
* This is optional and should be more specific to given
* corparate CIDRS for access from the outside, maybe
* even a bastion host inside AWS.
*/
cluster.connections.allowFromAnyIPv4(new ec2.TcpPort(443));

const grp1 = new eks.Nodes(clusterStack, "NodeGroup1", {
vpc: clusterVpc,
cluster,
minNodes: 3,
maxNodes: 6,
sshKeyName: "aws-dev-key"
});
grp1.nodeGroup.connections.allowFromAnyIPv4(new ec2.TcpPort(22));

/**
* This adds a second group of worker nodes of different
* InstanceClass and InstanceSize
* This gets pushed into an Array of Nodes
*/
const grp2 = new eks.Nodes(clusterStack, "NodeGroup2", {
vpc: clusterVpc,
cluster,
nodeClass: ec2.InstanceClass.T2,
nodeSize: ec2.InstanceSize.Medium,
nodeType: eks.NodeType.Normal,
minNodes: 2,
maxNodes: 4,
sshKeyName: "aws-dev-key"
});
/**
* This is optional and should be more specific to given
* corparate CIDRS for access from the outside, maybe
* even a bastion host inside AWS.
*/
grp2.nodeGroup.connections.allowFromAnyIPv4(new ec2.TcpPort(22));

app.run();
3 changes: 2 additions & 1 deletion examples/cdk-examples-typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@aws-cdk/aws-dynamodb": "^0.15.0",
"@aws-cdk/aws-ec2": "^0.15.0",
"@aws-cdk/aws-ecs": "^0.15.0",
"@aws-cdk/aws-eks": "^0.15.0",
"@aws-cdk/aws-elasticloadbalancing": "^0.15.0",
"@aws-cdk/aws-elasticloadbalancingv2": "^0.15.0",
"@aws-cdk/aws-iam": "^0.15.0",
Expand All @@ -50,4 +51,4 @@
"cdk"
],
"homepage": "https://github.com/awslabs/aws-cdk"
}
}
6 changes: 3 additions & 3 deletions packages/@aws-cdk/assert/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions packages/@aws-cdk/aws-cloudformation/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions packages/@aws-cdk/aws-cloudfront/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions packages/@aws-cdk/aws-cloudtrail/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions packages/@aws-cdk/aws-codebuild/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions packages/@aws-cdk/aws-codecommit/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading