Class: MKIt::PodWorker

Inherits:
AWorker show all
Defined in:
lib/mkit/workers/pod_worker.rb

Instance Method Summary collapse

Methods inherited from AWorker

#initialize

Constructor Details

This class inherits a constructor from MKIt::AWorker

Instance Method Details

#do_the(job) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/mkit/workers/pod_worker.rb', line 13

def do_the(job)
  MKItLogger.info("#{self.class} <#{job.topic}> job #{job.inspect}....")
  pod = Pod.find(job.pod_id) unless job.pod_id.nil?
  case job.topic.to_sym
  when :deploy_pod
    MKItLogger.warn("#{self.class} @deprecated job #{job.inspect}....")
  when :start_pod
    pod.start
  when :stop_pod
    pod.stop
  when :destroy_pod
    pod.stop
    pod.destroy
  when :pod_destroyed
    if Service.exists?(job.service_id)
      MkitJob.publish(topic: :update_proxy_config, service_id: job.service_id)
    end
  when :pod_ip_updated
    MkitJob.publish(topic: :update_proxy_config, service_id: job.service_id)
  else
    MKItLogger.info("#{self.class} <<TODO>> job #{job.inspect}....")
  end
end

#topicsObject



5
6
7
8
9
10
11
# File 'lib/mkit/workers/pod_worker.rb', line 5

def topics
  %w{pod_network_connected pod_network_disconnected
      pod_unhealthy 
      start_pod stop_pod update_pod deploy_pod destroy_pod
      pod_ip_updated pod_destroyed
  }
end