Class: Kubectl::Exec
- Inherits:
-
Object
- Object
- Kubectl::Exec
- Extended by:
- Forwardable
- Defined in:
- lib/kuberun/kubectl/exec.rb
Overview
Handles running kubectl exec
Instance Method Summary collapse
- #exec(pod, options) ⇒ Object
-
#initialize(kubectl) ⇒ Exec
constructor
A new instance of Exec.
Constructor Details
#initialize(kubectl) ⇒ Exec
Returns a new instance of Exec.
13 14 15 |
# File 'lib/kuberun/kubectl/exec.rb', line 13 def initialize(kubectl) @kubectl = kubectl end |
Instance Method Details
#exec(pod, options) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/kuberun/kubectl/exec.rb', line 17 def exec(pod, ) command = "#{kubectl_base_command('exec', resource: pod)} -it -- #{['cluster-command']}" if ['pty'] old_state = `stty -g` PTY.spawn(command) do |out, inp, pid| pty_process(out, inp, pid, old_state) end else system(command) end end |