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 diff --git a/lib/private-cluster-construct/index.ts b/lib/private-cluster-construct/index.ts new file mode 100644 index 0000000..36d6d76 --- /dev/null +++ b/lib/private-cluster-construct/index.ts @@ -0,0 +1,41 @@ +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' + } + }); + } +} \ No newline at end of file