From ae6ce873c671ed37f56dc02bd13e5e27fa2b1650 Mon Sep 17 00:00:00 2001 From: Apoorva Kulkarni Date: Thu, 24 Jun 2021 11:20:42 -0700 Subject: [PATCH 1/3] add private cluster pattern --- lib/private-cluster-construct/index.ts | 43 ++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 lib/private-cluster-construct/index.ts diff --git a/lib/private-cluster-construct/index.ts b/lib/private-cluster-construct/index.ts new file mode 100644 index 0000000..0828371 --- /dev/null +++ b/lib/private-cluster-construct/index.ts @@ -0,0 +1,43 @@ +import * as cdk from '@aws-cdk/core'; +import * as eks from '@aws-cdk/aws-eks'; +// SSP Lib +import * as ssp from '@shapirov/cdk-eks-blueprint' + +// Team implementations +import * as team from '../teams' + +export default class PrivateClusterConstruct extends cdk.Construct { + constructor(scope: cdk.Construct, id: string) { + super(scope, id); + + // Setup platform team + const accountID = process.env.CDK_DEFAULT_ACCOUNT! + const platformTeam = new team.TeamPlatform(accountID) + const teams: Array = [platformTeam]; + + // AddOns for the cluster. + const addOns: Array = [ + new ssp.NginxAddOn, + new ssp.ArgoCDAddOn, + new ssp.CalicoAddOn, + new ssp.MetricsServerAddOn, + new ssp.ContainerInsightsAddOn, + new ssp.SSMAgentAddOn() + ]; + + const clusterProps: ssp.EC2ProviderClusterProps = { + version: eks.KubernetesVersion.V1_19, + privateCluster: true, + } + + const stackID = `${id}-blueprint` + const clusterProvider = new ssp.EC2ClusterProvider(clusterProps); + new ssp.EksBlueprint(scope, { id: stackID, teams, addOns, clusterProvider }, { + env: { + region: 'us-west-1' + } + }); + } +} + + From 7e8e904a4e27fe666bb25037fc9c9a0303cb4840 Mon Sep 17 00:00:00 2001 From: Apoorva Kulkarni Date: Thu, 24 Jun 2021 11:23:59 -0700 Subject: [PATCH 2/3] update usage example --- bin/main.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/main.ts b/bin/main.ts index a17dea6..afb6042 100644 --- a/bin/main.ts +++ b/bin/main.ts @@ -53,5 +53,9 @@ new BottleRocketConstruct(app, 'bottlerocket'); import CustomClusterConstruct from '../lib/custom-cluster-construct' new CustomClusterConstruct(app, 'custom-cluster'); +//------------------------------------------- +// Private cluster. +//------------------------------------------- - +import PrivateClusterConstruct from '../lib/private-cluster-construct' +new PrivateClusterConstruct(app, 'private-cluster'); \ No newline at end of file From 833d1182ef08a87f16b47f30c128357906421fcd Mon Sep 17 00:00:00 2001 From: Apoorva Kulkarni Date: Thu, 24 Jun 2021 11:24:49 -0700 Subject: [PATCH 3/3] remove trailing new lines --- lib/private-cluster-construct/index.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/private-cluster-construct/index.ts b/lib/private-cluster-construct/index.ts index 0828371..36d6d76 100644 --- a/lib/private-cluster-construct/index.ts +++ b/lib/private-cluster-construct/index.ts @@ -38,6 +38,4 @@ export default class PrivateClusterConstruct extends cdk.Construct { } }); } -} - - +} \ No newline at end of file