lib/hako/schedulers/ecs.rb in hako-2.5.1 vs lib/hako/schedulers/ecs.rb in hako-2.6.0
- old
+ new
@@ -43,11 +43,13 @@
if @network_mode == 'awsvpc' && @ecs_elb_v2_options
# awsvpc network mode requires ELB target group with target_type=ip
@ecs_elb_v2_options['target_type'] = 'ip'
end
@dynamic_port_mapping = options.fetch('dynamic_port_mapping', @ecs_elb_options.nil?)
- @health_check_grace_period_seconds = options.fetch('health_check_grace_period_seconds', nil)
+ @health_check_grace_period_seconds = options.fetch('health_check_grace_period_seconds') do
+ @ecs_elb_options || @ecs_elb_v2_options ? 0 : nil
+ end
if options.key?('autoscaling')
@autoscaling = EcsAutoscaling.new(options.fetch('autoscaling'), @region, ecs_elb_client, dry_run: @dry_run)
end
@autoscaling_group_for_oneshot = options.fetch('autoscaling_group_for_oneshot', nil)
@autoscaling_topic_for_oneshot = options.fetch('autoscaling_topic_for_oneshot', nil)
@@ -301,13 +303,10 @@
ecs_client.update_service(cluster: service.cluster_arn, service: service.service_arn, desired_count: 0)
end
ecs_client.delete_service(cluster: service.cluster_arn, service: service.service_arn)
Hako.logger.info "#{service.service_arn} is deleted"
end
- if @autoscaling
- @autoscaling.remove(service)
- end
else
puts "Service #{@app_id} doesn't exist"
end
ecs_elb_client.destroy
@@ -597,10 +596,10 @@
cpu: container.cpu,
memory: container.memory,
memory_reservation: container.memory_reservation,
links: container.links,
port_mappings: container.port_mappings,
- essential: true,
+ essential: container.essential,
environment: environment,
secrets: container.secrets,
docker_labels: container.docker_labels,
mount_points: container.mount_points,
command: container.command,