Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
a71b3f6a
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
a71b3f6a
编写于
11月 15, 2018
作者:
D
Dylan Griffith
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Extract Helm::ClientCommand for shared commands
上级
fe1469e1
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
33 addition
and
32 deletion
+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
未找到文件。
app/models/clusters/concerns/application_status.rb
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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"
\
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录