Class: Kitchen::Transport::Kubernetes::Connection
- Inherits:
-
Base::Connection
- Object
- Base::Connection
- Kitchen::Transport::Kubernetes::Connection
show all
- Includes:
- KitchenKubernetes::Helper, ShellOut
- Defined in:
- lib/kitchen/transport/kubernetes.rb
Overview
Instance Method Summary
collapse
#kube_options, #kubectl_command
Instance Method Details
#execute(command) ⇒ Object
57
58
59
60
61
|
# File 'lib/kitchen/transport/kubernetes.rb', line 57
def execute(command)
return if command.nil?
run_command(kubectl_command('exec', '--tty', '--container=default', options[:pod_id], '--', *Shellwords.split(command)))
end
|
#login_command ⇒ Object
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/kitchen/transport/kubernetes.rb', line 71
def login_command
login_cmd = "IFS=$'\n'; for f in `which bash zsh sh 2>/dev/null || type -P bash zsh sh`; do exec \"$f\" -l; done"
cmd = kubectl_command('exec', '--stdin', '--tty', '--container=default', options[:pod_id], '--', '/bin/sh', '-c', login_cmd)
LoginCommand.new(cmd[0], cmd.drop(1))
end
|
#upload(locals, remote) ⇒ Object
64
65
66
67
68
|
# File 'lib/kitchen/transport/kubernetes.rb', line 64
def upload(locals, remote)
return if locals.empty?
run_command([options[:rsync_command], '--archive', '--progress', '--blocking-io', '--rsh', options[:rsync_rsh]] + (options[:log_level] == :debug ? %w{--verbose --verbose --verbose} : []) + locals + ["#{options[:pod_id]}:#{remote}"])
end
|