Skip to content

Commit

Permalink
chore(ecs): undeprecate Cluster.addCapacity (#17652)
Browse files Browse the repository at this point in the history
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*
  • Loading branch information
njlynch authored Nov 23, 2021
1 parent b45be32 commit 765c274
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
1 change: 0 additions & 1 deletion DEPRECATED_APIs.md
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,6 @@
| @aws-cdk/aws-ecs | BaseService.​configureAwsVpcNetworking() | use configureAwsVpcNetworkingWithSecurityGroups instead. |
| @aws-cdk/aws-ecs | BaseServiceOptions.​propagateTaskTagsFrom | Use `propagateTags` instead. |
| @aws-cdk/aws-ecs | Cluster.​addAutoScalingGroup() | Use {@link Cluster.addAsgCapacityProvider} instead. |
| @aws-cdk/aws-ecs | Cluster.​addCapacity() | Use {@link Cluster.addAsgCapacityProvider} instead. |
| @aws-cdk/aws-ecs | Cluster.​addCapacityProvider() | Use {@link enableFargateCapacityProviders} instead. |
| @aws-cdk/aws-ecs | ClusterProps.​capacityProviders | Use {@link ClusterProps.enableFargateCapacityProviders} instead. |
| @aws-cdk/aws-ecs | Ec2ServiceProps.​securityGroup | use securityGroups instead. |
Expand Down
1 change: 0 additions & 1 deletion deprecated_apis.txt
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,6 @@ constructs.Node#uniqueId
@aws-cdk/aws-ecs.BaseService#configureAwsVpcNetworking
@aws-cdk/aws-ecs.BaseServiceOptions#propagateTaskTagsFrom
@aws-cdk/aws-ecs.Cluster#addAutoScalingGroup
@aws-cdk/aws-ecs.Cluster#addCapacity
@aws-cdk/aws-ecs.Cluster#addCapacityProvider
@aws-cdk/aws-ecs.ClusterProps#capacityProviders
@aws-cdk/aws-ecs.Ec2ServiceProps#securityGroup
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-ecs/lib/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,11 @@ export class Cluster extends Resource implements ICluster {
}

/**
* It is highly recommended to use {@link Cluster.addAsgCapacityProvider} instead of this method.
*
* This method adds compute capacity to a cluster by creating an AutoScalingGroup with the specified options.
*
* Returns the AutoScalingGroup so you can add autoscaling settings to it.
*
* @deprecated Use {@link Cluster.addAsgCapacityProvider} instead.
*/
public addCapacity(id: string, options: AddCapacityOptions): autoscaling.AutoScalingGroup {
// Do 2-way defaulting here: if the machineImageType is BOTTLEROCKET, pick the right AMI.
Expand Down

0 comments on commit 765c274

Please sign in to comment.