class Cloud::Sh::Commands::K8sExec
Public Instance Methods
execute()
click to toggle source
# File lib/cloud/sh/commands/k8s_exec.rb, line 9 def execute pod = kubectl.context(options[:context]).namespace(options[:namespace]).get.pod.no_headers(true).map(:name).find do |pod| pod.name.start_with?(options[:pod]) end raise "Cannot find pod." unless pod command = kubectl.context(options[:context]).namespace(options[:namespace]).exec.with(pod.name).stdin(true).tty(true).with(options[:cmd]) puts "Command: #{command}\n" command.replace_current_process end
kubectl()
click to toggle source
# File lib/cloud/sh/commands/k8s_exec.rb, line 19 def kubectl command_chain("kubectl").kubeconfig(Cloud::Sh::Providers::DigitalOcean.kube_config) end