class KuberKit::Actions::KubectlLogs

Public Instance Methods

call(pod_name, options) click to toggle source
# File lib/kuber_kit/actions/kubectl_logs.rb, line 10
def call(pod_name, options)
  kubeconfig_path = KuberKit.current_configuration.kubeconfig_path
  deployer_namespace = KuberKit.current_configuration.deployer_namespace

  if !pod_name 
    pod_name = resource_selector.call("attach")
  end

  args = nil
  if options[:follow]
    args = "-f"
  end

  kubectl_commands.logs(
    local_shell, pod_name,
    args: args,
    kubeconfig_path: kubeconfig_path, 
    namespace: deployer_namespace
  )

  true
rescue KuberKit::Error => e
  ui.print_error("Error", e.message)
  
  false
end