Class: TrainPlugins::TrainKubernetes::KubectlClient

Inherits:
Object
  • Object
show all
Defined in:
lib/train-kubernetes/kubectl_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pod:, container: nil) ⇒ KubectlClient

Returns a new instance of KubectlClient.



7
8
9
10
# File 'lib/train-kubernetes/kubectl_client.rb', line 7

def initialize(pod:, container: nil)
  @pod = pod
  @container = container
end

Instance Attribute Details

#containerObject (readonly)

Returns the value of attribute container.



6
7
8
# File 'lib/train-kubernetes/kubectl_client.rb', line 6

def container
  @container
end

#podObject (readonly)

Returns the value of attribute pod.



6
7
8
# File 'lib/train-kubernetes/kubectl_client.rb', line 6

def pod
  @pod
end

Instance Method Details

#execute(command, stdin: true, tty: true) ⇒ Object



12
13
14
15
16
# File 'lib/train-kubernetes/kubectl_client.rb', line 12

def execute(command, stdin: true, tty: true)
  instruction = build_instruction(command, stdin, tty)
  shell = Mixlib::ShellOut.new(instruction)
  shell.run_command
end