Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
bc04a1dc
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 搜索 >>
提交
bc04a1dc
编写于
9月 02, 2019
作者:
J
James Fargher
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Allow group install of JupyterHub
Removes limitations on cluster types that can install JupyterHub
上级
632b4075
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
49 addition
and
28 deletion
+49
-28
app/models/clusters/applications/jupyter.rb
app/models/clusters/applications/jupyter.rb
+2
-5
app/models/clusters/cluster.rb
app/models/clusters/cluster.rb
+2
-2
changelogs/unreleased/group_level_jupyterhub.yml
changelogs/unreleased/group_level_jupyterhub.yml
+5
-0
spec/models/clusters/applications/jupyter_spec.rb
spec/models/clusters/applications/jupyter_spec.rb
+33
-15
spec/services/clusters/applications/create_service_spec.rb
spec/services/clusters/applications/create_service_spec.rb
+7
-6
未找到文件。
app/models/clusters/applications/jupyter.rb
浏览文件 @
bc04a1dc
...
...
@@ -85,7 +85,8 @@ module Clusters
"clientId"
=>
oauth_application
.
uid
,
"clientSecret"
=>
oauth_application
.
secret
,
"callbackUrl"
=>
callback_url
,
"gitlabProjectIdWhitelist"
=>
[
project_id
]
"gitlabProjectIdWhitelist"
=>
cluster
.
projects
.
ids
,
"gitlabGroupWhitelist"
=>
cluster
.
groups
.
map
(
&
:to_param
)
}
},
"singleuser"
=>
{
...
...
@@ -101,10 +102,6 @@ module Clusters
@crypto_key
||=
SecureRandom
.
hex
(
32
)
end
def
project_id
cluster
&
.
project
&
.
id
end
def
gitlab_url
Gitlab
.
config
.
gitlab
.
url
end
...
...
app/models/clusters/cluster.rb
浏览文件 @
bc04a1dc
...
...
@@ -10,15 +10,15 @@ module Clusters
self
.
table_name
=
'clusters'
PROJECT_ONLY_APPLICATIONS
=
{
Applications
::
Jupyter
.
application_name
=>
Applications
::
Jupyter
,
Applications
::
Knative
.
application_name
=>
Applications
::
Knative
}.
freeze
APPLICATIONS
=
{
Applications
::
Helm
.
application_name
=>
Applications
::
Helm
,
Applications
::
Ingress
.
application_name
=>
Applications
::
Ingress
,
Applications
::
CertManager
.
application_name
=>
Applications
::
CertManager
,
Applications
::
Prometheus
.
application_name
=>
Applications
::
Prometheus
,
Applications
::
Runner
.
application_name
=>
Applications
::
Runner
,
Applications
::
Prometheus
.
application_name
=>
Applications
::
Prometheus
Applications
::
Jupyter
.
application_name
=>
Applications
::
Jupyter
}.
merge
(
PROJECT_ONLY_APPLICATIONS
).
freeze
DEFAULT_ENVIRONMENT
=
'*'
KUBE_INGRESS_BASE_DOMAIN
=
'KUBE_INGRESS_BASE_DOMAIN'
...
...
changelogs/unreleased/group_level_jupyterhub.yml
0 → 100644
浏览文件 @
bc04a1dc
---
title
:
Group level JupyterHub
merge_request
:
32512
author
:
type
:
added
spec/models/clusters/applications/jupyter_spec.rb
浏览文件 @
bc04a1dc
...
...
@@ -81,27 +81,45 @@ describe Clusters::Applications::Jupyter do
end
describe
'#files'
do
let
(
:application
)
{
create
(
:clusters_applications_jupyter
)
}
let
(
:cluster
)
{
create
(
:cluster
,
:with_installed_helm
,
:provided_by_gcp
,
:project
)
}
let
(
:application
)
{
create
(
:clusters_applications_jupyter
,
cluster:
cluster
)
}
let
(
:values
)
{
subject
[
:'values.yaml'
]
}
subject
{
application
.
files
}
it
'includes valid values'
do
expect
(
values
).
to
include
(
'ingress'
)
expect
(
values
).
to
include
(
'hub'
)
expect
(
values
).
to
include
(
'rbac'
)
expect
(
values
).
to
include
(
'proxy'
)
expect
(
values
).
to
include
(
'auth'
)
expect
(
values
).
to
include
(
'singleuser'
)
expect
(
values
).
to
match
(
/clientId: '?
#{
application
.
oauth_application
.
uid
}
/
)
expect
(
values
).
to
match
(
/callbackUrl: '?
#{
application
.
callback_url
}
/
)
expect
(
values
).
to
include
(
"gitlabProjectIdWhitelist:
\n
-
#{
application
.
cluster
.
project
.
id
}
"
)
expect
(
values
).
to
include
(
"c.GitLabOAuthenticator.scope = ['api read_repository write_repository']"
)
expect
(
values
).
to
match
(
/GITLAB_HOST: '?
#{
Gitlab
.
config
.
gitlab
.
host
}
/
)
context
'when cluster belongs to a project'
do
it
'includes valid values'
do
expect
(
values
).
to
include
(
'ingress'
)
expect
(
values
).
to
include
(
'hub'
)
expect
(
values
).
to
include
(
'rbac'
)
expect
(
values
).
to
include
(
'proxy'
)
expect
(
values
).
to
include
(
'auth'
)
expect
(
values
).
to
include
(
'singleuser'
)
expect
(
values
).
to
match
(
/clientId: '?
#{
application
.
oauth_application
.
uid
}
/
)
expect
(
values
).
to
match
(
/callbackUrl: '?
#{
application
.
callback_url
}
/
)
expect
(
values
).
to
include
(
"gitlabProjectIdWhitelist:
\n
-
#{
application
.
cluster
.
project
.
id
}
"
)
expect
(
values
).
to
include
(
"c.GitLabOAuthenticator.scope = ['api read_repository write_repository']"
)
expect
(
values
).
to
match
(
/GITLAB_HOST: '?
#{
Gitlab
.
config
.
gitlab
.
host
}
/
)
expect
(
values
).
to
match
(
/GITLAB_CLUSTER_ID: '?
#{
application
.
cluster
.
id
}
/
)
end
end
context
'when cluster belongs to a project'
do
it
'sets GitLab project id'
do
context
'when cluster belongs to a group'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:cluster
)
{
create
(
:cluster
,
:with_installed_helm
,
:provided_by_gcp
,
:group
,
groups:
[
group
])
}
it
'includes valid values'
do
expect
(
values
).
to
include
(
'ingress'
)
expect
(
values
).
to
include
(
'hub'
)
expect
(
values
).
to
include
(
'rbac'
)
expect
(
values
).
to
include
(
'proxy'
)
expect
(
values
).
to
include
(
'auth'
)
expect
(
values
).
to
include
(
'singleuser'
)
expect
(
values
).
to
match
(
/clientId: '?
#{
application
.
oauth_application
.
uid
}
/
)
expect
(
values
).
to
match
(
/callbackUrl: '?
#{
application
.
callback_url
}
/
)
expect
(
values
).
to
include
(
"gitlabGroupWhitelist:
\n
-
#{
group
.
to_param
}
"
)
expect
(
values
).
to
include
(
"c.GitLabOAuthenticator.scope = ['api read_repository write_repository']"
)
expect
(
values
).
to
match
(
/GITLAB_HOST: '?
#{
Gitlab
.
config
.
gitlab
.
host
}
/
)
expect
(
values
).
to
match
(
/GITLAB_CLUSTER_ID: '?
#{
application
.
cluster
.
id
}
/
)
end
end
...
...
spec/services/clusters/applications/create_service_spec.rb
浏览文件 @
bc04a1dc
...
...
@@ -147,12 +147,12 @@ describe Clusters::Applications::CreateService do
using
RSpec
::
Parameterized
::
TableSyntax
where
(
:application
,
:association
,
:allowed
,
:pre_create_helm
)
do
'helm'
|
:application_helm
|
true
|
false
'ingress'
|
:application_ingress
|
true
|
true
'runner'
|
:application_runner
|
true
|
true
'prometheus'
|
:application_prometheus
|
true
|
true
'jupyter'
|
:application_jupyter
|
fals
e
|
true
where
(
:application
,
:association
,
:allowed
,
:pre_create_helm
,
:pre_create_ingress
)
do
'helm'
|
:application_helm
|
true
|
false
|
false
'ingress'
|
:application_ingress
|
true
|
true
|
false
'runner'
|
:application_runner
|
true
|
true
|
false
'prometheus'
|
:application_prometheus
|
true
|
true
|
false
'jupyter'
|
:application_jupyter
|
true
|
tru
e
|
true
end
with_them
do
...
...
@@ -160,6 +160,7 @@ describe Clusters::Applications::CreateService do
klass
=
"Clusters::Applications::
#{
application
.
titleize
}
"
allow_any_instance_of
(
klass
.
constantize
).
to
receive
(
:make_scheduled!
).
and_call_original
create
(
:clusters_applications_helm
,
:installed
,
cluster:
cluster
)
if
pre_create_helm
create
(
:clusters_applications_ingress
,
:installed
,
cluster:
cluster
,
external_hostname:
'example.com'
)
if
pre_create_ingress
end
let
(
:params
)
{
{
application:
application
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录