Class: KuberKit::ShellLauncher::Strategies::Kubernetes

Inherits:
Abstract show all
Defined in:
lib/kuber_kit/shell_launcher/strategies/kubernetes.rb

Instance Method Summary collapse

Instance Method Details

#call(shell) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/kuber_kit/shell_launcher/strategies/kubernetes.rb', line 9

def call(shell)
  kubeconfig_path = KuberKit.current_configuration.kubeconfig_path
  if kubeconfig_path.is_a?(KuberKit::Core::ArtifactPath)
    kubeconfig_path = artifact_path_resolver.call(kubeconfig_path)
  end

  deployer_namespace = KuberKit.current_configuration.deployer_namespace
  if deployer_namespace
    kubectl_commands.set_namespace(shell, deployer_namespace, kubeconfig_path: kubeconfig_path)
  end

  shell.replace!(env: ["KUBECONFIG=#{kubeconfig_path}", "KUBER_KIT_SHELL_CONFIGURATION=#{KuberKit.current_configuration.name}"])
end