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

feat(ecs): add support for EC2 Capacity Providers #14386

Merged
merged 10 commits into from
May 12, 2021

Conversation

otterley
Copy link
Contributor

@otterley otterley commented Apr 27, 2021

Add support for EC2 Capacity Providers.

I tried to make the UX reasonably decent without disrupting existing stacks. There are some new types being created here, including ICapacityProvider (interface type) and its concrete type EC2CapacityProvider (which is a class users can instantiate). There are also a couple of singleton classes for FargateCapacityProvider and FargateSpotCapacityProvider.

Closes #5471


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 Apr 27, 2021

@github-actions github-actions bot added the @aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud label Apr 27, 2021
@SoManyHs SoManyHs self-assigned this Apr 28, 2021
@SoManyHs SoManyHs added the @aws-cdk/aws-ecs Related to Amazon Elastic Container label Apr 28, 2021
Copy link
Contributor

@SoManyHs SoManyHs left a comment

Choose a reason for hiding this comment

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

Thanks so much for this contribution! Had a few questions, but otherwise looking really good!

packages/@aws-cdk/aws-ecs/lib/cluster.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ecs/lib/cluster.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ecs/lib/cluster.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ecs/lib/cluster.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ecs/lib/cluster.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ecs/lib/cluster.ts Outdated Show resolved Hide resolved
autoScalingGroupProvider: {
autoScalingGroupArn: this.autoScalingGroup.autoScalingGroupName,
managedScaling: {
status: (props.enableManagedScaling === undefined || props.enableManagedScaling) ? 'ENABLED' : 'DISABLED',
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if enabledManagedScaling is not enabled but the other managedScaling fields are specified in the props? Could we add a test for that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've reworked this code, LMK what you think.

packages/@aws-cdk/aws-ecs/test/ec2/ec2-service.test.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ecs/test/ecs-cluster.test.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ecs/test/ecs-cluster.test.ts Outdated Show resolved Hide resolved
@SoManyHs SoManyHs added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label May 4, 2021
@gitpod-io
Copy link

gitpod-io bot commented May 4, 2021

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label May 5, 2021
@SoManyHs SoManyHs added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label May 5, 2021
@otterley otterley force-pushed the ecs-ec2-capacity-provider branch 3 times, most recently from 1917213 to 7f6597b Compare May 11, 2021 04:03
@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label May 11, 2021
@otterley
Copy link
Contributor Author

@SoManyHs Ready for second review, thanks!

Copy link
Contributor

@SoManyHs SoManyHs left a comment

Choose a reason for hiding this comment

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

Looks great! The high number of comments are mostly renaming EC2 -> Asg as previously discussed -- also a few clarifications on tests.

@@ -496,38 +493,6 @@ scaling.scaleOnRequestCount('RequestScaling', {
Task auto-scaling is powered by *Application Auto-Scaling*.
See that section for details.

## Instance Auto-Scaling
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can keep this section to include the bit on scaling on a metric -- this still applies in the context of ASG capacity providers.

packages/@aws-cdk/aws-ecs/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ecs/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ecs/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ecs/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ecs/test/cluster.test.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ecs/test/cluster.test.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ecs/test/cluster.test.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ecs/test/cluster.test.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ecs/test/cluster.test.ts Outdated Show resolved Hide resolved
@otterley otterley force-pushed the ecs-ec2-capacity-provider branch 4 times, most recently from 5876422 to cfb0453 Compare May 11, 2021 23:26
@otterley otterley force-pushed the ecs-ec2-capacity-provider branch 5 times, most recently from b3fcb11 to b06f7db Compare May 11, 2021 23:36
@otterley
Copy link
Contributor Author

@SoManyHs Ready for the next review pass!

@otterley otterley force-pushed the ecs-ec2-capacity-provider branch from b06f7db to ecc9966 Compare May 12, 2021 19:08
SoManyHs
SoManyHs previously approved these changes May 12, 2021
Copy link
Contributor

@SoManyHs SoManyHs left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks so much! 🚀

@mergify mergify bot dismissed SoManyHs’s stale review May 12, 2021 20:24

Pull request has been modified.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@mergify mergify bot merged commit 114f7cc into aws:master May 12, 2021
@mergify
Copy link
Contributor

mergify bot commented May 12, 2021

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).

hollanddd pushed a commit to hollanddd/aws-cdk that referenced this pull request Aug 26, 2021
Add support for EC2 Capacity Providers.

I tried to make the UX reasonably decent without disrupting existing stacks. There are some new types being created here, including `ICapacityProvider` (interface type) and its concrete type `EC2CapacityProvider` (which is a class users can instantiate). There are also a couple of singleton classes for `FargateCapacityProvider` and `FargateSpotCapacityProvider`.

Closes aws#5471

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
njlynch added a commit that referenced this pull request Nov 23, 2021
The `Cluster.addCapacity` method was deprecated in #14386 as part of the
introduction of `Cluster.addAsgCapacityProvider`. However, the corresponding
`ClusterProps.capacity` property and `AddCapacityOptions` interface were not
deprecated, leading to a confusing mismash of deprecated and undeprecated usage.
The README for ECS still heavily references `Cluster.addCapacity`, further
leading to potential confusion for users just following the module's guidance.

As part of cleaning up deprecated usage as part of the lead-up to the V2 launch,
opting to un-deprecate the `addCapacity` method rather than deprecating the
other two elements and rewriting the README.
mergify bot pushed a commit that referenced this pull request Nov 23, 2021
The `Cluster.addCapacity` method was deprecated in #14386 as part of the
introduction of `Cluster.addAsgCapacityProvider`. However, the corresponding
`ClusterProps.capacity` property and `AddCapacityOptions` interface were not
deprecated, leading to a confusing mismash of deprecated and undeprecated usage.
The README for ECS still heavily references `Cluster.addCapacity`, further
leading to potential confusion for users just following the module's guidance.

As part of cleaning up deprecated usage as part of the lead-up to the V2 launch,
opting to un-deprecate the `addCapacity` method rather than deprecating the
other two elements and rewriting the README.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
mergify bot pushed a commit that referenced this pull request Nov 23, 2021
The `Cluster.addCapacity` method was deprecated in #14386 as part of the
introduction of `Cluster.addAsgCapacityProvider`. However, the corresponding
`ClusterProps.capacity` property and `AddCapacityOptions` interface were not
deprecated, leading to a confusing mismash of deprecated and undeprecated usage.
The README for ECS still heavily references `Cluster.addCapacity`, further
leading to potential confusion for users just following the module's guidance.

As part of cleaning up deprecated usage as part of the lead-up to the V2 launch,
opting to un-deprecate the `addCapacity` method rather than deprecating the
other two elements and rewriting the README.

----

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

(cherry picked from commit 765c274)
beezly pushed a commit to beezly/aws-cdk that referenced this pull request Nov 29, 2021
The `Cluster.addCapacity` method was deprecated in aws#14386 as part of the
introduction of `Cluster.addAsgCapacityProvider`. However, the corresponding
`ClusterProps.capacity` property and `AddCapacityOptions` interface were not
deprecated, leading to a confusing mismash of deprecated and undeprecated usage.
The README for ECS still heavily references `Cluster.addCapacity`, further
leading to potential confusion for users just following the module's guidance.

As part of cleaning up deprecated usage as part of the lead-up to the V2 launch,
opting to un-deprecate the `addCapacity` method rather than deprecating the
other two elements and rewriting the README.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this pull request Feb 21, 2022
The `Cluster.addCapacity` method was deprecated in aws#14386 as part of the
introduction of `Cluster.addAsgCapacityProvider`. However, the corresponding
`ClusterProps.capacity` property and `AddCapacityOptions` interface were not
deprecated, leading to a confusing mismash of deprecated and undeprecated usage.
The README for ECS still heavily references `Cluster.addCapacity`, further
leading to potential confusion for users just following the module's guidance.

As part of cleaning up deprecated usage as part of the lead-up to the V2 launch,
opting to un-deprecate the `addCapacity` method rather than deprecating the
other two elements and rewriting the README.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud @aws-cdk/aws-ecs Related to Amazon Elastic Container
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws-ecs: support capacity provider
4 participants