Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Commit

Permalink
chore: add inital dev cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
twelvemo committed Mar 16, 2023
0 parents commit 675ff07
Show file tree
Hide file tree
Showing 6 changed files with 1,321 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
errors
cdk.out
cdk.context.json
4 changes: 4 additions & 0 deletions cdk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"app": "npx ts-node main.ts",
"context": {}
}
62 changes: 62 additions & 0 deletions cluster.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import * as blueprints from '@aws-quickstart/eks-blueprints';
import { GlobalResources, utils, ImportHostedZoneProvider} from '@aws-quickstart/eks-blueprints';
import { Construct } from 'constructs';
//import * as team from '../teams';

const burnhamManifestDir = './lib/teams/team-burnham/'
const rikerManifestDir = './lib/teams/team-riker/'
//const teamManifestDirList = [burnhamManifestDir, rikerManifestDir]

const accountID = process.env.CDK_DEFAULT_ACCOUNT!;
const gitUrl = 'https://github.com/aws-samples/eks-blueprints-workloads.git';


/**
* See docs/patterns/nginx.md for mode details on the setup.
*/
export default class DevCluster {

async buildAsync(scope: Construct, id: string) {
/*
const teams: Array<blueprints.Team> = [
new team.TeamPlatform(accountID),
new team.TeamTroiSetup,
new team.TeamRikerSetup(scope, teamManifestDirList[1]),
new team.TeamBurnhamSetup(scope, teamManifestDirList[0])
];
*/

const subdomain: string = utils.valueFromContext(scope, "dev.marketplace", "sys.garden");

blueprints.HelmAddOn.validateHelmVersions = false;

await blueprints.EksBlueprint.builder()
.account("049586690729")
.region("eu-central-1")
//.teams(...teams)
.resourceProvider(GlobalResources.HostedZone ,new ImportHostedZoneProvider('Z028702323WOQ31QJAJJP', subdomain))
.resourceProvider(GlobalResources.Certificate, new blueprints.CreateCertificateProvider('wildcard-cert', `*.${subdomain}`, "dev.marketplace.sys.garden"))
.addOns(
new blueprints.VpcCniAddOn(),
new blueprints.CoreDnsAddOn(),
new blueprints.CertManagerAddOn,
new blueprints.AwsLoadBalancerControllerAddOn,
new blueprints.ExternalDnsAddOn({
hostedZoneResources: [blueprints.GlobalResources.HostedZone] // you can add more if you register resource providers
}),
new blueprints.NginxAddOn({
internetFacing: true,
backendProtocol: "tcp",
externalDnsHostname: subdomain,
crossZoneEnabled: false,
certificateResourceName: GlobalResources.Certificate
}),
new blueprints.SecretsStoreAddOn({ rotationPollInterval: "120s" }),
new blueprints.ClusterAutoScalerAddOn)
.buildAsync(scope, `${id}-blueprint`);

blueprints.HelmAddOn.validateHelmVersions = false;
}
}


14 changes: 14 additions & 0 deletions main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import * as cdk from 'aws-cdk-lib';
import { logger } from '@aws-quickstart/eks-blueprints/dist/utils';
import { HelmAddOn } from '@aws-quickstart/eks-blueprints';

const app = new cdk.App();
const account = "049586690729";
const region = "eu-central-1";
const env: cdk.Environment = { account: account, region: region };
HelmAddOn.validateHelmVersions = false;

import DevCluster from './cluster';
new DevCluster().buildAsync(app, 'dev-cluster').catch(() => {
logger.info("Error setting up dev cluster");
});
Loading

0 comments on commit 675ff07

Please sign in to comment.