Skip to content

Commit

Permalink
Merge pull request #31 from rererecursive/master
Browse files Browse the repository at this point in the history
Don't set DesiredCount when using the daemon scheduling strategy.
  • Loading branch information
Guslington authored Jul 17, 2019
2 parents e8c669c + a05f177 commit de2f87d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ecs-service.cfndsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -364,16 +364,18 @@
desired_count = desired
end

strategy = defined?(scheduling_strategy) ? scheduling_strategy : nil

ECS_Service('Service') do
Cluster Ref("EcsCluster")
Property("HealthCheckGracePeriodSeconds", health_check_grace_period) if defined? health_check_grace_period
DesiredCount Ref('DesiredCount')
DesiredCount Ref('DesiredCount') if strategy != 'DAEMON'
DeploymentConfiguration ({
MinimumHealthyPercent: Ref('MinimumHealthyPercent'),
MaximumPercent: Ref('MaximumPercent')
})
TaskDefinition Ref('Task')
SchedulingStrategy scheduling_strategy if defined? scheduling_strategy
SchedulingStrategy scheduling_strategy if !strategy.nil?

if service_loadbalancer.any?
Role Ref('Role') unless awsvpc_enabled
Expand Down
14 changes: 14 additions & 0 deletions tests/scheduling-strategy-daemon.test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
test_metadata:
type: config
name: ecs service with daemon scheduling
description: Creates an ECS service with the daemon scheduling strategy

scheduling_strategy: DAEMON

task_definition:
sftp:
image: nginx
tag: latest
privileged: true
ports:
- 80
12 changes: 12 additions & 0 deletions tests/scheduling-strategy-default.test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
test_metadata:
type: config
name: ecs service with replica scheduling
description: Creates an ECS service with the default (replica) scheduling strategy

task_definition:
sftp:
image: nginx
tag: latest
privileged: true
ports:
- 80

0 comments on commit de2f87d

Please sign in to comment.