class KBE::CLI::ListCommand

Public Instance Methods

execute() click to toggle source
# File lib/kbe/cli/list_command.rb, line 15
def execute
  if selector
    pod = KBE.pod_by(selector, only_running: false)
    json = JSON.parse(`kubectl get pod #{pod} -o json`)
    for container in json["spec"]["containers"]
      puts container["name"]
    end
  else
    KBE.kubectl ["get pod"]
  end
rescue JSON::ParserError
end