-
Notifications
You must be signed in to change notification settings - Fork 1
/
n8n-eks-cluster.ts
67 lines (62 loc) · 1.99 KB
/
n8n-eks-cluster.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
#!/usr/bin/env node
import 'source-map-support/register'
import { App, aws_ec2, aws_eks } from 'aws-cdk-lib'
import {
addons,
AckServiceName,
MngClusterProvider,
CreateCertificateProvider,
EksBlueprint,
LookupHostedZoneProvider,
} from '@aws-quickstart/eks-blueprints'
import assert = require('assert')
const domainName = process.env.DOMAIN_NAME ?? 'aws.8n8.io'
const region = process.env.AWS_REGION ?? 'eu-central-1'
assert(domainName, 'DOMAIN_NAME env variable not set')
EksBlueprint.builder()
.version(aws_eks.KubernetesVersion.V1_28)
.region(region)
.resourceProvider('hostedZone', new LookupHostedZoneProvider(domainName))
.resourceProvider('rootCert', new CreateCertificateProvider('rootCert', domainName, 'hostedZone'))
.resourceProvider('wildcardCert', new CreateCertificateProvider('wildcardCert', `*.${domainName}`, 'hostedZone'))
.clusterProvider(new MngClusterProvider({
id: 'n8n-eks-nodes',
minSize: 8,
maxSize: 10,
desiredSize: 8,
instanceTypes: [new aws_ec2.InstanceType('m5.large')],
}))
.addOns(
new addons.VpcCniAddOn(),
new addons.CoreDnsAddOn(),
new addons.ExternalDnsAddOn({
hostedZoneResources: ['hostedZone']
}),
new addons.EbsCsiDriverAddOn(),
new addons.AwsLoadBalancerControllerAddOn(),
new addons.NginxAddOn({
externalDnsHostname: domainName,
certificateResourceName: 'wildcardCert',
}),
new addons.MetricsServerAddOn(),
new addons.KubeProxyAddOn(),
new addons.AckAddOn({
id: "rds-ack",
serviceName: AckServiceName.RDS,
saName: "rds-chart",
name: "rds-chart",
chart: "rds-chart",
release: "rds-chart",
version: "1.1.8",
repository: "oci://public.ecr.aws/aws-controllers-k8s/rds-chart",
managedPolicyName: "AmazonRDSFullAccess",
createNamespace: true,
}),
// new addons.ClusterAutoScalerAddOn(),
)
.useDefaultSecretEncryption(true)
.build(new App(), 'n8n-eks-cluster')
/**
* TODO:
* - setup CNAME for `*.domainName`
*/