Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
a71b3f6a
Commit
a71b3f6a
authored
Nov 15, 2018
by
Dylan Griffith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract Helm::ClientCommand for shared commands
parent
fe1469e1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
32 deletions
+33
-32
app/models/clusters/concerns/application_status.rb
app/models/clusters/concerns/application_status.rb
+3
-0
lib/gitlab/kubernetes/helm/client_command.rb
lib/gitlab/kubernetes/helm/client_command.rb
+26
-0
lib/gitlab/kubernetes/helm/install_command.rb
lib/gitlab/kubernetes/helm/install_command.rb
+2
-16
lib/gitlab/kubernetes/helm/upgrade_command.rb
lib/gitlab/kubernetes/helm/upgrade_command.rb
+2
-16
No files found.
app/models/clusters/concerns/application_status.rb
View file @
a71b3f6a
...
...
@@ -66,6 +66,9 @@ module Clusters
end
before_transition
any
=>
[
:installed
,
:updated
]
do
|
app_status
,
_
|
# When installing any application we are also performing an update
# of tiller (see Gitlab::Kubernetes::Helm::ClientCommand) so
# therefore we need to reflect that in the database.
app_status
.
cluster
.
application_helm
.
update!
(
version:
Gitlab
::
Kubernetes
::
Helm
::
HELM_VERSION
)
end
end
...
...
lib/gitlab/kubernetes/helm/client_command.rb
0 → 100644
View file @
a71b3f6a
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 --tiller-namespace gitlab-managed-apps'
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
'sleep 30'
end
def
repository_command
[
'helm'
,
'repo'
,
'add'
,
name
,
repository
].
shelljoin
if
repository
end
end
end
end
end
lib/gitlab/kubernetes/helm/install_command.rb
View file @
a71b3f6a
...
...
@@ -3,6 +3,7 @@ module Gitlab
module
Helm
class
InstallCommand
include
BaseCommand
include
ClientCommand
attr_reader
:name
,
:files
,
:chart
,
:version
,
:repository
,
:preinstall
,
:postinstall
...
...
@@ -20,10 +21,7 @@ module Gitlab
def
generate_script
super
+
[
init_command
,
# Sleep 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
sleep_command
,
wait_for_tiller_command
,
repository_command
,
repository_update_command
,
preinstall_command
,
...
...
@@ -38,18 +36,6 @@ module Gitlab
private
def
init_command
'helm init --upgrade --tiller-namespace gitlab-managed-apps'
end
def
sleep_command
'sleep 30'
end
def
repository_command
[
'helm'
,
'repo'
,
'add'
,
name
,
repository
].
shelljoin
if
repository
end
def
repository_update_command
'helm repo update'
if
repository
end
...
...
lib/gitlab/kubernetes/helm/upgrade_command.rb
View file @
a71b3f6a
...
...
@@ -5,6 +5,7 @@ module Gitlab
module
Helm
class
UpgradeCommand
include
BaseCommand
include
ClientCommand
attr_reader
:name
,
:chart
,
:version
,
:repository
,
:files
...
...
@@ -20,10 +21,7 @@ module Gitlab
def
generate_script
super
+
[
init_command
,
# Sleep 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
sleep_command
,
wait_for_tiller_command
,
repository_command
,
script_command
].
compact
.
join
(
"
\n
"
)
...
...
@@ -39,18 +37,6 @@ module Gitlab
private
def
init_command
'helm init --upgrade --tiller-namespace gitlab-managed-apps'
end
def
sleep_command
'sleep 30'
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"
\
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment