Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2018-11-16 15:09:26 +0300
committerKamil Trzciński <ayufan@ayufan.eu>2018-11-16 15:09:26 +0300
commit5b75fcf6f2787c7378bc165bccf4dcdc50e4892f (patch)
tree85b2bb88875f78cc8f4fd2992bcf84645c814923 /lib/gitlab/kubernetes
parent6ac06e95e1da99fd7d851a04fc96edf6b273d541 (diff)
parent1244533b770ea0baf97fc0693a208394b162ead6 (diff)
Merge branch '49726-upgrade-helm-to-2-11' into 'master'
Resolve "Upgrade Helm Tiller Version Used By GitLab Managed Apps" Closes #49726 See merge request gitlab-org/gitlab-ce!22693
Diffstat (limited to 'lib/gitlab/kubernetes')
-rw-r--r--lib/gitlab/kubernetes/helm.rb2
-rw-r--r--lib/gitlab/kubernetes/helm/client_command.rb26
-rw-r--r--lib/gitlab/kubernetes/helm/install_command.rb10
-rw-r--r--lib/gitlab/kubernetes/helm/upgrade_command.rb10
4 files changed, 31 insertions, 17 deletions
diff --git a/lib/gitlab/kubernetes/helm.rb b/lib/gitlab/kubernetes/helm.rb
index 1cd4f9e17b7..5a22b5e3364 100644
--- a/lib/gitlab/kubernetes/helm.rb
+++ b/lib/gitlab/kubernetes/helm.rb
@@ -1,7 +1,7 @@
module Gitlab
module Kubernetes
module Helm
- HELM_VERSION = '2.7.2'.freeze
+ HELM_VERSION = '2.11.0'.freeze
KUBECTL_VERSION = '1.11.0'.freeze
NAMESPACE = 'gitlab-managed-apps'.freeze
SERVICE_ACCOUNT = 'tiller'.freeze
diff --git a/lib/gitlab/kubernetes/helm/client_command.rb b/lib/gitlab/kubernetes/helm/client_command.rb
new file mode 100644
index 00000000000..72bafc07bf0
--- /dev/null
+++ b/lib/gitlab/kubernetes/helm/client_command.rb
@@ -0,0 +1,26 @@
+module Gitlab
+ module Kubernetes
+ module Helm
+ module ClientCommand
+ def init_command
+ # Here we are always upgrading to the latest version of Tiller when
+ # installing an app. We ensure the helm version stored in the
+ # database is correct by also updating this after transition to
+ # :installed,:updated in Clusters::Concerns::ApplicationStatus
+ 'helm init --upgrade'
+ end
+
+ def wait_for_tiller_command
+ # 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'
+ end
+
+ def repository_command
+ ['helm', 'repo', 'add', name, repository].shelljoin if repository
+ end
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/kubernetes/helm/install_command.rb b/lib/gitlab/kubernetes/helm/install_command.rb
index ff1c1657b98..52700b5dc09 100644
--- a/lib/gitlab/kubernetes/helm/install_command.rb
+++ b/lib/gitlab/kubernetes/helm/install_command.rb
@@ -3,6 +3,7 @@ module Gitlab
module Helm
class InstallCommand
include BaseCommand
+ include ClientCommand
attr_reader :name, :files, :chart, :version, :repository, :preinstall, :postinstall
@@ -20,6 +21,7 @@ module Gitlab
def generate_script
super + [
init_command,
+ wait_for_tiller_command,
repository_command,
repository_update_command,
preinstall_command,
@@ -34,14 +36,6 @@ module Gitlab
private
- def init_command
- 'helm init --client-only'
- end
-
- def repository_command
- ['helm', 'repo', 'add', name, repository].shelljoin if repository
- end
-
def repository_update_command
'helm repo update' if repository
end
diff --git a/lib/gitlab/kubernetes/helm/upgrade_command.rb b/lib/gitlab/kubernetes/helm/upgrade_command.rb
index b36315f7a82..9daffc138b5 100644
--- a/lib/gitlab/kubernetes/helm/upgrade_command.rb
+++ b/lib/gitlab/kubernetes/helm/upgrade_command.rb
@@ -5,6 +5,7 @@ module Gitlab
module Helm
class UpgradeCommand
include BaseCommand
+ include ClientCommand
attr_reader :name, :chart, :version, :repository, :files
@@ -20,6 +21,7 @@ module Gitlab
def generate_script
super + [
init_command,
+ wait_for_tiller_command,
repository_command,
script_command
].compact.join("\n")
@@ -35,14 +37,6 @@ module Gitlab
private
- def init_command
- 'helm init --client-only'
- end
-
- def repository_command
- "helm repo add #{name} #{repository}" if repository
- end
-
def script_command
upgrade_flags = "#{optional_version_flag}#{optional_tls_flags}" \
" --reset-values" \