Sha256: 9664b3d21d60e12d6d2b959e932dc47175c0f7b3ea416da094ec453d47c3602b

Contents?: true

Size: 1.02 KB

Versions: 27

Compression:

Stored size: 1.02 KB

Contents

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

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

    args = nil
    if options[:follow]
      args = "-f"
    end

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

27 entries across 27 versions & 1 rubygems

Version Path
kuber_kit-1.1.2 lib/kuber_kit/actions/kubectl_describe.rb
kuber_kit-1.2.1 lib/kuber_kit/actions/kubectl_describe.rb
kuber_kit-1.2.0 lib/kuber_kit/actions/kubectl_describe.rb
kuber_kit-1.1.1 lib/kuber_kit/actions/kubectl_describe.rb
kuber_kit-1.0.1 lib/kuber_kit/actions/kubectl_describe.rb
kuber_kit-1.0.0 lib/kuber_kit/actions/kubectl_describe.rb
kuber_kit-0.9.9 lib/kuber_kit/actions/kubectl_describe.rb