Sha256: 95b6d792b95c99ae06ccb23fd70e6b10303c039204149744f63506af97efcc72

Contents?: true

Size: 786 Bytes

Versions: 5

Compression:

Stored size: 786 Bytes

Contents

class KuberKit::Actions::KubectlLogs
  include KuberKit::Import[
    "shell.kubectl_commands",
    "shell.local_shell",
    "kubernetes.resources_fetcher",
    "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 = resources_fetcher.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

5 entries across 5 versions & 1 rubygems

Version Path
kuber_kit-0.5.0 lib/kuber_kit/actions/kubectl_logs.rb
kuber_kit-0.4.9 lib/kuber_kit/actions/kubectl_logs.rb
kuber_kit-0.4.8 lib/kuber_kit/actions/kubectl_logs.rb
kuber_kit-0.4.7 lib/kuber_kit/actions/kubectl_logs.rb
kuber_kit-0.4.6 lib/kuber_kit/actions/kubectl_logs.rb