-
Notifications
You must be signed in to change notification settings - Fork 880
/
utils.ts
36 lines (34 loc) · 1.13 KB
/
utils.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
// Copyright 2016-2019, Pulumi Corporation. All rights reserved.
import * as aws from "@pulumi/aws";
import * as eks from "@pulumi/eks";
import * as pulumi from "@pulumi/pulumi";
// Creates an EKS NodeGroup.
interface NodeGroupArgs {
ami: string;
instanceType: pulumi.Input<aws.ec2.InstanceType>;
desiredCapacity: pulumi.Input<number>;
cluster: eks.Cluster;
instanceProfile: aws.iam.InstanceProfile;
taints?: pulumi.Input<any>;
}
export function createNodeGroup(
name: string,
args: NodeGroupArgs,
): eks.NodeGroup {
return new eks.NodeGroup(name, {
cluster: args.cluster,
nodeSecurityGroupId: args.cluster.nodeSecurityGroupId,
clusterIngressRuleId: args.cluster.clusterIngressRuleId,
instanceType: args.instanceType,
amiId: args.ami,
nodeAssociatePublicIpAddress: false,
desiredCapacity: args.desiredCapacity,
minSize: args.desiredCapacity,
maxSize: 10,
instanceProfile: args.instanceProfile,
labels: {"amiId": args.ami},
taints: args.taints,
}, {
providers: { kubernetes: args.cluster.provider},
});
}