class JamesBond::MissionKubernetes::ServerHandler
Attributes
config[RW]
Public Class Methods
new(command, config)
click to toggle source
# File lib/james_bond/mission_kubernetes/server_handler.rb, line 9 def initialize(command, config) @command = command @config = config.for(env: command.env, command: command.main_command) end
Public Instance Methods
run()
click to toggle source
# File lib/james_bond/mission_kubernetes/server_handler.rb, line 14 def run tag = @command.options["tag"] app_name = @config["app_name"] image = @config["image_name"] deploy = "#{app_name}-#{Time.now.to_i}" command = [ "kubectl run #{deploy}", "--image=#{image}:#{tag}", "--restart=Never", "--attach --rm" ].join(" ") Open3.popen3(command) do |stdin, stdout, stderr, thread| Thread.new do until (line = stdout.gets).nil? do puts line end end thread.join end end