Sha256: 36a5d9eb904f30c64a699d56e9fde5761d599bf3ed6c4f39c97330e8b4cf7a9d

Contents?: true

Size: 1.34 KB

Versions: 11

Compression:

Stored size: 1.34 KB

Contents

class KuberKit::Shell::Commands::HelmCommands
  Contract KuberKit::Shell::AbstractShell, Or[String, ArrayOf[String]], KeywordArgs[
    kubeconfig_path: Maybe[Or[
      String, KuberKit::Core::ArtifactPath
    ]],
    namespace:              Maybe[Or[Symbol, String]],
    interactive:            Optional[Bool],
  ] => Any
  def helm_run(shell, command_list, kubeconfig_path: nil, namespace: nil, interactive: false)
    command_parts = []

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

    if kubeconfig_path
      command_parts << "KUBECONFIG=#{kubeconfig_path}"
    end

    command_parts << "helm"

    if namespace
      command_parts << "-n #{namespace}"
    end

    command_parts += Array(command_list).compact

    if interactive
      shell.interactive!(command_parts.join(" "))
    else
      shell.exec!(command_parts.join(" "))
    end
  end

  def install(shell, release_name, chart_path, kubeconfig_path: nil, namespace: nil)
    helm_run(shell, "install #{release_name} #{chart_path}", kubeconfig_path: kubeconfig_path, namespace: namespace)
  end

  def upgrade(shell, release_name, chart_path, kubeconfig_path: nil, namespace: nil)
    helm_run(shell, "upgrade #{release_name} #{chart_path} --install", kubeconfig_path: kubeconfig_path, namespace: namespace)
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
kuber_kit-1.1.8 lib/kuber_kit/shell/commands/helm_commands.rb
kuber_kit-1.3.6 lib/kuber_kit/shell/commands/helm_commands.rb
kuber_kit-1.1.7 lib/kuber_kit/shell/commands/helm_commands.rb
kuber_kit-1.3.5 lib/kuber_kit/shell/commands/helm_commands.rb
kuber_kit-1.3.4 lib/kuber_kit/shell/commands/helm_commands.rb
kuber_kit-1.1.6 lib/kuber_kit/shell/commands/helm_commands.rb
kuber_kit-1.3.3 lib/kuber_kit/shell/commands/helm_commands.rb
kuber_kit-1.3.2 lib/kuber_kit/shell/commands/helm_commands.rb
kuber_kit-1.1.5 lib/kuber_kit/shell/commands/helm_commands.rb
kuber_kit-1.3.1 lib/kuber_kit/shell/commands/helm_commands.rb
kuber_kit-1.3.0 lib/kuber_kit/shell/commands/helm_commands.rb