Skip to content

Commit

Permalink
Merge pull request #17042 from carbonin/stop_container_worker
Browse files Browse the repository at this point in the history
Stop container workers cleanly
  • Loading branch information
bdunne authored Feb 26, 2018
2 parents d3f7348 + 6f52ccb commit 136ca2b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/models/miq_server/worker_management/monitor/quiesce.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ def quiesce_workers_loop
@quiesce_loop_timeout = @worker_monitor_settings[:quiesce_loop_timeout] || 5.minutes
worker_monitor_poll = (@worker_monitor_settings[:poll] || 1.seconds).to_i_with_method

miq_workers.each { |w| stop_worker(w) }
miq_workers.each do |w|
MiqEnvironment::Command.is_podified? && w.containerized_worker? ? w.delete_container_objects : stop_worker(w)
end

loop do
reload # Reload from SQL this MiqServer AND its miq_workers association
break if self.workers_quiesced?
Expand Down
8 changes: 8 additions & 0 deletions lib/container_orchestrator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,26 @@ def delete_deployment_config(name)
scale(name, 0)
connection.delete_deployment_config(name, my_namespace)
delete_replication_controller(rc.metadata.name) if rc
rescue KubeException => e
raise unless e.message =~ /not found/
end

def delete_replication_controller(name)
kube_connection.delete_replication_controller(name, my_namespace)
rescue KubeException => e
raise unless e.message =~ /not found/
end

def delete_service(name)
kube_connection.delete_service(name, my_namespace)
rescue KubeException => e
raise unless e.message =~ /not found/
end

def delete_secret(name)
kube_connection.delete_secret(name, my_namespace)
rescue KubeException => e
raise unless e.message =~ /not found/
end

private
Expand Down

0 comments on commit 136ca2b

Please sign in to comment.