Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ecs-patterns): feature flag missing for breaking change passing container port for target group port #20284

Merged
merged 2 commits into from
May 12, 2022

Conversation

TheRealAmazonKendra
Copy link
Contributor

PR #18157 results in a new TargetGroup being created from NetworkLoadBalancedEc2Service, NetworkLoadBalancedFargateService, NetworkMultipleTargetGroupsEc2Service,
and NetworkMultipleTargerGroupsFargateService even when no change is made because we are now passing through the containerPort props to TargetGroups's Port.

For existing services, this is a breaking change so a feature flag is needed. This PR adds that feature flag.

Closes #19411.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@gitpod-io
Copy link

gitpod-io bot commented May 11, 2022

@github-actions github-actions bot added bug This issue is a bug. effort/small Small work item – less than a day of effort p1 labels May 11, 2022
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label May 11, 2022
@aws-cdk-automation aws-cdk-automation requested a review from a team May 11, 2022 04:45
@rix0rrr rix0rrr added the pr/do-not-merge This PR should not be merged at this time. label May 12, 2022
*
* This is a feature flag because updating `Port` causes a replacement of the target groups, which is a breaking change.
*/
export const ECS_PATTERNS_TARGET_GROUP_PORT_FROM_COTAINER_PORT = '@aws-cdk/aws-ecs-patterns:containerPortToTargetGroupPort';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo :)

Suggested change
export const ECS_PATTERNS_TARGET_GROUP_PORT_FROM_COTAINER_PORT = '@aws-cdk/aws-ecs-patterns:containerPortToTargetGroupPort';
export const ECS_PATTERNS_TARGET_GROUP_PORT_FROM_CONTAINER_PORT = '@aws-cdk/aws-ecs-patterns:containerPortToTargetGroupPort';

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Crap. Fixed.

…ontainer port for target group port

PR #18157 results in a new TargetGroup being created from NetworkLoadBalancedEc2Service, NetworkLoadBalancedFargateService, NetworkMultipleTargetGroupsEc2Service,
and NetworkMultipleTargerGroupsFargateService even when no change is made because we are now passing through the containerPort props to TargetGroups's Port.

For existing servies, this is a breaking change so a feature flag is needed. This PR adds that feature flag.

Closes #19411.
@TheRealAmazonKendra TheRealAmazonKendra force-pushed the TheRealAmazonKendra/ecs-feature-flag branch from 2c2001b to daa3216 Compare May 12, 2022 17:53
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: daa3216
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@TheRealAmazonKendra TheRealAmazonKendra removed the pr/do-not-merge This PR should not be merged at this time. label May 12, 2022
@mergify
Copy link
Contributor

mergify bot commented May 12, 2022

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit dc7533c into master May 12, 2022
@mergify mergify bot deleted the TheRealAmazonKendra/ecs-feature-flag branch May 12, 2022 19:09
Chriscbr added a commit that referenced this pull request May 19, 2022
… passing container port for target group port (#20284)"

This reverts commit dc7533c.
mergify bot pushed a commit that referenced this pull request May 20, 2022
… passing container port for target group port (#20284)" (#20430)

This reverts #20284 since its tests fail to pass in CDK v2, blocking the next CDK release. The root cause of failure looks as though it may be the same as #20427 - I've included the test logs below:

<details>

```
@aws-cdk/aws-ecs-patterns: FAIL test/fargate/load-balanced-fargate-service-v2.test.js (11.703 s)
@aws-cdk/aws-ecs-patterns:   � When Network Load Balancer › Fargate networkloadbalanced construct uses custom Port for target group when feature flag is enabled
@aws-cdk/aws-ecs-patterns:     Template has 1 resources with type AWS::ElasticLoadBalancingV2::TargetGroup, but none match as expected.
@aws-cdk/aws-ecs-patterns:     The closest result is:
@aws-cdk/aws-ecs-patterns:       {
@aws-cdk/aws-ecs-patterns:         "Type": "AWS::ElasticLoadBalancingV2::TargetGroup",
@aws-cdk/aws-ecs-patterns:         "Properties": {
@aws-cdk/aws-ecs-patterns:           "Port": 80,
@aws-cdk/aws-ecs-patterns:           "Protocol": "TCP",
@aws-cdk/aws-ecs-patterns:           "TargetType": "ip",
@aws-cdk/aws-ecs-patterns:           "VpcId": {
@aws-cdk/aws-ecs-patterns:             "Ref": "VPCB9E5F0B4"
@aws-cdk/aws-ecs-patterns:           }
@aws-cdk/aws-ecs-patterns:         }
@aws-cdk/aws-ecs-patterns:       }
@aws-cdk/aws-ecs-patterns:     with the following mismatches:
@aws-cdk/aws-ecs-patterns:     	Expected 81 but received 80 at /Properties/Port (using objectLike matcher)
@aws-cdk/aws-ecs-patterns:       83 |     const matchError = hasResourceProperties(this.template, type, props);
@aws-cdk/aws-ecs-patterns:       84 |     if (matchError) {
@aws-cdk/aws-ecs-patterns:     > 85 |       throw new Error(matchError);
@aws-cdk/aws-ecs-patterns:          |             ^
@aws-cdk/aws-ecs-patterns:       86 |     }
@aws-cdk/aws-ecs-patterns:       87 |   }
@aws-cdk/aws-ecs-patterns:       88 |
@aws-cdk/aws-ecs-patterns:       at Template.hasResourceProperties (../assertions/lib/template.ts:85:13)
@aws-cdk/aws-ecs-patterns:       at fn (test/fargate/load-balanced-fargate-service-v2.test.ts:709:31)
@aws-cdk/aws-ecs-patterns:       at Object.<anonymous> (../../../tools/@aws-cdk/cdk-build-tools/lib/feature-flag.ts:34:35)
@aws-cdk/aws-ecs-patterns:   � When Network Load Balancer › test Fargate multinetworkloadbalanced construct uses custom Port for target group when feature flag is enabled
@aws-cdk/aws-ecs-patterns:     Template has 2 resources with type AWS::ElasticLoadBalancingV2::TargetGroup, but none match as expected.
@aws-cdk/aws-ecs-patterns:     The closest result is:
@aws-cdk/aws-ecs-patterns:       {
@aws-cdk/aws-ecs-patterns:         "Type": "AWS::ElasticLoadBalancingV2::TargetGroup",
@aws-cdk/aws-ecs-patterns:         "Properties": {
@aws-cdk/aws-ecs-patterns:           "Port": 80,
@aws-cdk/aws-ecs-patterns:           "Protocol": "TCP",
@aws-cdk/aws-ecs-patterns:           "TargetType": "ip",
@aws-cdk/aws-ecs-patterns:           "VpcId": {
@aws-cdk/aws-ecs-patterns:             "Ref": "VPCB9E5F0B4"
@aws-cdk/aws-ecs-patterns:           }
@aws-cdk/aws-ecs-patterns:         }
@aws-cdk/aws-ecs-patterns:       }
@aws-cdk/aws-ecs-patterns:     with the following mismatches:
@aws-cdk/aws-ecs-patterns:     	Expected 81 but received 80 at /Properties/Port (using objectLike matcher)
@aws-cdk/aws-ecs-patterns:       83 |     const matchError = hasResourceProperties(this.template, type, props);
@aws-cdk/aws-ecs-patterns:       84 |     if (matchError) {
@aws-cdk/aws-ecs-patterns:     > 85 |       throw new Error(matchError);
@aws-cdk/aws-ecs-patterns:          |             ^
@aws-cdk/aws-ecs-patterns:       86 |     }
@aws-cdk/aws-ecs-patterns:       87 |   }
@aws-cdk/aws-ecs-patterns:       88 |
@aws-cdk/aws-ecs-patterns:       at Template.hasResourceProperties (../assertions/lib/template.ts:85:13)
@aws-cdk/aws-ecs-patterns:       at fn (test/fargate/load-balanced-fargate-service-v2.test.ts:823:31)
@aws-cdk/aws-ecs-patterns:       at Object.<anonymous> (../../../tools/@aws-cdk/cdk-build-tools/lib/feature-flag.ts:34:35)
```

</details>


----

### All Submissions:

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

### Adding new Unconventional Dependencies:

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

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/master/INTEGRATION_TESTS.md)?
	* [ ] 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*
Chriscbr added a commit that referenced this pull request May 20, 2022
… passing container port for target group port (#20284)" (#20430)

This reverts #20284 since its tests fail to pass in CDK v2, blocking the next CDK release. The root cause of failure looks as though it may be the same as #20427 - I've included the test logs below:

<details>

```
@aws-cdk/aws-ecs-patterns: FAIL test/fargate/load-balanced-fargate-service-v2.test.js (11.703 s)
@aws-cdk/aws-ecs-patterns:   � When Network Load Balancer › Fargate networkloadbalanced construct uses custom Port for target group when feature flag is enabled
@aws-cdk/aws-ecs-patterns:     Template has 1 resources with type AWS::ElasticLoadBalancingV2::TargetGroup, but none match as expected.
@aws-cdk/aws-ecs-patterns:     The closest result is:
@aws-cdk/aws-ecs-patterns:       {
@aws-cdk/aws-ecs-patterns:         "Type": "AWS::ElasticLoadBalancingV2::TargetGroup",
@aws-cdk/aws-ecs-patterns:         "Properties": {
@aws-cdk/aws-ecs-patterns:           "Port": 80,
@aws-cdk/aws-ecs-patterns:           "Protocol": "TCP",
@aws-cdk/aws-ecs-patterns:           "TargetType": "ip",
@aws-cdk/aws-ecs-patterns:           "VpcId": {
@aws-cdk/aws-ecs-patterns:             "Ref": "VPCB9E5F0B4"
@aws-cdk/aws-ecs-patterns:           }
@aws-cdk/aws-ecs-patterns:         }
@aws-cdk/aws-ecs-patterns:       }
@aws-cdk/aws-ecs-patterns:     with the following mismatches:
@aws-cdk/aws-ecs-patterns:     	Expected 81 but received 80 at /Properties/Port (using objectLike matcher)
@aws-cdk/aws-ecs-patterns:       83 |     const matchError = hasResourceProperties(this.template, type, props);
@aws-cdk/aws-ecs-patterns:       84 |     if (matchError) {
@aws-cdk/aws-ecs-patterns:     > 85 |       throw new Error(matchError);
@aws-cdk/aws-ecs-patterns:          |             ^
@aws-cdk/aws-ecs-patterns:       86 |     }
@aws-cdk/aws-ecs-patterns:       87 |   }
@aws-cdk/aws-ecs-patterns:       88 |
@aws-cdk/aws-ecs-patterns:       at Template.hasResourceProperties (../assertions/lib/template.ts:85:13)
@aws-cdk/aws-ecs-patterns:       at fn (test/fargate/load-balanced-fargate-service-v2.test.ts:709:31)
@aws-cdk/aws-ecs-patterns:       at Object.<anonymous> (../../../tools/@aws-cdk/cdk-build-tools/lib/feature-flag.ts:34:35)
@aws-cdk/aws-ecs-patterns:   � When Network Load Balancer › test Fargate multinetworkloadbalanced construct uses custom Port for target group when feature flag is enabled
@aws-cdk/aws-ecs-patterns:     Template has 2 resources with type AWS::ElasticLoadBalancingV2::TargetGroup, but none match as expected.
@aws-cdk/aws-ecs-patterns:     The closest result is:
@aws-cdk/aws-ecs-patterns:       {
@aws-cdk/aws-ecs-patterns:         "Type": "AWS::ElasticLoadBalancingV2::TargetGroup",
@aws-cdk/aws-ecs-patterns:         "Properties": {
@aws-cdk/aws-ecs-patterns:           "Port": 80,
@aws-cdk/aws-ecs-patterns:           "Protocol": "TCP",
@aws-cdk/aws-ecs-patterns:           "TargetType": "ip",
@aws-cdk/aws-ecs-patterns:           "VpcId": {
@aws-cdk/aws-ecs-patterns:             "Ref": "VPCB9E5F0B4"
@aws-cdk/aws-ecs-patterns:           }
@aws-cdk/aws-ecs-patterns:         }
@aws-cdk/aws-ecs-patterns:       }
@aws-cdk/aws-ecs-patterns:     with the following mismatches:
@aws-cdk/aws-ecs-patterns:     	Expected 81 but received 80 at /Properties/Port (using objectLike matcher)
@aws-cdk/aws-ecs-patterns:       83 |     const matchError = hasResourceProperties(this.template, type, props);
@aws-cdk/aws-ecs-patterns:       84 |     if (matchError) {
@aws-cdk/aws-ecs-patterns:     > 85 |       throw new Error(matchError);
@aws-cdk/aws-ecs-patterns:          |             ^
@aws-cdk/aws-ecs-patterns:       86 |     }
@aws-cdk/aws-ecs-patterns:       87 |   }
@aws-cdk/aws-ecs-patterns:       88 |
@aws-cdk/aws-ecs-patterns:       at Template.hasResourceProperties (../assertions/lib/template.ts:85:13)
@aws-cdk/aws-ecs-patterns:       at fn (test/fargate/load-balanced-fargate-service-v2.test.ts:823:31)
@aws-cdk/aws-ecs-patterns:       at Object.<anonymous> (../../../tools/@aws-cdk/cdk-build-tools/lib/feature-flag.ts:34:35)
```

</details>


----

### All Submissions:

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

### Adding new Unconventional Dependencies:

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

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/master/INTEGRATION_TESTS.md)?
	* [ ] 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*
wphilipw pushed a commit to wphilipw/aws-cdk that referenced this pull request May 23, 2022
…ontainer port for target group port (aws#20284)

PR aws#18157 results in a new TargetGroup being created from NetworkLoadBalancedEc2Service, NetworkLoadBalancedFargateService, NetworkMultipleTargetGroupsEc2Service,
and NetworkMultipleTargerGroupsFargateService even when no change is made because we are now passing through the containerPort props to TargetGroups's Port.

For existing services, this is a breaking change so a feature flag is needed. This PR adds that feature flag.

Closes aws#19411.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
wphilipw pushed a commit to wphilipw/aws-cdk that referenced this pull request May 23, 2022
… passing container port for target group port (aws#20284)" (aws#20430)

This reverts aws#20284 since its tests fail to pass in CDK v2, blocking the next CDK release. The root cause of failure looks as though it may be the same as aws#20427 - I've included the test logs below:

<details>

```
@aws-cdk/aws-ecs-patterns: FAIL test/fargate/load-balanced-fargate-service-v2.test.js (11.703 s)
@aws-cdk/aws-ecs-patterns:   � When Network Load Balancer › Fargate networkloadbalanced construct uses custom Port for target group when feature flag is enabled
@aws-cdk/aws-ecs-patterns:     Template has 1 resources with type AWS::ElasticLoadBalancingV2::TargetGroup, but none match as expected.
@aws-cdk/aws-ecs-patterns:     The closest result is:
@aws-cdk/aws-ecs-patterns:       {
@aws-cdk/aws-ecs-patterns:         "Type": "AWS::ElasticLoadBalancingV2::TargetGroup",
@aws-cdk/aws-ecs-patterns:         "Properties": {
@aws-cdk/aws-ecs-patterns:           "Port": 80,
@aws-cdk/aws-ecs-patterns:           "Protocol": "TCP",
@aws-cdk/aws-ecs-patterns:           "TargetType": "ip",
@aws-cdk/aws-ecs-patterns:           "VpcId": {
@aws-cdk/aws-ecs-patterns:             "Ref": "VPCB9E5F0B4"
@aws-cdk/aws-ecs-patterns:           }
@aws-cdk/aws-ecs-patterns:         }
@aws-cdk/aws-ecs-patterns:       }
@aws-cdk/aws-ecs-patterns:     with the following mismatches:
@aws-cdk/aws-ecs-patterns:     	Expected 81 but received 80 at /Properties/Port (using objectLike matcher)
@aws-cdk/aws-ecs-patterns:       83 |     const matchError = hasResourceProperties(this.template, type, props);
@aws-cdk/aws-ecs-patterns:       84 |     if (matchError) {
@aws-cdk/aws-ecs-patterns:     > 85 |       throw new Error(matchError);
@aws-cdk/aws-ecs-patterns:          |             ^
@aws-cdk/aws-ecs-patterns:       86 |     }
@aws-cdk/aws-ecs-patterns:       87 |   }
@aws-cdk/aws-ecs-patterns:       88 |
@aws-cdk/aws-ecs-patterns:       at Template.hasResourceProperties (../assertions/lib/template.ts:85:13)
@aws-cdk/aws-ecs-patterns:       at fn (test/fargate/load-balanced-fargate-service-v2.test.ts:709:31)
@aws-cdk/aws-ecs-patterns:       at Object.<anonymous> (../../../tools/@aws-cdk/cdk-build-tools/lib/feature-flag.ts:34:35)
@aws-cdk/aws-ecs-patterns:   � When Network Load Balancer › test Fargate multinetworkloadbalanced construct uses custom Port for target group when feature flag is enabled
@aws-cdk/aws-ecs-patterns:     Template has 2 resources with type AWS::ElasticLoadBalancingV2::TargetGroup, but none match as expected.
@aws-cdk/aws-ecs-patterns:     The closest result is:
@aws-cdk/aws-ecs-patterns:       {
@aws-cdk/aws-ecs-patterns:         "Type": "AWS::ElasticLoadBalancingV2::TargetGroup",
@aws-cdk/aws-ecs-patterns:         "Properties": {
@aws-cdk/aws-ecs-patterns:           "Port": 80,
@aws-cdk/aws-ecs-patterns:           "Protocol": "TCP",
@aws-cdk/aws-ecs-patterns:           "TargetType": "ip",
@aws-cdk/aws-ecs-patterns:           "VpcId": {
@aws-cdk/aws-ecs-patterns:             "Ref": "VPCB9E5F0B4"
@aws-cdk/aws-ecs-patterns:           }
@aws-cdk/aws-ecs-patterns:         }
@aws-cdk/aws-ecs-patterns:       }
@aws-cdk/aws-ecs-patterns:     with the following mismatches:
@aws-cdk/aws-ecs-patterns:     	Expected 81 but received 80 at /Properties/Port (using objectLike matcher)
@aws-cdk/aws-ecs-patterns:       83 |     const matchError = hasResourceProperties(this.template, type, props);
@aws-cdk/aws-ecs-patterns:       84 |     if (matchError) {
@aws-cdk/aws-ecs-patterns:     > 85 |       throw new Error(matchError);
@aws-cdk/aws-ecs-patterns:          |             ^
@aws-cdk/aws-ecs-patterns:       86 |     }
@aws-cdk/aws-ecs-patterns:       87 |   }
@aws-cdk/aws-ecs-patterns:       88 |
@aws-cdk/aws-ecs-patterns:       at Template.hasResourceProperties (../assertions/lib/template.ts:85:13)
@aws-cdk/aws-ecs-patterns:       at fn (test/fargate/load-balanced-fargate-service-v2.test.ts:823:31)
@aws-cdk/aws-ecs-patterns:       at Object.<anonymous> (../../../tools/@aws-cdk/cdk-build-tools/lib/feature-flag.ts:34:35)
```

</details>


----

### All Submissions:

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

### Adding new Unconventional Dependencies:

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

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/master/INTEGRATION_TESTS.md)?
	* [ ] 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*
TheRealAmazonKendra added a commit that referenced this pull request Jul 6, 2022
…ontainer port for target group port

This re-implements #20284, which was reverted in #20430 due to the feature flag tests.

PR #18157 results in a new TargetGroup being created from NetworkLoadBalancedEc2Service, NetworkLoadBalancedFargateService, NetworkMultipleTargetGroupsEc2Service,
and NetworkMultipleTargerGroupsFargateService even when no change is made because we are now passing through the containerPort props to TargetGroups's Port.

For existing services, this is a breaking change so a feature flag is needed. This PR adds that feature flag.

Closes #19411.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. contribution/core This is a PR that came from AWS. effort/small Small work item – less than a day of effort p1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(ecs-patterns): unnecessary breaking target group port change introduced after upgrading cdk
3 participants