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

Commit

Permalink
chore: add teams and second stack with ecr repo
Browse files Browse the repository at this point in the history
  • Loading branch information
twelvemo committed Mar 17, 2023
1 parent 3f575aa commit 2a72d99
Show file tree
Hide file tree
Showing 6 changed files with 2,637 additions and 106 deletions.
28 changes: 14 additions & 14 deletions cluster.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
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';
import { TeamPlatform } from './teams';
import * as cdk from 'aws-cdk-lib'
import * as ecr from 'aws-cdk-lib/aws-ecr'
import { ECRRegistry } from './ecr';

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

const accountID = process.env.CDK_DEFAULT_ACCOUNT!;
Expand All @@ -14,28 +17,24 @@ 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 {
export default class DevCluster extends cdk.Stack{

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])
new TeamPlatform(accountID)
];
*/

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)
.teams(...teams)
.resourceProvider(GlobalResources.HostedZone ,new ImportHostedZoneProvider('Z028702323WOQ31QJAJJP', subdomain))
.resourceProvider(GlobalResources.Certificate, new blueprints.CreateCertificateProvider('wildcard-cert', `*.${subdomain}`, "dev.marketplace.sys.garden"))
.resourceProvider(GlobalResources.Certificate, new blueprints.CreateCertificateProvider('wildcard-cert', "*.dev.marketplace.sys.garden", GlobalResources.HostedZone))
.addOns(
new blueprints.VpcCniAddOn(),
new blueprints.CoreDnsAddOn(),
Expand All @@ -45,15 +44,16 @@ export default class DevCluster {
hostedZoneResources: [blueprints.GlobalResources.HostedZone] // you can add more if you register resource providers
}),
new blueprints.NginxAddOn({
version: "0.15.2",
internetFacing: true,
backendProtocol: "tcp",
externalDnsHostname: subdomain,
crossZoneEnabled: false,
certificateResourceName: GlobalResources.Certificate
certificateResourceName: GlobalResources.Certificate,
}),
new blueprints.SecretsStoreAddOn({ rotationPollInterval: "120s" }),
new blueprints.ClusterAutoScalerAddOn)
.buildAsync(scope, `${id}-blueprint`);
.buildAsync(scope, `${id}-eks`);

blueprints.HelmAddOn.validateHelmVersions = false;
}
Expand Down
15 changes: 15 additions & 0 deletions ecr.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import * as cdk from 'aws-cdk-lib';
import * as ecr from 'aws-cdk-lib/aws-ecr';
import { Construct } from 'constructs';

export class ECRRegistry extends cdk.Stack {
public readonly ecrRepo: ecr.Repository
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);

this.ecrRepo = new ecr.Repository(this, 'backend', {
encryption: ecr.RepositoryEncryption.KMS,
imageScanOnPush: true,
});
}
}
5 changes: 4 additions & 1 deletion main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ HelmAddOn.validateHelmVersions = false;
import DevCluster from './cluster';
new DevCluster().buildAsync(app, 'dev-cluster').catch(() => {
logger.info("Error setting up dev cluster");
});
});

import { ECRRegistry } from './ecr';
new ECRRegistry(app, 'dev-cluster-ecr');
Loading

0 comments on commit 2a72d99

Please sign in to comment.