Sha256: 998db265a25e93a634a794e3e6582aeb9b1ac9c772b8ae93b6d94a1984fb1a4a

Contents?: true

Size: 1020 Bytes

Versions: 18

Compression:

Stored size: 1020 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(resource_name, options)
    kubeconfig_path    = KuberKit.current_configuration.kubeconfig_path
    kubectl_entrypoint = KuberKit.current_configuration.kubectl_entrypoint
    deployer_namespace = KuberKit.current_configuration.deployer_namespace

    if !resource_name 
      resource_name  = resource_selector.call("attach", additional_resources: [
        KuberKit::Kubernetes::Resources::POD,
        KuberKit::Kubernetes::Resources::JOB
      ])
    end

    kubectl_commands.exec(
      local_shell, resource_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

18 entries across 18 versions & 1 rubygems

Version Path
kuber_kit-1.3.9 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-1.3.8 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-1.3.7 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-1.1.8 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-1.3.6 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-1.1.7 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-1.3.5 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-1.3.4 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-1.1.6 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-1.3.3 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-1.3.2 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-1.1.5 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-1.3.1 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-1.3.0 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-1.2.7 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-1.2.6 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-1.2.5 lib/kuber_kit/actions/kubectl_attacher.rb
kuber_kit-1.2.4 lib/kuber_kit/actions/kubectl_attacher.rb