Skip to content

Commit 1af4e2e

Browse files
committed
fix(aws-ecs): update desired count to be optional
1 parent a4934be commit 1af4e2e

18 files changed

+7
-50
lines changed

packages/@aws-cdk/aws-ecs/lib/base/base-service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ export interface BaseServiceOptions {
105105
/**
106106
* The desired number of instantiations of the task definition to keep running on the service.
107107
*
108-
* @default 1
108+
* @default - When creating the service, default is 1; when updating the service, default uses
109+
* the current task number.
109110
*/
110111
readonly desiredCount?: number;
111112

packages/@aws-cdk/aws-ecs/lib/ec2/ec2-service.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,7 @@ export class Ec2Service extends BaseService implements IEc2Service {
186186

187187
super(scope, id, {
188188
...props,
189-
// If daemon, desiredCount must be undefined and that's what we want. Otherwise, default to 1.
190-
desiredCount: props.daemon || props.desiredCount !== undefined ? props.desiredCount : 1,
189+
desiredCount: props.desiredCount,
191190
maxHealthyPercent: props.daemon && props.maxHealthyPercent === undefined ? 100 : props.maxHealthyPercent,
192191
minHealthyPercent: props.daemon && props.minHealthyPercent === undefined ? 0 : props.minHealthyPercent,
193192
launchType: LaunchType.EC2,

packages/@aws-cdk/aws-ecs/lib/fargate/fargate-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export class FargateService extends BaseService implements IFargateService {
152152

153153
super(scope, id, {
154154
...props,
155-
desiredCount: props.desiredCount !== undefined ? props.desiredCount : 1,
155+
desiredCount: props.desiredCount,
156156
launchType: LaunchType.FARGATE,
157157
propagateTags: propagateTagsFromSource,
158158
enableECSManagedTags: props.enableECSManagedTags,

packages/@aws-cdk/aws-ecs/test/ec2/integ.app-mesh-proxy-config.expected.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,7 @@
867867
},
868868
{
869869
"Essential": true,
870-
"Image": "envoyproxy/envoy",
870+
"Image": "envoyproxy/envoy:v1.16.2",
871871
"Memory": 256,
872872
"Name": "envoy"
873873
}
@@ -923,7 +923,6 @@
923923
"MaximumPercent": 200,
924924
"MinimumHealthyPercent": 50
925925
},
926-
"DesiredCount": 1,
927926
"EnableECSManagedTags": false,
928927
"LaunchType": "EC2",
929928
"NetworkConfiguration": {

packages/@aws-cdk/aws-ecs/test/ec2/integ.app-mesh-proxy-config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ taskDefinition.addContainer('web', {
3636
});
3737

3838
taskDefinition.addContainer('envoy', {
39-
image: ecs.ContainerImage.fromRegistry('envoyproxy/envoy'),
39+
// envoyproxy/envoy:latest tag gone from docker hub: https://github.com/envoyproxy/envoy/issues/6344
40+
image: ecs.ContainerImage.fromRegistry('envoyproxy/envoy:v1.16.2'),
4041
memoryLimitMiB: 256,
4142
});
4243

packages/@aws-cdk/aws-ecs/test/ec2/integ.clb-host-nw.expected.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,6 @@
918918
"MaximumPercent": 200,
919919
"MinimumHealthyPercent": 50
920920
},
921-
"DesiredCount": 1,
922921
"EnableECSManagedTags": false,
923922
"HealthCheckGracePeriodSeconds": 60,
924923
"LaunchType": "EC2",

packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.expected.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1285,7 +1285,6 @@
12851285
"MaximumPercent": 200,
12861286
"MinimumHealthyPercent": 50
12871287
},
1288-
"DesiredCount": 1,
12891288
"EnableECSManagedTags": false,
12901289
"LaunchType": "EC2",
12911290
"NetworkConfiguration": {

packages/@aws-cdk/aws-ecs/test/ec2/integ.firelens-s3-config.expected.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,6 @@
11331133
"MaximumPercent": 200,
11341134
"MinimumHealthyPercent": 50
11351135
},
1136-
"DesiredCount": 1,
11371136
"EnableECSManagedTags": false,
11381137
"LaunchType": "EC2",
11391138
"NetworkConfiguration": {

packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-awsvpc-nw.expected.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,6 @@
895895
"MaximumPercent": 200,
896896
"MinimumHealthyPercent": 50
897897
},
898-
"DesiredCount": 1,
899898
"EnableECSManagedTags": false,
900899
"HealthCheckGracePeriodSeconds": 60,
901900
"LaunchType": "EC2",

packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-bridge-nw.expected.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,6 @@
917917
"MaximumPercent": 200,
918918
"MinimumHealthyPercent": 50
919919
},
920-
"DesiredCount": 1,
921920
"EnableECSManagedTags": false,
922921
"HealthCheckGracePeriodSeconds": 60,
923922
"LaunchType": "EC2",

0 commit comments

Comments
 (0)