Sha256: 004f7fe8e00c7bb42580c25ffaaf4e7157c35d96809c75c9d93c623ec29e9212

Contents?: true

Size: 1.4 KB

Versions: 1

Compression:

Stored size: 1.4 KB

Contents

class KuberKit::ServiceDeployer::Strategies::Helm < KuberKit::ServiceDeployer::Strategies::Abstract
  include KuberKit::Import[
    "service_reader.reader",
    "shell.helm_commands",
    "shell.bash_commands",
    "configs",
  ]

  Contract KuberKit::Shell::AbstractShell, KuberKit::Core::Service => Any
  def deploy(shell, service)
    service_config        = reader.read(shell, service)
    chart_root_path       = File.join(configs.service_config_dir, "#{service.name}_chart")
    chart_templates_path  = File.join(chart_root_path, "templates")
    chart_config_path = File.join(chart_root_path, "Chart.yaml")
    release_path      = File.join(chart_templates_path, "release.yaml")

    bash_commands.mkdir_p(shell, File.dirname(chart_root_path))
    bash_commands.mkdir_p(shell, File.dirname(chart_templates_path))

    shell.write(release_path, service_config)
    shell.write(chart_config_path, chart_config_content(service.uri))

    kubeconfig_path = KuberKit.current_configuration.kubeconfig_path
    namespace       = KuberKit.current_configuration.deployer_namespace

    upgrade_result = helm_commands.upgrade(shell, chart_root_path, kubeconfig_path: kubeconfig_path, namespace: namespace)
    
    upgrade_result
  end

  def chart_config_content(release_name)
    query = <<-CHART
apiVersion: v2
name: #{release_name}
description: #{release_name}
type: application
version: 1.0.0
appVersion: "1.0.0"
    CHART
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kuber_kit-1.3.0 lib/kuber_kit/service_deployer/strategies/helm.rb