-
Notifications
You must be signed in to change notification settings - Fork 79
/
index.ts
93 lines (82 loc) · 2.53 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import * as pulumi from "@pulumi/pulumi";
import * as awsx from "@pulumi/awsx";
import * as eks from "@pulumi/eks";
const projectName = pulumi.getProject();
// Create an EKS cluster with a non-default configuration.
const vpc = new awsx.ec2.Vpc(`${projectName}-2`, {
tags: { Name: `${projectName}-2` },
});
////////////////////////////
/// EKS Clusters ///
////////////////////////////
// Create an EKS cluster with the default configuration.
const cluster1 = new eks.Cluster(`${projectName}-1`, {
nodeAmiId: "ami-0384725f0d30527c7",
});
const cluster2 = new eks.Cluster(`${projectName}-2`, {
vpcId: vpc.vpcId,
publicSubnetIds: vpc.publicSubnetIds,
desiredCapacity: 2,
minSize: 2,
maxSize: 2,
nodeAmiId: "ami-0384725f0d30527c7",
deployDashboard: false,
enabledClusterLogTypes: [
"api",
"audit",
"authenticator",
],
vpcCniOptions: {
disableTcpEarlyDemux: true,
},
});
const cluster3 = new eks.Cluster(`${projectName}-3`, {
vpcId: vpc.vpcId,
publicSubnetIds: vpc.publicSubnetIds,
nodeGroupOptions: {
amiId: "ami-0384725f0d30527c7",
desiredCapacity: 1,
minSize: 1,
maxSize: 1,
instanceType: pulumi.output(Promise.resolve("t3.small")),
enableDetailedMonitoring: false,
}
})
// cluster4 is a graviton cluster to test the ARM64 architecture
// can be successfully provisioned.
const cluster4 = new eks.Cluster(`${projectName}-4`, {
vpcId: vpc.vpcId,
publicSubnetIds: vpc.publicSubnetIds,
nodeAmiId: "ami-0350263ff18287b83",
instanceType: "t4g.small",
})
//////////////////////////
/// EKS Addons ///
//////////////////////////
// Test that we can create a coredns addon within cluster3.
const coredns = new eks.Addon("coredns", {
cluster: cluster3,
addonName: "coredns",
addonVersion: "v1.11.1-eksbuild.9",
resolveConflictsOnUpdate: "PRESERVE",
configurationValues: {
replicaCount: 4,
resources: {
limits: {
cpu: "100m",
memory: "150Mi",
},
requests: {
cpu: "100m",
memory: "150Mi",
},
},
},
});
// Export the clusters' kubeconfig.
export const kubeconfig1: pulumi.Output<any> = cluster1.kubeconfig;
export const kubeconfig2: pulumi.Output<any> = cluster2.kubeconfig;
export const kubeconfig3: pulumi.Output<any> = cluster3.kubeconfig;
export const kubeconfig4: pulumi.Output<any> = cluster4.kubeconfig;
// export the IAM Role ARN of the cluster
export const iamRoleArn: pulumi.Output<string> = cluster1.core.clusterIamRole.arn;