Skip to content

Commit 634168f

Browse files
author
Luke Hoban
committedSep 11, 2018
Initial commit
Adds EKS app.
0 parents  commit 634168f

File tree

5 files changed

+87
-0
lines changed

5 files changed

+87
-0
lines changed
 

‎.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
Pulumi.*.yaml
3+
yarn.lock

‎README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Pulumi Applications
2+
3+
This repository includes cloud applications and infrastructure which can be installed using [Pulumi](https://pulumi.io).
4+
5+
For any application in this repository, it can be installed via:
6+
7+
```bash
8+
# To install the application directly into your cloud provider
9+
$ pulumi up https://github.com/pulumi/apps/eks
10+
11+
# To get a copy of the application locally which can be deployed and updated
12+
$ pulumi new https://github.com/pulumi/apps/eks
13+
```

‎eks/Pulumi.yaml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Amazon EKS
2+
description: An Amazon EKS cluster
3+
runtime: nodejs
4+
template:
5+
description: An Amazon EKS cluster
6+
config:
7+
aws:region:
8+
description: The AWS region to deploy into
9+
default: "us-east-2"
10+
instanceType:
11+
description: The instance type to use for the cluster's nodes.
12+
default: "t2.medium"
13+
desiredCapacity:
14+
description: The number of worker nodes that should be running in the cluster.
15+
default: "2"
16+
minSize:
17+
description: The minimum number of worker nodes running in the cluster.
18+
default: "1"
19+
maxSize:
20+
description: The maximum number of worker nodes running in the cluster.
21+
default: "2"
22+
storageClass:
23+
description: Create a storage class for the given volume type and make it the cluster's default StorageClass.
24+
default: "gp2"
25+
deployDashboard:
26+
description: Whether or not to deploy the Kubernetes dashboard to the cluster.
27+
default: "true"

‎eks/index.ts

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import * as aws from "@pulumi/aws";
2+
import * as awsinfra from "@pulumi/aws-infra";
3+
import * as pulumi from "@pulumi/pulumi";
4+
import * as eks from "@pulumi/eks";
5+
6+
// Get configuration for the stack
7+
const config = new pulumi.Config();
8+
const instanceType = config.get("instanceType") as aws.ec2.InstanceType;
9+
const desiredCapacity = config.getNumber("desiredCapacity");
10+
const minSize = config.getNumber("minSize");
11+
const maxSize = config.getNumber("maxSize");
12+
const storageClass = config.get("storageClass") as eks.EBSVolumeType;
13+
const deployDashboard = config.getBoolean("deployDashboard");
14+
15+
// Create a VPC for our cluster.
16+
const network = new awsinfra.Network("eksNetwork");
17+
18+
// Create an EKS cluster with the given configuration.
19+
const cluster = new eks.Cluster("cluster", {
20+
vpcId: network.vpcId,
21+
subnetIds: network.subnetIds,
22+
instanceType: instanceType,
23+
desiredCapacity: desiredCapacity,
24+
minSize: minSize,
25+
maxSize: maxSize,
26+
storageClasses: storageClass,
27+
deployDashboard: deployDashboard,
28+
});
29+
30+
// Export the cluster's kubeconfig.
31+
export const kubeconfig = cluster.kubeconfig;

‎eks/package.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "eks-cluster",
3+
"devDependencies": {
4+
"typescript": "^2.7.2",
5+
"@types/node": "latest"
6+
},
7+
"dependencies": {
8+
"@pulumi/pulumi": "^0.15.0",
9+
"@pulumi/aws": "^0.15.0",
10+
"@pulumi/aws-infra": "^0.15.0",
11+
"@pulumi/eks": "dev"
12+
}
13+
}

0 commit comments

Comments
 (0)
Please sign in to comment.