Class: KuberKit::Actions::ServiceApplier

Inherits:
Object
  • Object
show all
Defined in:
lib/kuber_kit/actions/service_applier.rb

Instance Method Summary collapse

Instance Method Details

#apply_service(service_name) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/kuber_kit/actions/service_applier.rb', line 26

def apply_service(service_name)
  service = service_store.get_service(service_name)
  kubecfg_path = KuberKit.current_configuration.kubecfg_path

  result = service_reader.read(local_shell, service)
  file_path = "#{configs.service_config_dir}/#{service.name}.yml"
  local_shell.write(file_path, result)

  ui.create_task("Applying file: #{file_path}") do |task|
    kubectl_commands.apply_file(local_shell, file_path, kubecfg_path: kubecfg_path)
    task.update_title("Applied file: #{file_path}")
  end
end

#call(services:, tags:) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/kuber_kit/actions/service_applier.rb', line 16

def call(services:, tags:)
  service_names = service_list_resolver.resolve(
    services: services || [],
    tags:     tags || []
  )
  service_names.each do |service_name|
    apply_service(service_name.to_sym)
  end
end