Class: KuberKit::Shell::KubectlCommands

Inherits:
Object
  • Object
show all
Defined in:
lib/kuber_kit/shell/kubectl_commands.rb

Instance Method Summary collapse

Instance Method Details

#apply_file(shell, file_path, kubecfg_path: nil) ⇒ Object



2
3
4
5
6
7
8
9
10
11
# File 'lib/kuber_kit/shell/kubectl_commands.rb', line 2

def apply_file(shell, file_path, kubecfg_path: nil)
  command_parts = []
  if kubecfg_path
    command_parts << "KUBECFG=#{kubecfg_path}"
  end

  command_parts << "kubectl apply -f #{file_path}"

  shell.exec!(command_parts.join(" "))
end