Sha256: f3a9cc91caec5f7e121eea24da5c0b3a5c4e7ffa387beeab0c7308b5fa46408d

Contents?: true

Size: 786 Bytes

Versions: 44

Compression:

Stored size: 786 Bytes

Contents

class KuberKit::Actions::KubectlLogs
  include KuberKit::Import[
    "shell.kubectl_commands",
    "shell.local_shell",
    "kubernetes.resource_selector",
    "ui"
  ]

  Contract Maybe[String], Hash => Any
  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
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
kuber_kit-0.5.4 lib/kuber_kit/actions/kubectl_logs.rb
kuber_kit-0.5.3 lib/kuber_kit/actions/kubectl_logs.rb
kuber_kit-0.5.2 lib/kuber_kit/actions/kubectl_logs.rb
kuber_kit-0.5.1 lib/kuber_kit/actions/kubectl_logs.rb