Class: KuberKit::ServiceGenerator::Strategies::Helm

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

Instance Method Summary collapse

Instance Method Details

#chart_config_content(release_name) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/kuber_kit/service_generator/strategies/helm.rb', line 23

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

#generate(shell, service, export_path) ⇒ Object



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

def generate(shell, service, export_path)
  service_config        = reader.read(shell, service)
  chart_root_path       = File.join(export_path, "#{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))
end