2019-02-15 15:39:39 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
module Gitlab
|
|
|
|
module Kubernetes
|
|
|
|
module Helm
|
2020-06-23 00:09:42 +05:30
|
|
|
class InitCommand < BaseCommand
|
2018-03-27 19:54:05 +05:30
|
|
|
def generate_script
|
|
|
|
super + [
|
|
|
|
init_helm_command
|
|
|
|
].join("\n")
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def init_helm_command
|
2018-11-20 20:47:30 +05:30
|
|
|
command = %w[helm init] + init_command_flags
|
|
|
|
|
2019-02-15 15:39:39 +05:30
|
|
|
command.shelljoin
|
2018-11-20 20:47:30 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def init_command_flags
|
|
|
|
tls_flags + optional_service_account_flag
|
|
|
|
end
|
|
|
|
|
|
|
|
def tls_flags
|
|
|
|
[
|
|
|
|
'--tiller-tls',
|
|
|
|
'--tiller-tls-verify',
|
|
|
|
'--tls-ca-cert', "#{files_dir}/ca.pem",
|
|
|
|
'--tiller-tls-cert', "#{files_dir}/cert.pem",
|
|
|
|
'--tiller-tls-key', "#{files_dir}/key.pem"
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
|
|
|
def optional_service_account_flag
|
|
|
|
return [] unless rbac?
|
|
|
|
|
|
|
|
['--service-account', service_account_name]
|
|
|
|
end
|
2018-03-27 19:54:05 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|