Sha256: f17f245146e34e32630e00d2c0b89d649e8c40808ca0ec25115a673f358f768c

Contents?: true

Size: 1.04 KB

Versions: 16

Compression:

Stored size: 1.04 KB

Contents

#
module MKIt
  class PodWorker < AWorker

    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

    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

  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
mkit-0.9.0 lib/mkit/workers/pod_worker.rb
mkit-0.8.0 lib/mkit/workers/pod_worker.rb
mkit-0.7.2 lib/mkit/workers/pod_worker.rb
mkit-0.7.1 lib/mkit/workers/pod_worker.rb
mkit-0.7.0 lib/mkit/workers/pod_worker.rb
mkit-0.6.3 lib/mkit/workers/pod_worker.rb
mkit-0.6.2 lib/mkit/workers/pod_worker.rb
mkit-0.6.1 lib/mkit/workers/pod_worker.rb
mkit-0.6.0 lib/mkit/workers/pod_worker.rb
mkit-0.5.0 lib/mkit/workers/pod_worker.rb
mkit-0.4.3 lib/mkit/workers/pod_worker.rb
mkit-0.4.2 lib/mkit/workers/pod_worker.rb
mkit-0.4.1 lib/mkit/workers/pod_worker.rb
mkit-0.4.0 lib/mkit/workers/pod_worker.rb
mkit-0.3.0 lib/mkit/workers/pod_worker.rb
mkit-0.2.0 lib/mkit/workers/pod_worker.rb