Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
ce5723c8
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 搜索 >>
未验证
提交
ce5723c8
编写于
4月 30, 2018
作者:
A
Alessio Caiazza
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add alpine mirrors while operating on k8s cluster
上级
87f1736a
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
59 addition
and
72 deletion
+59
-72
changelogs/unreleased/helm-add-alpine-mirrors.yml
changelogs/unreleased/helm-add-alpine-mirrors.yml
+5
-0
lib/gitlab/kubernetes/helm/base_command.rb
lib/gitlab/kubernetes/helm/base_command.rb
+3
-0
spec/lib/gitlab/kubernetes/helm/base_command_spec.rb
spec/lib/gitlab/kubernetes/helm/base_command_spec.rb
+3
-15
spec/lib/gitlab/kubernetes/helm/init_command_spec.rb
spec/lib/gitlab/kubernetes/helm/init_command_spec.rb
+3
-17
spec/lib/gitlab/kubernetes/helm/install_command_spec.rb
spec/lib/gitlab/kubernetes/helm/install_command_spec.rb
+26
-40
spec/support/shared_examples/helm_generated_script.rb
spec/support/shared_examples/helm_generated_script.rb
+19
-0
未找到文件。
changelogs/unreleased/helm-add-alpine-mirrors.yml
0 → 100644
浏览文件 @
ce5723c8
---
title
:
Increase cluster applications installer availability using alpine linux mirrors
merge_request
:
author
:
type
:
performance
lib/gitlab/kubernetes/helm/base_command.rb
浏览文件 @
ce5723c8
...
@@ -15,6 +15,9 @@ module Gitlab
...
@@ -15,6 +15,9 @@ module Gitlab
def
generate_script
def
generate_script
<<~
HEREDOC
<<~
HEREDOC
set -eo pipefail
set -eo pipefail
ALPINE_VERSION=$(cat /etc/alpine-release | cut -d '.' -f 1,2)
echo http://mirror.clarkson.edu/alpine/v$ALPINE_VERSION/main >> /etc/apk/repositories
echo http://mirror1.hs-esslingen.de/pub/Mirrors/alpine/v$ALPINE_VERSION/main >> /etc/apk/repositories
apk add -U ca-certificates openssl >/dev/null
apk add -U ca-certificates openssl >/dev/null
wget -q -O - https://kubernetes-helm.storage.googleapis.com/helm-v
#{
Gitlab
::
Kubernetes
::
Helm
::
HELM_VERSION
}
-linux-amd64.tar.gz | tar zxC /tmp >/dev/null
wget -q -O - https://kubernetes-helm.storage.googleapis.com/helm-v
#{
Gitlab
::
Kubernetes
::
Helm
::
HELM_VERSION
}
-linux-amd64.tar.gz | tar zxC /tmp >/dev/null
mv /tmp/linux-amd64/helm /usr/bin/
mv /tmp/linux-amd64/helm /usr/bin/
...
...
spec/lib/gitlab/kubernetes/helm/base_command_spec.rb
浏览文件 @
ce5723c8
...
@@ -4,22 +4,10 @@ describe Gitlab::Kubernetes::Helm::BaseCommand do
...
@@ -4,22 +4,10 @@ describe Gitlab::Kubernetes::Helm::BaseCommand do
let
(
:application
)
{
create
(
:clusters_applications_helm
)
}
let
(
:application
)
{
create
(
:clusters_applications_helm
)
}
let
(
:base_command
)
{
described_class
.
new
(
application
.
name
)
}
let
(
:base_command
)
{
described_class
.
new
(
application
.
name
)
}
describe
'#generate_script'
do
subject
{
base_command
}
let
(
:helm_version
)
{
Gitlab
::
Kubernetes
::
Helm
::
HELM_VERSION
}
let
(
:command
)
do
<<~
HEREDOC
set -eo pipefail
apk add -U ca-certificates openssl >/dev/null
wget -q -O - https://kubernetes-helm.storage.googleapis.com/helm-v
#{
helm_version
}
-linux-amd64.tar.gz | tar zxC /tmp >/dev/null
mv /tmp/linux-amd64/helm /usr/bin/
HEREDOC
end
subject
{
base_command
.
generate_script
}
it
'should return a command that prepares the environment for helm-cli'
do
it_behaves_like
'helm commands'
do
expect
(
subject
).
to
eq
(
command
)
let
(
:commands
)
{
''
}
end
end
end
describe
'#pod_resource'
do
describe
'#pod_resource'
do
...
...
spec/lib/gitlab/kubernetes/helm/init_command_spec.rb
浏览文件 @
ce5723c8
...
@@ -2,23 +2,9 @@ require 'spec_helper'
...
@@ -2,23 +2,9 @@ require 'spec_helper'
describe
Gitlab
::
Kubernetes
::
Helm
::
InitCommand
do
describe
Gitlab
::
Kubernetes
::
Helm
::
InitCommand
do
let
(
:application
)
{
create
(
:clusters_applications_helm
)
}
let
(
:application
)
{
create
(
:clusters_applications_helm
)
}
let
(
:
init_command
)
{
described_class
.
new
(
application
.
name
)
}
let
(
:
commands
)
{
'helm init >/dev/null'
}
describe
'#generate_script'
do
subject
{
described_class
.
new
(
application
.
name
)
}
let
(
:command
)
do
<<~
MSG
.
chomp
set -eo pipefail
apk add -U ca-certificates openssl >/dev/null
wget -q -O - https://kubernetes-helm.storage.googleapis.com/helm-v2.7.0-linux-amd64.tar.gz | tar zxC /tmp >/dev/null
mv /tmp/linux-amd64/helm /usr/bin/
helm init >/dev/null
MSG
end
subject
{
init_command
.
generate_script
}
it_behaves_like
'helm commands'
it
'should return the appropriate command'
do
is_expected
.
to
eq
(
command
)
end
end
end
end
spec/lib/gitlab/kubernetes/helm/install_command_spec.rb
浏览文件 @
ce5723c8
...
@@ -12,50 +12,36 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
...
@@ -12,50 +12,36 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
)
)
end
end
describe
'#generate_script'
do
subject
{
install_command
}
let
(
:command
)
do
<<~
MSG
set -eo pipefail
apk add -U ca-certificates openssl >/dev/null
wget -q -O - https://kubernetes-helm.storage.googleapis.com/helm-v2.7.0-linux-amd64.tar.gz | tar zxC /tmp >/dev/null
mv /tmp/linux-amd64/helm /usr/bin/
helm init --client-only >/dev/null
helm install
#{
application
.
chart
}
--name
#{
application
.
name
}
--namespace
#{
namespace
}
-f /data/helm/
#{
application
.
name
}
/config/values.yaml >/dev/null
MSG
end
subject
{
install_command
.
generate_script
}
it
'should return appropriate command'
do
it_behaves_like
'helm commands'
do
is_expected
.
to
eq
(
command
)
let
(
:commands
)
do
<<~
EOS
helm init --client-only >/dev/null
helm install
#{
application
.
chart
}
--name
#{
application
.
name
}
--namespace
#{
namespace
}
-f /data/helm/
#{
application
.
name
}
/config/values.yaml >/dev/null
EOS
end
end
end
context
'with an application with a repository'
do
context
'with an application with a repository'
do
let
(
:ci_runner
)
{
create
(
:ci_runner
)
}
let
(
:ci_runner
)
{
create
(
:ci_runner
)
}
let
(
:application
)
{
create
(
:clusters_applications_runner
,
runner:
ci_runner
)
}
let
(
:application
)
{
create
(
:clusters_applications_runner
,
runner:
ci_runner
)
}
let
(
:install_command
)
do
let
(
:install_command
)
do
described_class
.
new
(
described_class
.
new
(
application
.
name
,
application
.
name
,
chart:
application
.
chart
,
chart:
application
.
chart
,
values:
application
.
values
,
values:
application
.
values
,
repository:
application
.
repository
repository:
application
.
repository
)
)
end
end
let
(
:command
)
do
<<~
MSG
set -eo pipefail
apk add -U ca-certificates openssl >/dev/null
wget -q -O - https://kubernetes-helm.storage.googleapis.com/helm-v2.7.0-linux-amd64.tar.gz | tar zxC /tmp >/dev/null
mv /tmp/linux-amd64/helm /usr/bin/
helm init --client-only >/dev/null
helm repo add
#{
application
.
name
}
#{
application
.
repository
}
helm install
#{
application
.
chart
}
--name
#{
application
.
name
}
--namespace
#{
namespace
}
-f /data/helm/
#{
application
.
name
}
/config/values.yaml >/dev/null
MSG
end
it
'should return appropriate command'
do
it_behaves_like
'helm commands'
do
is_expected
.
to
eq
(
command
)
let
(
:commands
)
do
<<~
EOS
helm init --client-only >/dev/null
helm repo add
#{
application
.
name
}
#{
application
.
repository
}
helm install
#{
application
.
chart
}
--name
#{
application
.
name
}
--namespace
#{
namespace
}
-f /data/helm/
#{
application
.
name
}
/config/values.yaml >/dev/null
EOS
end
end
end
end
end
end
...
...
spec/support/shared_examples/helm_generated_script.rb
0 → 100644
浏览文件 @
ce5723c8
shared_examples
'helm commands'
do
describe
'#generate_script'
do
let
(
:helm_setup
)
do
<<~
EOS
set -eo pipefail
ALPINE_VERSION=$(cat /etc/alpine-release | cut -d '.' -f 1,2)
echo http://mirror.clarkson.edu/alpine/v$ALPINE_VERSION/main >> /etc/apk/repositories
echo http://mirror1.hs-esslingen.de/pub/Mirrors/alpine/v$ALPINE_VERSION/main >> /etc/apk/repositories
apk add -U ca-certificates openssl >/dev/null
wget -q -O - https://kubernetes-helm.storage.googleapis.com/helm-v2.7.0-linux-amd64.tar.gz | tar zxC /tmp >/dev/null
mv /tmp/linux-amd64/helm /usr/bin/
EOS
end
it
'should return appropriate command'
do
expect
(
subject
.
generate_script
).
to
eq
(
helm_setup
+
commands
)
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录