-
Notifications
You must be signed in to change notification settings - Fork 4k
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): handle desired task count being set to 0 #4722
Conversation
Thanks so much for taking the time to contribute to the AWS CDK ❤️ We will shortly assign someone to review this pull request and help get it
|
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
@pkandasamy91 Your title is incorrect, this PR doesn't only cover |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking the time to make this change. I don't think this follows the best practices for all patterns, and have added a couple comments
packages/@aws-cdk/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts
Outdated
Show resolved
Hide resolved
packages/@aws-cdk/aws-ecs-patterns/lib/base/queue-processing-service-base.ts
Outdated
Show resolved
Hide resolved
packages/@aws-cdk/aws-ecs-patterns/lib/base/network-load-balanced-service-base.ts
Outdated
Show resolved
Hide resolved
@pkandasamy91 We don't have to allow 0, seeing the anti-patterns you described in the issue. This problem now is that is user isn't aware that they are not able to set a capacity to 0, and the CDK will silently bump it to 1. The way I see it, we can go about it two ways:
What do you think? |
I definitely agree we need a way to notify users. I like the idea of adding to the documentation and throwing an exception. With a warning, it could easily be missed. |
Pull request has been modified.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
@pkandasamy91 I also missed Should we allow it like SQS, or throw like ALB/NLB? |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
I can't see a use case where a user would schedule a task to kick off with 0 desiredCount. For the time being I'm leaning towards throwing an exception. If a use case arises it can be changed after the fact as it wouldn't be a breaking change. |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Please also add a note in your description for what the expected behaviour of each construct is (which ones throw vs which ones allow) |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
packages/@aws-cdk/aws-ecs-patterns/lib/base/queue-processing-service-base.ts
Show resolved
Hide resolved
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Pull request has been modified.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking the time to resolve this issue, and for addressing all of the feedback!
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request is now being automatically merged. |
Allow desired task count to be set to
0
for the following (defaults to1
when the property isundefined
):QueueProcessingServiceBase.desiredTaskCount
property, affects:QueueProcessingEc2Service
QueueProcessingFargateService
Note: If desired task count is set to 0, maxScalingCapacity must be defined with a value greater than 0.
Throw exception when desired task count is set to
0
for the following (defaults to1
when the property isundefined
):ApplicationLoadBalancedServiceBase.desiredCount
property, affects:ApplicationLoadBalancedEc2Service
ApplicationLoadBalancedFargateService
NetworkLoadBalancedServiceBase.desiredCount
property, affects:NetworkLoadBalancedEc2Service
NetworkLoadBalancedFargateService
ScheduledTaskBase.desiredTaskCount
property, affects:ScheduledEc2Task
ScheduledFargateTask
Fixes #4719
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license