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
bc04a1dc
Commit
bc04a1dc
authored
Sep 02, 2019
by
James Fargher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow group install of JupyterHub
Removes limitations on cluster types that can install JupyterHub
parent
632b4075
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
28 deletions
+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
No files found.
app/models/clusters/applications/jupyter.rb
View file @
bc04a1dc
...
@@ -85,7 +85,8 @@ module Clusters
...
@@ -85,7 +85,8 @@ module Clusters
"clientId"
=>
oauth_application
.
uid
,
"clientId"
=>
oauth_application
.
uid
,
"clientSecret"
=>
oauth_application
.
secret
,
"clientSecret"
=>
oauth_application
.
secret
,
"callbackUrl"
=>
callback_url
,
"callbackUrl"
=>
callback_url
,
"gitlabProjectIdWhitelist"
=>
[
project_id
]
"gitlabProjectIdWhitelist"
=>
cluster
.
projects
.
ids
,
"gitlabGroupWhitelist"
=>
cluster
.
groups
.
map
(
&
:to_param
)
}
}
},
},
"singleuser"
=>
{
"singleuser"
=>
{
...
@@ -101,10 +102,6 @@ module Clusters
...
@@ -101,10 +102,6 @@ module Clusters
@crypto_key
||=
SecureRandom
.
hex
(
32
)
@crypto_key
||=
SecureRandom
.
hex
(
32
)
end
end
def
project_id
cluster
&
.
project
&
.
id
end
def
gitlab_url
def
gitlab_url
Gitlab
.
config
.
gitlab
.
url
Gitlab
.
config
.
gitlab
.
url
end
end
...
...
app/models/clusters/cluster.rb
View file @
bc04a1dc
...
@@ -10,15 +10,15 @@ module Clusters
...
@@ -10,15 +10,15 @@ module Clusters
self
.
table_name
=
'clusters'
self
.
table_name
=
'clusters'
PROJECT_ONLY_APPLICATIONS
=
{
PROJECT_ONLY_APPLICATIONS
=
{
Applications
::
Jupyter
.
application_name
=>
Applications
::
Jupyter
,
Applications
::
Knative
.
application_name
=>
Applications
::
Knative
Applications
::
Knative
.
application_name
=>
Applications
::
Knative
}.
freeze
}.
freeze
APPLICATIONS
=
{
APPLICATIONS
=
{
Applications
::
Helm
.
application_name
=>
Applications
::
Helm
,
Applications
::
Helm
.
application_name
=>
Applications
::
Helm
,
Applications
::
Ingress
.
application_name
=>
Applications
::
Ingress
,
Applications
::
Ingress
.
application_name
=>
Applications
::
Ingress
,
Applications
::
CertManager
.
application_name
=>
Applications
::
CertManager
,
Applications
::
CertManager
.
application_name
=>
Applications
::
CertManager
,
Applications
::
Prometheus
.
application_name
=>
Applications
::
Prometheus
,
Applications
::
Runner
.
application_name
=>
Applications
::
Runner
,
Applications
::
Runner
.
application_name
=>
Applications
::
Runner
,
Applications
::
Prometheus
.
application_name
=>
Applications
::
Prometheus
Applications
::
Jupyter
.
application_name
=>
Applications
::
Jupyter
}.
merge
(
PROJECT_ONLY_APPLICATIONS
).
freeze
}.
merge
(
PROJECT_ONLY_APPLICATIONS
).
freeze
DEFAULT_ENVIRONMENT
=
'*'
DEFAULT_ENVIRONMENT
=
'*'
KUBE_INGRESS_BASE_DOMAIN
=
'KUBE_INGRESS_BASE_DOMAIN'
KUBE_INGRESS_BASE_DOMAIN
=
'KUBE_INGRESS_BASE_DOMAIN'
...
...
changelogs/unreleased/group_level_jupyterhub.yml
0 → 100644
View file @
bc04a1dc
---
title
:
Group level JupyterHub
merge_request
:
32512
author
:
type
:
added
spec/models/clusters/applications/jupyter_spec.rb
View file @
bc04a1dc
...
@@ -81,27 +81,45 @@ describe Clusters::Applications::Jupyter do
...
@@ -81,27 +81,45 @@ describe Clusters::Applications::Jupyter do
end
end
describe
'#files'
do
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'
]
}
let
(
:values
)
{
subject
[
:'values.yaml'
]
}
subject
{
application
.
files
}
subject
{
application
.
files
}
it
'includes valid values'
do
context
'when cluster belongs to a project'
do
expect
(
values
).
to
include
(
'ingress'
)
it
'includes valid values'
do
expect
(
values
).
to
include
(
'hub'
)
expect
(
values
).
to
include
(
'ingress'
)
expect
(
values
).
to
include
(
'rbac'
)
expect
(
values
).
to
include
(
'hub'
)
expect
(
values
).
to
include
(
'proxy'
)
expect
(
values
).
to
include
(
'rbac'
)
expect
(
values
).
to
include
(
'auth'
)
expect
(
values
).
to
include
(
'proxy'
)
expect
(
values
).
to
include
(
'singleuser'
)
expect
(
values
).
to
include
(
'auth'
)
expect
(
values
).
to
match
(
/clientId: '?
#{
application
.
oauth_application
.
uid
}
/
)
expect
(
values
).
to
include
(
'singleuser'
)
expect
(
values
).
to
match
(
/callbackUrl: '?
#{
application
.
callback_url
}
/
)
expect
(
values
).
to
match
(
/clientId: '?
#{
application
.
oauth_application
.
uid
}
/
)
expect
(
values
).
to
include
(
"gitlabProjectIdWhitelist:
\n
-
#{
application
.
cluster
.
project
.
id
}
"
)
expect
(
values
).
to
match
(
/callbackUrl: '?
#{
application
.
callback_url
}
/
)
expect
(
values
).
to
include
(
"c.GitLabOAuthenticator.scope = ['api read_repository write_repository']"
)
expect
(
values
).
to
include
(
"gitlabProjectIdWhitelist:
\n
-
#{
application
.
cluster
.
project
.
id
}
"
)
expect
(
values
).
to
match
(
/GITLAB_HOST: '?
#{
Gitlab
.
config
.
gitlab
.
host
}
/
)
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
end
context
'when cluster belongs to a project'
do
context
'when cluster belongs to a group'
do
it
'sets GitLab project id'
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
}
/
)
expect
(
values
).
to
match
(
/GITLAB_CLUSTER_ID: '?
#{
application
.
cluster
.
id
}
/
)
end
end
end
end
...
...
spec/services/clusters/applications/create_service_spec.rb
View file @
bc04a1dc
...
@@ -147,12 +147,12 @@ describe Clusters::Applications::CreateService do
...
@@ -147,12 +147,12 @@ describe Clusters::Applications::CreateService do
using
RSpec
::
Parameterized
::
TableSyntax
using
RSpec
::
Parameterized
::
TableSyntax
where
(
:application
,
:association
,
:allowed
,
:pre_create_helm
)
do
where
(
:application
,
:association
,
:allowed
,
:pre_create_helm
,
:pre_create_ingress
)
do
'helm'
|
:application_helm
|
true
|
false
'helm'
|
:application_helm
|
true
|
false
|
false
'ingress'
|
:application_ingress
|
true
|
true
'ingress'
|
:application_ingress
|
true
|
true
|
false
'runner'
|
:application_runner
|
true
|
true
'runner'
|
:application_runner
|
true
|
true
|
false
'prometheus'
|
:application_prometheus
|
true
|
true
'prometheus'
|
:application_prometheus
|
true
|
true
|
false
'jupyter'
|
:application_jupyter
|
fals
e
|
true
'jupyter'
|
:application_jupyter
|
true
|
tru
e
|
true
end
end
with_them
do
with_them
do
...
@@ -160,6 +160,7 @@ describe Clusters::Applications::CreateService do
...
@@ -160,6 +160,7 @@ describe Clusters::Applications::CreateService do
klass
=
"Clusters::Applications::
#{
application
.
titleize
}
"
klass
=
"Clusters::Applications::
#{
application
.
titleize
}
"
allow_any_instance_of
(
klass
.
constantize
).
to
receive
(
:make_scheduled!
).
and_call_original
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_helm
,
:installed
,
cluster:
cluster
)
if
pre_create_helm
create
(
:clusters_applications_ingress
,
:installed
,
cluster:
cluster
,
external_hostname:
'example.com'
)
if
pre_create_ingress
end
end
let
(
:params
)
{
{
application:
application
}
}
let
(
:params
)
{
{
application:
application
}
}
...
...
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