lib/hako/schedulers/ecs.rb in hako-1.4.0 vs lib/hako/schedulers/ecs.rb in hako-1.5.0
- old
+ new
@@ -65,10 +65,11 @@
print_definition_in_cli_format(d)
end
if @autoscaling
@autoscaling.apply(Aws::ECS::Types::Service.new(cluster_arn: @cluster, service_name: @app_id))
end
+ ecs_elb_client.modify_attributes
else
current_service = describe_service
task_definition_changed, task_definition = register_task_definition(definitions)
if task_definition_changed
Hako.logger.info "Registered task definition: #{task_definition.task_definition_arn}"
@@ -82,15 +83,17 @@
if service == :noop
Hako.logger.info "Service isn't changed"
if @autoscaling
@autoscaling.apply(current_service)
end
+ ecs_elb_client.modify_attributes
else
Hako.logger.info "Updated service: #{service.service_arn}"
if @autoscaling
@autoscaling.apply(service)
end
+ ecs_elb_client.modify_attributes
unless wait_for_ready(service)
if task_definition_changed
Hako.logger.error("Rolling back to #{current_service.task_definition}")
update_service(service, current_service.task_definition)
ecs_client.deregister_task_definition(task_definition: service.task_definition)
@@ -633,9 +636,14 @@
object = s3.get_object(bucket: uri.host, key: started_key)
rescue Aws::S3::Errors::NoSuchKey
Hako.logger.debug(" s3://#{uri.host}/#{started_key} doesn't exist")
else
json = JSON.parse(object.body.read)
+ arn = json['detail']['containerInstanceArn']
+ if @container_instance_arn != arn
+ @container_instance_arn = arn
+ report_container_instance(@container_instance_arn)
+ end
@started_at = Time.parse(json['detail']['startedAt'])
if @started_at
Hako.logger.info "Started at #{@started_at}"
end
end