class KubeDeployTools::Kubectl
Public Class Methods
new( context:, kubeconfig:)
click to toggle source
# File lib/kube_deploy_tools/kubectl.rb, line 6 def initialize( context:, kubeconfig:) @context = context @kubeconfig = kubeconfig raise ArgumentError, "context is required" if context.empty? end
Public Instance Methods
run(*args, print_cmd: true, timeout: nil)
click to toggle source
# File lib/kube_deploy_tools/kubectl.rb, line 15 def run(*args, print_cmd: true, timeout: nil) args = args.unshift("kubectl") args.push("--context=#{@context}") args.push("--kubeconfig=#{@kubeconfig}") if @kubeconfig.present? args.push("--request-timeout=#{timeout}") if timeout.present? Shellrunner.run_call(*args, print_cmd: print_cmd) end