lib/vidar/cli.rb in vidar-0.8.2 vs lib/vidar/cli.rb in vidar-0.9.0
- old
+ new
@@ -136,11 +136,11 @@
slack_notification.failure if slack_notification.configured?
exit(1)
end
end
- desc "kube_exec", "Execute given command in running pod"
+ desc "kube_exec", "Execute given command in the first running pod"
method_option :command, default: "/bin/sh"
method_option :name, required: false
def kube_exec
Log.info "Current kubectl context: #{Config.get!(:kubectl_context)}"
@@ -161,8 +161,15 @@
container = containers.first
Log.info "Running #{options[:command]} in #{container.pod_name}"
Run.kubectl("exec -it #{container.pod_name} -- #{options[:command]}")
end
+ end
+
+ desc "console", "Execute console command in the first running pod"
+ method_option :command, required: false
+ method_option :name, required: false
+ def console
+ invoke :kube_exec, name: options[:name], command: options[:command] || Config.get!(:kubectl_context)
end
end
end