diff options
author | Dylan Griffith <dyl.griffith@gmail.com> | 2019-07-12 08:45:43 +0300 |
---|---|---|
committer | Dylan Griffith <dyl.griffith@gmail.com> | 2019-07-15 04:38:40 +0300 |
commit | c9b0ac5fc45c6e42db193b967cbeb98ed4168d62 (patch) | |
tree | 682b88a6d2b9e047cfb698493b1ee151ea535c1f /lib/gitlab/kubernetes | |
parent | ecffca5d92353d55aaf8f984737fa617782310e0 (diff) |
GitLab Managed App ensure helm version uses tls opts
The TLS opts were missing from helm version command which meant that it
was just perpetually failing and hence wasting 30s of time waiting for a
command to be successful that was never going to be successful. This
never actually caused any errors because this loop will happily just
fail 30 times without breaking the overall script but it was just a
waste of installation time so now installing apps should be ~30s faster.
Diffstat (limited to 'lib/gitlab/kubernetes')
-rw-r--r-- | lib/gitlab/kubernetes/helm/client_command.rb | 14 | ||||
-rw-r--r-- | lib/gitlab/kubernetes/helm/install_command.rb | 11 |
2 files changed, 13 insertions, 12 deletions
diff --git a/lib/gitlab/kubernetes/helm/client_command.rb b/lib/gitlab/kubernetes/helm/client_command.rb index 9940272a8bf..6ae68306a9b 100644 --- a/lib/gitlab/kubernetes/helm/client_command.rb +++ b/lib/gitlab/kubernetes/helm/client_command.rb @@ -13,15 +13,27 @@ module Gitlab end def wait_for_tiller_command + helm_check = ['helm', 'version', *optional_tls_flags].shelljoin # This is necessary to give Tiller time to restart after upgrade. # Ideally we'd be able to use --wait but cannot because of # https://github.com/helm/helm/issues/4855 - 'for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done' + "for i in $(seq 1 30); do #{helm_check} && break; sleep 1s; echo \"Retrying ($i)...\"; done" end def repository_command ['helm', 'repo', 'add', name, repository].shelljoin if repository end + + def optional_tls_flags + return [] unless 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 diff --git a/lib/gitlab/kubernetes/helm/install_command.rb b/lib/gitlab/kubernetes/helm/install_command.rb index e33ba9305ce..9744a5f3d8a 100644 --- a/lib/gitlab/kubernetes/helm/install_command.rb +++ b/lib/gitlab/kubernetes/helm/install_command.rb @@ -95,17 +95,6 @@ module Gitlab ['--version', version] end - - def optional_tls_flags - return [] unless 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 |