Commit ca35eb47 authored by Dylan Griffith's avatar Dylan Griffith

Minor refactoring of InitCommand and InstallCommand

parent dc8ccbb6
......@@ -20,12 +20,12 @@ module Gitlab
private
def init_helm_command
tls_opts = "--tiller-tls" \
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"
"helm init #{tls_opts} >/dev/null"
"helm init #{tls_flags} >/dev/null"
end
end
end
......
......@@ -34,21 +34,23 @@ module Gitlab
end
def script_command
if files.key?(:'ca.pem')
tls_opts = " --tls" \
" --tls-ca-cert #{files_dir}/ca.pem" \
" --tls-cert #{files_dir}/cert.pem" \
" --tls-key #{files_dir}/key.pem"
end
<<~HEREDOC
helm install#{tls_opts} #{chart} --name #{name}#{optional_version_flag} --namespace #{Gitlab::Kubernetes::Helm::NAMESPACE} -f /data/helm/#{name}/config/values.yaml >/dev/null
helm install#{optional_tls_flags} #{chart} --name #{name}#{optional_version_flag} --namespace #{Gitlab::Kubernetes::Helm::NAMESPACE} -f /data/helm/#{name}/config/values.yaml >/dev/null
HEREDOC
end
def optional_version_flag
" --version #{version}" if version
end
def optional_tls_flags
if files.key?(:'ca.pem')
" --tls" \
" --tls-ca-cert #{files_dir}/ca.pem" \
" --tls-cert #{files_dir}/cert.pem" \
" --tls-key #{files_dir}/key.pem"
end
end
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment