Skip to content

Commit 92fcac1

Browse files
committed
Merge remote-tracking branch 'origin/main' into adot-go-update
* origin/main: Downgrade EKS version to 1.31 to support adot addon installation adding dbinsights advanced for aurora cluster Update package dependencies along with aws-cdk version Add kubectlLayer version and bump EKS and oTeL addon versions Update the aws-cdk and other dependencies to latest versions Update PetSite application ecs clusters with enhanced observability Update codepipeline-stack.yml file with github user variable CDK TaskDefinition change (#300) Petfood removal and RDS ServerlessV2 migration (#292) Fixed type conversion error on Fargate Task definition Petfood removal and RDS ServerlessV2 migration (#292)
2 parents 5e7664d + 7801428 commit 92fcac1

19 files changed

+47
-461
lines changed

PetAdoptions/cdk/pet_stack/lib/applications.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { readFileSync } from 'fs';
99
import { Construct } from 'constructs'
1010
import { ContainerImageBuilderProps, ContainerImageBuilder } from './common/container-image-builder'
1111
import { PetAdoptionsHistory } from './applications/pet-adoptions-history-application'
12+
import { KubectlV31Layer } from '@aws-cdk/lambda-layer-kubectl-v31';
1213

1314
export class Applications extends Stack {
1415
constructor(scope: Construct, id: string, props?: StackProps) {
@@ -25,6 +26,7 @@ export class Applications extends Stack {
2526

2627
const cluster = eks.Cluster.fromClusterAttributes(this, 'MyCluster', {
2728
clusterName: 'PetSite',
29+
kubectlLayer: new KubectlV31Layer(this, 'kubectl'),
2830
kubectlRoleArn: roleArn,
2931
});
3032
// ClusterID is not available for creating the proper conditions https://github.com/aws/aws-cdk/issues/10347
@@ -142,4 +144,4 @@ export class Applications extends Stack {
142144
new CfnOutput(this, key, { value: value })
143145
});
144146
}
145-
}
147+
}

PetAdoptions/cdk/pet_stack/lib/services.ts

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ import * as yaml from 'js-yaml';
1515
import * as path from 'path';
1616
import * as lambda from 'aws-cdk-lib/aws-lambda';
1717
import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2';
18-
import * as cloud9 from 'aws-cdk-lib/aws-cloud9';
1918
import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';
20-
import * as ecr from 'aws-cdk-lib/aws-ecr';
21-
import * as ecrassets from 'aws-cdk-lib/aws-ecr-assets';
2219
import * as applicationinsights from 'aws-cdk-lib/aws-applicationinsights';
2320
import * as resourcegroups from 'aws-cdk-lib/aws-resourcegroups';
2421

@@ -34,8 +31,7 @@ import { CfnJson, RemovalPolicy, Fn, Duration, Stack, StackProps, CfnOutput } fr
3431
import { readFileSync } from 'fs';
3532
import 'ts-replace-all'
3633
import { TreatMissingData, ComparisonOperator } from 'aws-cdk-lib/aws-cloudwatch';
37-
import { KubectlLayer } from 'aws-cdk-lib/lambda-layer-kubectl';
38-
import { Cloud9Environment } from './modules/core/cloud9';
34+
import { KubectlV31Layer } from '@aws-cdk/lambda-layer-kubectl-v31';
3935

4036
export class Services extends Stack {
4137
constructor(scope: Construct, id: string, props?: StackProps) {
@@ -133,19 +129,21 @@ export class Services extends Stack {
133129
rdsUsername = "petadmin"
134130
}
135131

136-
const auroraCluster = new rds.ServerlessCluster(this, 'Database', {
137-
138-
engine: rds.DatabaseClusterEngine.auroraPostgres({ version: rds.AuroraPostgresEngineVersion.VER_13_9 }),
139-
132+
const auroraCluster = new rds.DatabaseCluster(this, 'Database', {
133+
engine: rds.DatabaseClusterEngine.auroraPostgres({ version: rds.AuroraPostgresEngineVersion.VER_13_15 }),
140134
parameterGroup: rds.ParameterGroup.fromParameterGroupName(this, 'ParameterGroup', 'default.aurora-postgresql13'),
141135
vpc: theVPC,
142136
securityGroups: [rdssecuritygroup],
143137
defaultDatabaseName: 'adoptions',
144-
scaling: {
145-
autoPause: Duration.minutes(60),
146-
minCapacity: rds.AuroraCapacityUnit.ACU_2,
147-
maxCapacity: rds.AuroraCapacityUnit.ACU_8,
148-
}
138+
databaseInsightsMode: rds.DatabaseInsightsMode.ADVANCED,
139+
performanceInsightRetention: rds.PerformanceInsightRetention.MONTHS_15,
140+
writer: rds.ClusterInstance.serverlessV2('writer', {
141+
autoMinorVersionUpgrade: true
142+
}),
143+
readers: [
144+
],
145+
serverlessV2MaxCapacity: 1,
146+
serverlessV2MinCapacity: 0.5,
149147
});
150148

151149

@@ -185,7 +183,7 @@ export class Services extends Stack {
185183

186184
const ecsPayForAdoptionCluster = new ecs.Cluster(this, "PayForAdoption", {
187185
vpc: theVPC,
188-
containerInsights: true
186+
containerInsightsV2: ecs.ContainerInsights.ENHANCED
189187
});
190188
// PayForAdoption service definitions-----------------------------------------------------------------------
191189
const payForAdoptionService = new PayForAdoptionService(this, 'pay-for-adoption-service', {
@@ -206,7 +204,7 @@ export class Services extends Stack {
206204

207205
const ecsPetListAdoptionCluster = new ecs.Cluster(this, "PetListAdoptions", {
208206
vpc: theVPC,
209-
containerInsights: true
207+
containerInsightsV2: ecs.ContainerInsights.ENHANCED
210208
});
211209
// PetListAdoptions service definitions-----------------------------------------------------------------------
212210
const listAdoptionsService = new ListAdoptionsService(this, 'list-adoptions-service', {
@@ -225,7 +223,7 @@ export class Services extends Stack {
225223

226224
const ecsPetSearchCluster = new ecs.Cluster(this, "PetSearch", {
227225
vpc: theVPC,
228-
containerInsights: true
226+
containerInsightsV2: ecs.ContainerInsights.ENHANCED
229227
});
230228
// PetSearch service definitions-----------------------------------------------------------------------
231229
const searchService = new SearchService(this, 'search-service', {
@@ -338,8 +336,8 @@ export class Services extends Stack {
338336
defaultCapacity: 2,
339337
defaultCapacityInstance: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.MEDIUM),
340338
secretsEncryptionKey: secretsKey,
341-
version: KubernetesVersion.of('1.31'),
342-
kubectlLayer: new KubectlLayer(this, 'kubectl'),
339+
version: eks.KubernetesVersion.V1_31,
340+
kubectlLayer: new KubectlV31Layer(this, 'kubectl'),
343341
authenticationMode: eks.AuthenticationMode.API_AND_CONFIG_MAP,
344342
});
345343

@@ -507,7 +505,7 @@ export class Services extends Stack {
507505
// NOTE: Amazon CloudWatch Observability Addon for CloudWatch Agent and Fluentbit
508506
const otelAddon = new eks.CfnAddon(this, 'otelObservabilityAddon', {
509507
addonName: 'amazon-cloudwatch-observability',
510-
addonVersion: 'v2.6.0-eksbuild.1',
508+
addonVersion: 'v3.3.0-eksbuild.1',
511509
clusterName: cluster.clusterName,
512510
// the properties below are optional
513511
resolveConflicts: 'OVERWRITE',

PetAdoptions/cdk/pet_stack/lib/services/ecs-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export abstract class EcsService extends Construct {
5151
]
5252
});
5353

54-
public readonly taskDefinition: ecs.TaskDefinition;
54+
public readonly taskDefinition: ecs.FargateTaskDefinition;
5555
public readonly service: ecs_patterns.ApplicationLoadBalancedServiceBase;
5656
public readonly container: ecs.ContainerDefinition;
5757

PetAdoptions/cdk/pet_stack/lib/services/list-adoptions-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Construct } from 'constructs'
66

77

88
export interface ListAdoptionServiceProps extends EcsServiceProps {
9-
database: rds.ServerlessCluster
9+
database: rds.DatabaseCluster
1010
}
1111

1212
export class ListAdoptionsService extends EcsService {

PetAdoptions/cdk/pet_stack/lib/services/pay-for-adoption-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { EcsService, EcsServiceProps } from './ecs-service'
55
import { Construct } from 'constructs'
66

77
export interface PayForAdoptionServiceProps extends EcsServiceProps {
8-
database: rds.ServerlessCluster
8+
database: rds.DatabaseCluster
99
}
1010

1111
export class PayForAdoptionService extends EcsService {

PetAdoptions/cdk/pet_stack/package.json

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,24 @@
1212
"cdk": "cdk"
1313
},
1414
"dependencies": {
15-
"@aws-cdk/aws-lambda-python-alpha": "^2.131.0-alpha.0",
15+
"@aws-cdk/aws-lambda-python-alpha": "^2.179.0-alpha.0",
16+
"@aws-cdk/lambda-layer-kubectl-v31": "^2.0.3",
1617
"@types/js-yaml": "^4.0.9",
17-
"aws-cdk-lib": "^2.146.0",
18-
"cdk-ecr-deployment": "^3.0.67",
18+
"aws-cdk-lib": "^2.179.0",
19+
"cdk-ecr-deployment": "^3.1.9",
1920
"jest": "^29.7.0",
2021
"js-yaml": "^4.1.0",
2122
"source-map-support": "^0.5.21"
2223
},
2324
"devDependencies": {
24-
"@types/jest": "^29.5.12",
25-
"@types/node": "^20.14.2",
26-
"aws-cdk": "^2.146.0",
27-
"cdk-nag": "^2.28.144",
28-
"constructs": "^10.3.0",
29-
"ts-jest": "^29.1.5",
25+
"@types/jest": "^29.5.14",
26+
"@types/node": "^22.13.4",
27+
"aws-cdk": "^2.1000.2",
28+
"cdk-nag": "^2.35.24",
29+
"constructs": "^10.4.2",
30+
"ts-jest": "^29.2.5",
3031
"ts-node": "^10.9.2",
3132
"ts-replace-all": "^1.0.0",
32-
"typescript": "^5.4.5"
33+
"typescript": "^5.7.3"
3334
}
34-
}
35+
}

PetAdoptions/cdk/pet_stack/resources/load_balancer/iam_policy.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"elasticloadbalancing:DescribeLoadBalancers",
1919
"elasticloadbalancing:DescribeLoadBalancerAttributes",
2020
"elasticloadbalancing:DescribeListeners",
21+
"elasticloadbalancing:DescribeListenerAttributes",
2122
"elasticloadbalancing:DescribeListenerCertificates",
2223
"elasticloadbalancing:DescribeSSLPolicies",
2324
"elasticloadbalancing:DescribeRules",
Binary file not shown.

PetAdoptions/petfood-metric/Dockerfile

Lines changed: 0 additions & 13 deletions
This file was deleted.

PetAdoptions/petfood-metric/deployment.yaml

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)