Class: Cloud::Sh::Commands::K8sTail

Inherits:
Base
  • Object
show all
Defined in:
lib/cloud/sh/commands/k8s_tail.rb

Instance Attribute Summary

Attributes inherited from Base

#args, #options

Instance Method Summary collapse

Methods inherited from Base

#config, execute, #initialize

Methods included from Helpers::Commands

#command_chain

Constructor Details

This class inherits a constructor from Cloud::Sh::Commands::Base

Instance Method Details

#commandObject



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/cloud/sh/commands/k8s_tail.rb', line 15

def command
  [
    exe,
    "^" + (options[:pod] == "all" ? "." : options[:pod]),
    "--context #{options[:context]}",
    "--namespace #{options[:namespace]}",
    "--regex",
    "--tail #{options[:tail]}",
    "--since 240h",
    "--colored-output pod",
    "--follow true"
  ].join(" ")
end

#envObject



33
34
35
36
37
# File 'lib/cloud/sh/commands/k8s_tail.rb', line 33

def env
  {
    "KUBECONFIG" => Cloud::Sh::Providers::DigitalOcean.kube_config
  }
end

#exeObject



29
30
31
# File 'lib/cloud/sh/commands/k8s_tail.rb', line 29

def exe
  File.expand_path("../../../../exe/kubetail", __dir__)
end

#executeObject



9
10
11
12
13
# File 'lib/cloud/sh/commands/k8s_tail.rb', line 9

def execute
  puts "Command: #{command}"
  puts "Env: #{env.inspect}\n"
  exec env, command
end