Skip to content

Commit

Permalink
fix(ecs): adding a circuit breaker causes Service replacement (under …
Browse files Browse the repository at this point in the history
…feature flag) (#22467)

Fixes #16126

Copied from #16919 with review comments as it went stale and closed.
Initial implementation #22328 reverted because it was not backward compatible.

Introduces feature flag:

* `@aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker`

Enable this feature flag to avoid setting the "ECS" deployment controller when adding a circuit breaker to an
ECS Service, as this will trigger a full replacement which fails to deploy when using set service names.
This does not change any behaviour as the default deployment controller when it is not defined is ECS.

_cdk.json_

```json
{
  "context": {
    "@aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker": true
  }
}
```

----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [x] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
fergusdixon committed Nov 9, 2022
1 parent 4bdb18e commit 9437d4f
Show file tree
Hide file tree
Showing 18 changed files with 2,723 additions and 9 deletions.
@@ -1,10 +1,11 @@
import { Vpc } from '@aws-cdk/aws-ec2';
import { Cluster, ContainerImage } from '@aws-cdk/aws-ecs';
import { App, Stack } from '@aws-cdk/core';
import * as cxapi from '@aws-cdk/cx-api';
import * as integ from '@aws-cdk/integ-tests';
import { ApplicationLoadBalancedFargateService } from '../../lib';

const app = new App();
const app = new App({ postCliContext: { [cxapi.ECS_DISABLE_EXPLICIT_DEPLOYMENT_CONTROLLER_FOR_CIRCUIT_BREAKER]: false } });
const stack = new Stack(app, 'aws-ecs-integ-circuit-breaker');
const vpc = new Vpc(stack, 'Vpc', { maxAzs: 2 });
const cluster = new Cluster(stack, 'Cluster', { vpc });
Expand Down
@@ -0,0 +1,19 @@
{
"version": "21.0.0",
"files": {
"4eec79ee498cc4b9ae0a8ad419511759b90d72d3a3cb5bd018e5e137f050cfae": {
"source": {
"path": "aws-ecs-integ-circuit-breaker-no-dc.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "4eec79ee498cc4b9ae0a8ad419511759b90d72d3a3cb5bd018e5e137f050cfae.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
}
},
"dockerImages": {}
}

0 comments on commit 9437d4f

Please sign in to comment.