From 611e8ab9e3c8b223db030146871a38113ef3562f Mon Sep 17 00:00:00 2001 From: Kevin Coleman Date: Tue, 27 Apr 2021 22:24:17 -0700 Subject: [PATCH] Organized files and updated imports --- bin/main.ts | 8 +++--- lib/addons/appmesh/index.ts | 4 +-- lib/addons/argocd/index.ts | 4 +-- lib/addons/calico/index.ts | 2 +- .../ec2-cluster-provider.ts | 0 .../fargate-cluster-provider.ts | 0 lib/index.ts | 2 +- .../eks-blueprint-stack.ts} | 0 .../pipeline-stack.ts} | 0 lib/utils/{yamlUtils.ts => yaml-utils.ts} | 3 +-- .../bootstrap-pipeline.sh | 0 test/cdk-eks-blueprint.test.ts | 26 +++++++++---------- 12 files changed, 24 insertions(+), 25 deletions(-) rename lib/{ => cluster-providers}/ec2-cluster-provider.ts (100%) rename lib/{ => cluster-providers}/fargate-cluster-provider.ts (100%) rename lib/{eksBlueprintStack.ts => stacks/eks-blueprint-stack.ts} (100%) rename lib/{pipelineStack.ts => stacks/pipeline-stack.ts} (100%) rename lib/utils/{yamlUtils.ts => yaml-utils.ts} (97%) rename bootstrap-pipeline.sh => scripts/bootstrap-pipeline.sh (100%) diff --git a/bin/main.ts b/bin/main.ts index bf34c2d0f..e1e9d5729 100644 --- a/bin/main.ts +++ b/bin/main.ts @@ -4,17 +4,17 @@ import { InstanceType, IVpc } from '@aws-cdk/aws-ec2'; import { Cluster, FargateProfileOptions, KubernetesVersion, MachineImageType, NodegroupAmiType } from '@aws-cdk/aws-eks'; // Blueprint -import { CdkEksBlueprintStack, ClusterAddOn, ClusterInfo, ClusterProvider, TeamSetup } from '../lib/eksBlueprintStack'; +import { CdkEksBlueprintStack, ClusterAddOn, ClusterInfo, ClusterProvider, TeamSetup } from '../lib/stacks/eks-blueprint-stack'; // Addons import * as addon from '../lib/addons' // Cluster Providers -import { FargateClusterProvider } from '../lib/fargate-cluster-provider'; -import { EC2ClusterProvider, EC2ProviderClusterProps } from '../lib/ec2-cluster-provider'; +import { FargateClusterProvider } from '../lib/cluster-providers/fargate-cluster-provider'; +import { EC2ClusterProvider, EC2ProviderClusterProps } from '../lib/cluster-providers/ec2-cluster-provider'; // Pipeline -import { PipelineStack } from '../lib/pipelineStack'; +import { PipelineStack } from '../lib/stacks/pipeline-stack'; // Teams import { TeamBurnhamSetup } from '../lib/teams/team-burnham/setup'; diff --git a/lib/addons/appmesh/index.ts b/lib/addons/appmesh/index.ts index c1d7f7b6a..5bfe9d00e 100644 --- a/lib/addons/appmesh/index.ts +++ b/lib/addons/appmesh/index.ts @@ -1,6 +1,6 @@ import { ManagedPolicy } from "@aws-cdk/aws-iam"; -import { ClusterAddOn, ClusterInfo } from "../../eksBlueprintStack" +import { ClusterAddOn, ClusterInfo } from "../../stacks/eks-blueprint-stack" export class AppMeshAddon implements ClusterAddOn { @@ -29,7 +29,7 @@ export class AppMeshAddon implements ClusterAddOn { sa.node.addDependency(appMeshNS); // App Mesh Controller - const chart = cluster.addHelmChart("AppMeshAddon", { + const chart = cluster.addHelmChart("appmesh-addon", { chart: "appmesh-controller", repository: "https://aws.github.io/eks-charts", release: "appm-release", diff --git a/lib/addons/argocd/index.ts b/lib/addons/argocd/index.ts index 649206dd7..1856eb470 100644 --- a/lib/addons/argocd/index.ts +++ b/lib/addons/argocd/index.ts @@ -1,6 +1,6 @@ import { KubernetesManifest } from "@aws-cdk/aws-eks"; -import { ClusterAddOn, ClusterInfo } from "../../eksBlueprintStack"; -import { loadYaml, readYamlDocument } from "../../utils/yamlUtils"; +import { ClusterAddOn, ClusterInfo } from "../../stacks/eks-blueprint-stack"; +import { loadYaml, readYamlDocument } from "../../utils/yaml-utils"; export class ArgoCDAddon implements ClusterAddOn { diff --git a/lib/addons/calico/index.ts b/lib/addons/calico/index.ts index 9ef28fce4..dae964b16 100644 --- a/lib/addons/calico/index.ts +++ b/lib/addons/calico/index.ts @@ -1,4 +1,4 @@ -import { ClusterAddOn, ClusterInfo } from "../../eksBlueprintStack"; +import { ClusterAddOn, ClusterInfo } from "../../stacks/eks-blueprint-stack"; export class CalicoAddon implements ClusterAddOn { diff --git a/lib/ec2-cluster-provider.ts b/lib/cluster-providers/ec2-cluster-provider.ts similarity index 100% rename from lib/ec2-cluster-provider.ts rename to lib/cluster-providers/ec2-cluster-provider.ts diff --git a/lib/fargate-cluster-provider.ts b/lib/cluster-providers/fargate-cluster-provider.ts similarity index 100% rename from lib/fargate-cluster-provider.ts rename to lib/cluster-providers/fargate-cluster-provider.ts diff --git a/lib/index.ts b/lib/index.ts index 066eca06e..928e71877 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -1,3 +1,3 @@ -export * from './eksBlueprintStack'; +export * from './stacks/eks-blueprint-stack'; export * as Addons from './addons'; diff --git a/lib/eksBlueprintStack.ts b/lib/stacks/eks-blueprint-stack.ts similarity index 100% rename from lib/eksBlueprintStack.ts rename to lib/stacks/eks-blueprint-stack.ts diff --git a/lib/pipelineStack.ts b/lib/stacks/pipeline-stack.ts similarity index 100% rename from lib/pipelineStack.ts rename to lib/stacks/pipeline-stack.ts diff --git a/lib/utils/yamlUtils.ts b/lib/utils/yaml-utils.ts similarity index 97% rename from lib/utils/yamlUtils.ts rename to lib/utils/yaml-utils.ts index 18e8a89e4..e79c470f4 100644 --- a/lib/utils/yamlUtils.ts +++ b/lib/utils/yaml-utils.ts @@ -3,7 +3,6 @@ import * as yaml from 'js-yaml'; import * as eks from '@aws-cdk/aws-eks'; import request from 'sync-request'; - export function readYamlFromDir(dir: string, cluster: eks.Cluster) { fs.readdir(dir, 'utf8', (err, files) => { if (files != undefined) { @@ -47,5 +46,5 @@ export function loadExternalYaml(url: string): any { } export function serializeYaml(document: any): string { - return yaml.safeDump(document); + return yaml.safeDump(document); } \ No newline at end of file diff --git a/bootstrap-pipeline.sh b/scripts/bootstrap-pipeline.sh similarity index 100% rename from bootstrap-pipeline.sh rename to scripts/bootstrap-pipeline.sh diff --git a/test/cdk-eks-blueprint.test.ts b/test/cdk-eks-blueprint.test.ts index e506dcf2a..2a62abca7 100644 --- a/test/cdk-eks-blueprint.test.ts +++ b/test/cdk-eks-blueprint.test.ts @@ -1,21 +1,21 @@ import { expect as expectCDK, haveResource } from '@aws-cdk/assert'; import * as cdk from '@aws-cdk/core'; -import * as CdkEksBlueprint from '../lib/eksBlueprintStack'; +import * as CdkEksBlueprint from '../lib/stacks/eks-blueprint-stack'; test('SQS Queue Created', () => { - const app = new cdk.App(); - // WHEN - const stack = new CdkEksBlueprint.CdkEksBlueprintStack(app, { id: 'MyTestStack' }); - // THEN - expectCDK(stack).to(haveResource("AWS::SQS::Queue", { - VisibilityTimeout: 300 - })); + const app = new cdk.App(); + // WHEN + const stack = new CdkEksBlueprint.CdkEksBlueprintStack(app, { id: 'MyTestStack' }); + // THEN + expectCDK(stack).to(haveResource("AWS::SQS::Queue", { + VisibilityTimeout: 300 + })); }); test('SNS Topic Created', () => { - const app = new cdk.App(); - // WHEN - const stack = new CdkEksBlueprint.CdkEksBlueprintStack(app, { id: 'MyTestStack' }); - // THEN - expectCDK(stack).to(haveResource("AWS::SNS::Topic")); + const app = new cdk.App(); + // WHEN + const stack = new CdkEksBlueprint.CdkEksBlueprintStack(app, { id: 'MyTestStack' }); + // THEN + expectCDK(stack).to(haveResource("AWS::SNS::Topic")); });