Sha256: b16fceb09b047a926d242baa7381d76e9794c445eb042f03e7d9b629f214e91f

Contents?: true

Size: 753 Bytes

Versions: 5

Compression:

Stored size: 753 Bytes

Contents

class KuberKit::Actions::KubectlAttacher
  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

    kubectl_commands.exec(
      local_shell, pod_name, "bash", args: "-it", 
      kubeconfig_path: kubeconfig_path, 
      interactive: true,
      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_attacher.rb
kuber_kit-0.4.9 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-0.4.8 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-0.4.7 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-0.4.6 lib/kuber_kit/actions/kubectl_attacher.rb