Skip to content

Commit

Permalink
Set deploymentController to ECS deployment type if circuitBreaker is …
Browse files Browse the repository at this point in the history
…defined
  • Loading branch information
Abdul Kader Maliyakkal committed Mar 7, 2021
1 parent 06b5d3b commit 73c2779
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 27 deletions.
3 changes: 0 additions & 3 deletions packages/@aws-cdk/aws-ecs-patterns/README.md
Expand Up @@ -410,9 +410,6 @@ const service = new ApplicationLoadBalancedFargateService(stack, 'Service', {
taskImageOptions: {
image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"),
},
deploymentController: {
type: ecs.DeploymentControllerType.ECS,
},
circuitBreaker: { rollback: true },
});
```
Expand Down
12 changes: 6 additions & 6 deletions packages/@aws-cdk/aws-ecs-patterns/test/ec2/test.l3s.ts
Expand Up @@ -1112,9 +1112,6 @@ export = {
taskImageOptions: {
image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
},
deploymentController: {
type: ecs.DeploymentControllerType.ECS,
},
circuitBreaker: { rollback: true },
});

Expand All @@ -1126,6 +1123,9 @@ export = {
Rollback: true,
},
},
DeploymentController: {
Type: 'ECS',
},
}));

test.done();
Expand All @@ -1145,9 +1145,6 @@ export = {
taskImageOptions: {
image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
},
deploymentController: {
type: ecs.DeploymentControllerType.ECS,
},
circuitBreaker: { rollback: true },
});

Expand All @@ -1159,6 +1156,9 @@ export = {
Rollback: true,
},
},
DeploymentController: {
Type: 'ECS',
},
}));

test.done();
Expand Down
Expand Up @@ -209,9 +209,6 @@ export = {
maxHealthyPercent: 150,
serviceName: 'ecs-test-service',
family: 'ecs-task-family',
deploymentController: {
type: ecs.DeploymentControllerType.CODE_DEPLOY,
},
circuitBreaker: { rollback: true },
});

Expand All @@ -229,7 +226,7 @@ export = {
LaunchType: 'EC2',
ServiceName: 'ecs-test-service',
DeploymentController: {
Type: 'CODE_DEPLOY',
Type: 'ECS',
},
}));

Expand Down
Expand Up @@ -436,9 +436,6 @@ export = {
taskImageOptions: {
image: ecs.ContainerImage.fromRegistry('/aws/aws-example-app'),
},
deploymentController: {
type: ecs.DeploymentControllerType.ECS,
},
circuitBreaker: { rollback: true },
});
// THEN
Expand All @@ -449,6 +446,9 @@ export = {
Rollback: true,
},
},
DeploymentController: {
Type: 'ECS',
},
}));
test.done();
},
Expand All @@ -462,9 +462,6 @@ export = {
taskImageOptions: {
image: ecs.ContainerImage.fromRegistry('/aws/aws-example-app'),
},
deploymentController: {
type: ecs.DeploymentControllerType.ECS,
},
circuitBreaker: { rollback: true },
});
// THEN
Expand All @@ -475,6 +472,9 @@ export = {
Rollback: true,
},
},
DeploymentController: {
Type: 'ECS',
},
}));
test.done();
},
Expand Down
Expand Up @@ -344,9 +344,6 @@ export = {
serviceName: 'fargate-test-service',
family: 'fargate-task-family',
platformVersion: ecs.FargatePlatformVersion.VERSION1_4,
deploymentController: {
type: ecs.DeploymentControllerType.CODE_DEPLOY,
},
circuitBreaker: { rollback: true },
});

Expand All @@ -365,7 +362,7 @@ export = {
ServiceName: 'fargate-test-service',
PlatformVersion: ecs.FargatePlatformVersion.VERSION1_4,
DeploymentController: {
Type: 'CODE_DEPLOY',
Type: 'ECS',
},
}));

Expand Down
6 changes: 4 additions & 2 deletions packages/@aws-cdk/aws-ecs/lib/base/base-service.ts
Expand Up @@ -387,7 +387,9 @@ export abstract class BaseService extends Resource
},
propagateTags: props.propagateTags === PropagatedTagSource.NONE ? undefined : props.propagateTags,
enableEcsManagedTags: props.enableECSManagedTags ?? false,
deploymentController: props.deploymentController,
deploymentController: props.circuitBreaker ? {
type: DeploymentControllerType.ECS,
} : props.deploymentController,
launchType: launchType,
capacityProviderStrategy: props.capacityProviderStrategies,
healthCheckGracePeriodSeconds: this.evaluateHealthGracePeriod(props.healthCheckGracePeriod),
Expand Down Expand Up @@ -937,4 +939,4 @@ function determineContainerNameAndPort(options: DetermineContainerNameAndPortOpt
}

return {};
}
}
Expand Up @@ -294,7 +294,7 @@ nodeunitShim({
maxHealthyPercent: 150,
minHealthyPercent: 55,
deploymentController: {
type: ecs.DeploymentControllerType.CODE_DEPLOY,
type: ecs.DeploymentControllerType.ECS,
},
circuitBreaker: { rollback: true },
securityGroup: new ec2.SecurityGroup(stack, 'SecurityGroup1', {
Expand Down Expand Up @@ -326,7 +326,7 @@ nodeunitShim({
},
},
DeploymentController: {
Type: ecs.DeploymentControllerType.CODE_DEPLOY,
Type: ecs.DeploymentControllerType.ECS,
},
DesiredCount: 2,
HealthCheckGracePeriodSeconds: 60,
Expand Down Expand Up @@ -1978,6 +1978,9 @@ nodeunitShim({
Rollback: true,
},
},
DeploymentController: {
Type: ecs.DeploymentControllerType.ECS,
},
}));

test.done();
Expand Down

0 comments on commit 73c2779

Please sign in to comment.