Sha256: b923335846bf986f8334be2d780ee87932c22c6473e74e490458717dbc676bb2

Contents?: true

Size: 1020 Bytes

Versions: 17

Compression:

Stored size: 1020 Bytes

Contents

class KuberKit::ShellLauncher::Strategies::Kubernetes < KuberKit::ShellLauncher::Strategies::Abstract
  include KuberKit::Import[
    "core.artifact_path_resolver",
    "shell.kubectl_commands",
    "configs",
  ]

  Contract KuberKit::Shell::AbstractShell => Any
  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

    env_vars = [
      "KUBECONFIG=#{kubeconfig_path}", 
      "KUBER_KIT_SHELL_CONFIGURATION=#{KuberKit.current_configuration.name}"
    ]

    if configs.shell_launcher_sets_configration
      env_vars << "KUBER_KIT_CONFIGURATION=#{KuberKit.current_configuration.name}"
    end

    shell.replace!(env: env_vars)
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
kuber_kit-1.3.8 lib/kuber_kit/shell_launcher/strategies/kubernetes.rb
kuber_kit-1.3.7 lib/kuber_kit/shell_launcher/strategies/kubernetes.rb
kuber_kit-1.1.8 lib/kuber_kit/shell_launcher/strategies/kubernetes.rb
kuber_kit-1.3.6 lib/kuber_kit/shell_launcher/strategies/kubernetes.rb
kuber_kit-1.1.7 lib/kuber_kit/shell_launcher/strategies/kubernetes.rb
kuber_kit-1.3.5 lib/kuber_kit/shell_launcher/strategies/kubernetes.rb
kuber_kit-1.3.4 lib/kuber_kit/shell_launcher/strategies/kubernetes.rb
kuber_kit-1.1.6 lib/kuber_kit/shell_launcher/strategies/kubernetes.rb
kuber_kit-1.3.3 lib/kuber_kit/shell_launcher/strategies/kubernetes.rb
kuber_kit-1.3.2 lib/kuber_kit/shell_launcher/strategies/kubernetes.rb
kuber_kit-1.1.5 lib/kuber_kit/shell_launcher/strategies/kubernetes.rb
kuber_kit-1.3.1 lib/kuber_kit/shell_launcher/strategies/kubernetes.rb
kuber_kit-1.3.0 lib/kuber_kit/shell_launcher/strategies/kubernetes.rb
kuber_kit-1.2.7 lib/kuber_kit/shell_launcher/strategies/kubernetes.rb
kuber_kit-1.2.6 lib/kuber_kit/shell_launcher/strategies/kubernetes.rb
kuber_kit-1.2.5 lib/kuber_kit/shell_launcher/strategies/kubernetes.rb
kuber_kit-1.2.4 lib/kuber_kit/shell_launcher/strategies/kubernetes.rb