Sha256: 22e7dce9c6d386618bd6f63e763cc10c577cd2632dde9787ef39e9be3ff98b66

Contents?: true

Size: 875 Bytes

Versions: 19

Compression:

Stored size: 875 Bytes

Contents

class KuberKit::Actions::KubectlAttacher
  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
    kubectl_entrypoint = KuberKit.current_configuration.kubectl_entrypoint
    deployer_namespace = KuberKit.current_configuration.deployer_namespace

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

    kubectl_commands.exec(
      local_shell, pod_name, "bash", args: "-it", 
      kubeconfig_path: kubeconfig_path, 
      interactive:  true,
      namespace:    deployer_namespace,
      entrypoint:   kubectl_entrypoint
    )

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

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
kuber_kit-1.1.4 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-1.2.2 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-1.1.2 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-1.2.1 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-1.2.0 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-1.1.1 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-1.0.1 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-1.0.0 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-0.9.9 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-0.9.8 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-0.9.7 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-0.9.6 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-0.9.5 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-0.9.4 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-0.9.3 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-0.9.2 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-0.9.1 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-0.9.0 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-0.8.8 lib/kuber_kit/actions/kubectl_attacher.rb