Method: KubernetesCLI#exec_cmd
- Defined in:
- lib/kubernetes-cli.rb
#exec_cmd(container_cmd, namespace, pod, tty = true, container = nil, out_file = nil) ⇒ Object
T::Sig::WithoutRuntime.sig
params(
container_cmd: T.any(String, T::Array[String]),
namespace: String,
pod: String,
tty: T::Boolean,
container: T.nilable(String),
out_file: T.nilable(String)
).void
136 137 138 139 140 141 142 143 |
# File 'lib/kubernetes-cli.rb', line 136 def exec_cmd(container_cmd, namespace, pod, tty = true, container = nil, out_file = nil) cmd = [executable, '--kubeconfig', kubeconfig_path, '-n', namespace, 'exec'] cmd += ['-it'] if tty cmd += ['-c', container] if container cmd += [pod, '--', *Array(container_cmd)] cmd += ['>', out_file] if out_file execc(cmd) end |