Class: KuberKit::ServiceDeployer::Strategies::Helm

Inherits:
Abstract show all
Defined in:
lib/kuber_kit/service_deployer/strategies/helm.rb

Instance Method Summary collapse

Instance Method Details

#chart_config_content(release_name) ⇒ Object



31
32
33
34
35
36
37
38
39
40
# File 'lib/kuber_kit/service_deployer/strategies/helm.rb', line 31

def chart_config_content(release_name)
  query = "apiVersion: v2\nname: \#{release_name}\ndescription: \#{release_name}\ntype: application\nversion: 1.0.0\nappVersion: \"1.0.0\"\n  CHART\nend\n"

#deploy(shell, service) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/kuber_kit/service_deployer/strategies/helm.rb', line 10

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, chart_root_path)
  bash_commands.mkdir_p(shell, 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, service.uri, chart_root_path, kubeconfig_path: kubeconfig_path, namespace: namespace)
  
  upgrade_result
end