Skip to content

Commit af1fa48

Browse files
authored
Merge pull request aws-samples#3 from aws-samples/feature/acm-integration
Feature/acm integration
2 parents 219b040 + 1c3f3c7 commit af1fa48

File tree

14 files changed

+148
-44
lines changed

14 files changed

+148
-44
lines changed

bin/main.ts

+11-9
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,23 @@ import * as cdk from '@aws-cdk/core';
33

44
const app = new cdk.App();
55

6+
import NginxIngressConstruct from '../lib/nginx-ingress-construct';
7+
new NginxIngressConstruct(app, 'nginx');
8+
9+
610
//-------------------------------------------
711
// Single Cluster with multiple teams.
812
//-------------------------------------------
913

10-
import MultiTeamConstruct from '../lib/multi-team-construct'
14+
import MultiTeamConstruct from '../lib/multi-team-construct';
1115
new MultiTeamConstruct(app, 'multi-team');
1216

1317

1418
//-------------------------------------------
1519
// Multiple clusters, multiple regions.
1620
//-------------------------------------------
1721

18-
import MultiRegionConstruct from '../lib/multi-region-construct'
22+
import MultiRegionConstruct from '../lib/multi-region-construct';
1923
new MultiRegionConstruct().buildAsync(app, 'multi-region').catch(() => {
2024
console.log("Multi region pattern is not setup due to missing secrets for GitHub access and ArgoCD admin pwd.");
2125
});
@@ -25,7 +29,7 @@ new MultiRegionConstruct().buildAsync(app, 'multi-region').catch(() => {
2529
// Single Fargate cluster.
2630
//-------------------------------------------
2731

28-
import FargateConstruct from '../lib/fargate-construct'
32+
import FargateConstruct from '../lib/fargate-construct';
2933
new FargateConstruct(app, 'fargate');
3034

3135

@@ -47,18 +51,16 @@ else {
4751
// Single cluster with Bottlerocket nodes.
4852
//-------------------------------------------
4953

50-
import BottleRocketConstruct from '../lib/bottlerocket-construct'
54+
import BottleRocketConstruct from '../lib/bottlerocket-construct';
5155
new BottleRocketConstruct(app, 'bottlerocket');
5256

5357

5458
//-------------------------------------------
5559
// Single cluster with custom configuration.
5660
//-------------------------------------------
5761

58-
import CustomClusterConstruct from '../lib/custom-cluster-construct'
62+
import CustomClusterConstruct from '../lib/custom-cluster-construct';
5963
new CustomClusterConstruct(app, 'custom-cluster');
6064

61-
import ScratchpadConstruct from '../lib/scratchpad'
62-
new ScratchpadConstruct(app, 'scratchpad');
63-
64-
65+
import ScratchpadConstruct from '../lib/scratchpad';
66+
new ScratchpadConstruct(app, 'scratchpad');

lib/bottlerocket-construct/index.ts

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import * as cdk from '@aws-cdk/core';
22

33
// SSP Lib
4-
import * as ssp from '@shapirov/cdk-eks-blueprint'
4+
import * as ssp from '@aws-quickstart/ssp-amazon-eks'
55

66
// Team implementations
77
import * as team from '../teams'
88

9+
import * as eks from '@aws-cdk/aws-eks';
10+
import { AwsLoadBalancerControllerAddOn } from '@aws-quickstart/ssp-amazon-eks';
11+
912
export default class BottlerocketConstruct extends cdk.Construct {
1013
constructor(scope: cdk.Construct, id: string) {
1114
super(scope, id);
@@ -17,20 +20,24 @@ export default class BottlerocketConstruct extends cdk.Construct {
1720

1821
// AddOns for the cluster.
1922
const addOns: Array<ssp.ClusterAddOn> = [
23+
new AwsLoadBalancerControllerAddOn,
2024
new ssp.NginxAddOn,
2125
new ssp.ArgoCDAddOn,
2226
new ssp.CalicoAddOn,
2327
new ssp.MetricsServerAddOn,
2428
new ssp.ContainerInsightsAddOn,
2529
];
2630

27-
const stackID = `${id}-blueprint`
28-
const clusterProvider = new ssp.BottlerocketClusterProvider()
31+
const stackID = `${id}-blueprint`;
32+
const clusterProvider = new ssp.AsgClusterProvider({
33+
version: eks.KubernetesVersion.V1_20,
34+
machineImageType: eks.MachineImageType.BOTTLEROCKET
35+
});
2936
new ssp.EksBlueprint(scope, { id: stackID, teams, addOns, clusterProvider }, {
3037
env: {
3138
region: 'us-east-1'
3239
}
33-
})
40+
});
3441
}
3542
}
3643

lib/custom-cluster-construct/index.ts

+7-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ import * as cdk from '@aws-cdk/core';
22
import * as ec2 from '@aws-cdk/aws-ec2';
33
import * as eks from '@aws-cdk/aws-eks';
44
// SSP Lib
5-
import * as ssp from '@shapirov/cdk-eks-blueprint'
5+
import * as ssp from '@aws-quickstart/ssp-amazon-eks'
66

77
// Team implementations
88
import * as team from '../teams'
9+
import { AwsLoadBalancerControllerAddOn } from '@aws-quickstart/ssp-amazon-eks';
910

1011

1112
export default class CustomClusterConstruct extends cdk.Construct {
@@ -19,21 +20,23 @@ export default class CustomClusterConstruct extends cdk.Construct {
1920

2021
// AddOns for the cluster.
2122
const addOns: Array<ssp.ClusterAddOn> = [
23+
new AwsLoadBalancerControllerAddOn,
24+
2225
new ssp.NginxAddOn,
2326
new ssp.ArgoCDAddOn,
2427
new ssp.CalicoAddOn,
2528
new ssp.MetricsServerAddOn,
2629
new ssp.ContainerInsightsAddOn,
2730
];
2831

29-
const clusterProps: ssp.EC2ProviderClusterProps = {
30-
version: eks.KubernetesVersion.V1_19,
32+
const clusterProps: ssp.MngClusterProviderProps = {
33+
version: eks.KubernetesVersion.V1_20,
3134
instanceTypes: [new ec2.InstanceType('t3.large')],
3235
amiType: eks.NodegroupAmiType.AL2_X86_64
3336
}
3437

3538
const stackID = `${id}-blueprint`
36-
const clusterProvider = new ssp.EC2ClusterProvider(clusterProps);
39+
const clusterProvider = new ssp.MngClusterProvider(clusterProps);
3740
new ssp.EksBlueprint(scope, { id: stackID, teams, addOns, clusterProvider });
3841
}
3942
}

lib/fargate-construct/index.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as cdk from '@aws-cdk/core';
22
import * as eks from '@aws-cdk/aws-eks';
33
// SSP Lib
4-
import * as ssp from '@shapirov/cdk-eks-blueprint'
4+
import * as ssp from '@aws-quickstart/ssp-amazon-eks'
55

66
// Team implementations
77
import * as team from '../teams'
@@ -17,9 +17,7 @@ export default class FargateConstruct extends cdk.Construct {
1717

1818
// AddOns for the cluster.
1919
const addOns: Array<ssp.ClusterAddOn> = [
20-
new ssp.NginxAddOn,
21-
new ssp.ArgoCDAddOn,
22-
new ssp.CalicoAddOn,
20+
new ssp.ArgoCDAddOn
2321
];
2422

2523
// TODO - what is with dynatrace?
@@ -28,7 +26,10 @@ export default class FargateConstruct extends cdk.Construct {
2826
]);
2927

3028
const stackID = `${id}-blueprint`
31-
const clusterProvider = new ssp.FargateClusterProvider(fargateProfiles)
29+
const clusterProvider = new ssp.FargateClusterProvider({
30+
fargateProfiles,
31+
version: eks.KubernetesVersion.V1_20
32+
})
3233
new ssp.EksBlueprint(scope, { id: stackID, teams, addOns, clusterProvider }, {
3334
env: {
3435
region: 'us-east-1'

lib/multi-region-construct/index.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import * as cdk from '@aws-cdk/core';
22

33
// SSP Lib
4-
import * as ssp from '@shapirov/cdk-eks-blueprint';
4+
import * as ssp from '@aws-quickstart/ssp-amazon-eks';
55

6-
import { getSecretValue } from '@shapirov/cdk-eks-blueprint/dist/utils/secrets-manager-utils';
6+
import { getSecretValue } from '@aws-quickstart/ssp-amazon-eks/dist/utils/secrets-manager-utils';
77

88
// Team implementations
99
import * as team from '../teams'
@@ -37,7 +37,7 @@ export default class MultiRegionConstruct {
3737

3838
const blueprint = ssp.EksBlueprint.builder()
3939
.account(process.env.CDK_DEFAULT_ACCOUNT!)
40-
.addons(new ssp.NginxAddOn,
40+
.addOns(new ssp.NginxAddOn,
4141
new ssp.CalicoAddOn,
4242
new ssp.MetricsServerAddOn,
4343
new ssp.ClusterAutoScalerAddOn,
@@ -74,15 +74,15 @@ export default class MultiRegionConstruct {
7474
});
7575

7676
const east1 = await blueprint.clone('us-east-1')
77-
.addons(devBootstrapArgo)
77+
.addOns(devBootstrapArgo)
7878
.buildAsync(scope, `${id}-us-east-1`);
7979

8080
const east2 = await blueprint.clone('us-east-2')
81-
.addons(testBootstrapArgo)
81+
.addOns(testBootstrapArgo)
8282
.buildAsync(scope, `${id}-us-east-2`);
8383

8484
const west2 = await blueprint.clone('us-west-2')
85-
.addons(prodBootstrapArgo)
85+
.addOns(prodBootstrapArgo)
8686
.buildAsync(scope, `${id}-us-west-2`);
8787

8888
return [ east1, east2, west2 ];

lib/multi-team-construct/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import * as cdk from '@aws-cdk/core';
22

33
// SSP Lib
4-
import * as ssp from '@shapirov/cdk-eks-blueprint'
4+
import * as ssp from '@aws-quickstart/ssp-amazon-eks'
5+
import { AwsLoadBalancerControllerAddOn } from '@aws-quickstart/ssp-amazon-eks';
56

67
// Team implementations
78
import * as team from '../teams'
@@ -25,6 +26,7 @@ export default class MultiTeamConstruct extends cdk.Construct {
2526
// AddOns for the cluster.
2627
const addOns: Array<ssp.ClusterAddOn> = [
2728
new ssp.AppMeshAddOn,
29+
new AwsLoadBalancerControllerAddOn,
2830
new ssp.NginxAddOn,
2931
new ssp.ArgoCDAddOn,
3032
new ssp.CalicoAddOn,

lib/nginx-ingress-construct/index.ts

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import * as cdk from '@aws-cdk/core';
2+
3+
// SSP Lib
4+
import * as ssp from '@aws-quickstart/ssp-amazon-eks'
5+
6+
//TODO import * as iam from '@aws-cdk/aws-iam';
7+
// import * as route53 from '@aws-cdk/aws-route53';
8+
9+
10+
// Team implementations
11+
import * as team from '../teams'
12+
import { valueFromContext } from '@aws-quickstart/ssp-amazon-eks/dist/utils/context-utils';
13+
import { EksBlueprint, GlobalResources } from '@aws-quickstart/ssp-amazon-eks';
14+
import MultiRegionConstruct from '../multi-region-construct';
15+
16+
const accountID = process.env.CDK_DEFAULT_ACCOUNT!;
17+
const gitUrl = 'https://github.com/aws-samples/ssp-eks-workloads.git';
18+
19+
20+
21+
export default class NginxIngressConstruct extends cdk.Construct {
22+
23+
constructor(scope: cdk.Construct, id: string) {
24+
super(scope, id);
25+
// Teams for the cluster.
26+
const teams: Array<ssp.Team> = [
27+
new team.TeamPlatform(accountID),
28+
new team.TeamTroiSetup,
29+
new team.TeamRikerSetup,
30+
new team.TeamBurnhamSetup(scope)
31+
];
32+
33+
const subdomain : string = valueFromContext(scope, "dev.subzone.name", "dev.some.example.com");
34+
const parentDnsAccountId = this.node.tryGetContext("parent.dns.account")!;
35+
const parentDomain = valueFromContext(this, "parent.hostedzone.name", "some.example.com");
36+
37+
EksBlueprint.builder()
38+
.account(process.env.CDK_DEFAULT_ACCOUNT)
39+
.region('us-west-2')
40+
.teams(...teams)
41+
.resourceProvider(GlobalResources.HostedZone, new ssp.DelegatingHostedZoneProvider({
42+
parentDomain,
43+
subdomain,
44+
parentDnsAccountId,
45+
delegatingRoleName: 'DomainOperatorRole',
46+
wildcardSubdomain: true
47+
}))
48+
.resourceProvider(GlobalResources.Certificate, new ssp.CreateCertificateProvider('wildcard-cert', `*.${subdomain}`, GlobalResources.HostedZone))
49+
.addOns(new ssp.CalicoAddOn,
50+
new ssp.AwsLoadBalancerControllerAddOn,
51+
new ssp.addons.ExternalDnsAddon({
52+
hostedZoneResources: [GlobalResources.HostedZone] // you can add more if you register resource providers
53+
}),
54+
new ssp.NginxAddOn({
55+
internetFacing: true,
56+
backendProtocol: "tcp",
57+
externalDnsHostname: subdomain,
58+
crossZoneEnabled: false,
59+
certificateResourceName: GlobalResources.Certificate,
60+
values: {
61+
controller: {
62+
service: {
63+
httpsPort: {
64+
targetPort: "http"
65+
}
66+
}
67+
}
68+
}
69+
}),
70+
new ssp.ArgoCDAddOn( {
71+
bootstrapRepo: {
72+
repoUrl: gitUrl,
73+
targetRevision: "deployable",
74+
path: 'envs/dev'
75+
},
76+
adminPasswordSecretName: MultiRegionConstruct.SECRET_ARGO_ADMIN_PWD,
77+
}),
78+
new ssp.MetricsServerAddOn,
79+
new ssp.ClusterAutoScalerAddOn,
80+
new ssp.ContainerInsightsAddOn )
81+
.build(scope, `${id}-blueprint`);
82+
}
83+
}
84+

lib/pipeline-stack/index.ts

+10-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import * as cdk from '@aws-cdk/core';
22
import { StackProps } from '@aws-cdk/core';
33

44
// SSP Lib
5-
import * as ssp from '@shapirov/cdk-eks-blueprint'
5+
import * as ssp from '@aws-quickstart/ssp-amazon-eks'
6+
import { AwsLoadBalancerControllerAddOn } from '@aws-quickstart/ssp-amazon-eks';
67

78
// Team implementations
89
import * as team from '../teams'
@@ -15,7 +16,9 @@ export default class PipelineConstruct extends cdk.Construct {
1516
const blueprint = ssp.EksBlueprint.builder()
1617
.account(account) // the supplied default will fail, but build and synth will pass
1718
.region('us-west-1')
18-
.addons(new ssp.NginxAddOn,
19+
.addOns(
20+
new AwsLoadBalancerControllerAddOn,
21+
new ssp.NginxAddOn,
1922
new ssp.ArgoCDAddOn,
2023
new ssp.CalicoAddOn,
2124
new ssp.MetricsServerAddOn,
@@ -29,15 +32,18 @@ export default class PipelineConstruct extends cdk.Construct {
2932
.repository({
3033
repoUrl: 'ssp-eks-patterns',
3134
credentialsSecretName: 'github-token',
32-
branch: 'feature/usage-tracking'
35+
branch: 'main'
3336
})
3437
.stage({
3538
id: 'us-west-1-managed-ssp',
3639
stackBuilder: blueprint.clone('us-west-1')
3740
})
3841
.stage({
3942
id: 'us-east-2-managed-ssp',
40-
stackBuilder: blueprint.clone('us-east-2')
43+
stackBuilder: blueprint.clone('us-east-2'),
44+
stageProps: {
45+
manualApprovals: true
46+
}
4147
})
4248
.build(scope, "ssp-pipeline-stack", props);
4349
}

lib/scratchpad/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import * as cdk from '@aws-cdk/core';
22
import {KubernetesVersion} from '@aws-cdk/aws-eks';
33

44
// SSP Lib
5-
import * as ssp from '@shapirov/cdk-eks-blueprint';
6-
import { EC2ClusterProvider } from '@shapirov/cdk-eks-blueprint';
5+
import * as ssp from '@aws-quickstart/ssp-amazon-eks';
6+
import { MngClusterProvider } from '@aws-quickstart/ssp-amazon-eks';
77

88

99
export default class ScratchpadConstruct extends cdk.Construct {
@@ -19,7 +19,7 @@ export default class ScratchpadConstruct extends cdk.Construct {
1919

2020
const stackID = `${id}-blueprint`;
2121

22-
const clusterProvider = new EC2ClusterProvider( {
22+
const clusterProvider = new MngClusterProvider( {
2323
desiredSize: 3,
2424
maxSize: 3,
2525
version: KubernetesVersion.V1_20

lib/teams/team-burnham/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ArnPrincipal } from '@aws-cdk/aws-iam';
22
import { Construct } from '@aws-cdk/core';
33

4-
import { ApplicationTeam } from '@shapirov/cdk-eks-blueprint';
4+
import { ApplicationTeam } from '@aws-quickstart/ssp-amazon-eks';
55

66
function getUserArns(scope: Construct, key: string): ArnPrincipal[] {
77
const context: string = scope.node.tryGetContext(key);

lib/teams/team-platform/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ArnPrincipal } from "@aws-cdk/aws-iam";
22

3-
import { PlatformTeam } from '@shapirov/cdk-eks-blueprint';
3+
import { PlatformTeam } from '@aws-quickstart/ssp-amazon-eks';
44

55
export class TeamPlatform extends PlatformTeam {
66
constructor(accountID: string) {

0 commit comments

Comments
 (0)