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
34f12f54
Commit
34f12f54
authored
Sep 06, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
e30c26fc
3441092b
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
376 additions
and
235 deletions
+376
-235
app/assets/javascripts/clusters/components/applications.vue
app/assets/javascripts/clusters/components/applications.vue
+0
-1
app/finders/issuable_finder.rb
app/finders/issuable_finder.rb
+19
-4
app/models/clusters/cluster.rb
app/models/clusters/cluster.rb
+2
-2
changelogs/unreleased/instance-group-level-knative.yml
changelogs/unreleased/instance-group-level-knative.yml
+5
-0
doc/user/clusters/applications.md
doc/user/clusters/applications.md
+2
-1
spec/features/admin/clusters/applications_spec.rb
spec/features/admin/clusters/applications_spec.rb
+21
-0
spec/features/clusters/installing_applications_shared_examples.rb
...tures/clusters/installing_applications_shared_examples.rb
+228
-0
spec/features/groups/clusters/applications_spec.rb
spec/features/groups/clusters/applications_spec.rb
+23
-0
spec/features/projects/clusters/applications_spec.rb
spec/features/projects/clusters/applications_spec.rb
+5
-224
spec/finders/issues_finder_spec.rb
spec/finders/issues_finder_spec.rb
+50
-0
spec/finders/merge_requests_finder_spec.rb
spec/finders/merge_requests_finder_spec.rb
+19
-1
spec/frontend/clusters/components/applications_spec.js
spec/frontend/clusters/components/applications_spec.js
+2
-2
No files found.
app/assets/javascripts/clusters/components/applications.vue
View file @
34f12f54
...
...
@@ -458,7 +458,6 @@ export default {
</div>
</application-row>
<application-row
v-if=
"isProjectCluster"
id=
"knative"
:logo-url=
"knativeLogo"
:title=
"applications.knative.title"
...
...
app/finders/issuable_finder.rb
View file @
34f12f54
...
...
@@ -193,15 +193,30 @@ class IssuableFinder
projects
=
if
current_user
&&
params
[
:authorized_only
].
presence
&&
!
current_user_related?
current_user
.
authorized_projects
(
min_access_level
)
elsif
group
find_group_projects
else
Project
.
public_or_visible_to_user
(
current_user
,
min_access_level
)
projects_public_or_visible_to_user
end
@projects
=
projects
.
with_feature_available_for_user
(
klass
,
current_user
).
reorder
(
nil
)
# rubocop: disable CodeReuse/ActiveRecord
end
def
projects_public_or_visible_to_user
projects
=
if
group
if
params
[
:projects
]
find_group_projects
.
id_in
(
params
[
:projects
])
else
find_group_projects
end
elsif
params
[
:projects
]
Project
.
id_in
(
params
[
:projects
])
else
Project
end
projects
.
public_or_visible_to_user
(
current_user
,
min_access_level
)
end
def
find_group_projects
return
Project
.
none
unless
group
...
...
@@ -209,7 +224,7 @@ class IssuableFinder
Project
.
where
(
namespace_id:
group
.
self_and_descendants
)
# rubocop: disable CodeReuse/ActiveRecord
else
group
.
projects
end
.
public_or_visible_to_user
(
current_user
,
min_access_level
)
end
end
def
search
...
...
app/models/clusters/cluster.rb
View file @
34f12f54
...
...
@@ -10,7 +10,6 @@ module Clusters
self
.
table_name
=
'clusters'
PROJECT_ONLY_APPLICATIONS
=
{
Applications
::
Knative
.
application_name
=>
Applications
::
Knative
}.
freeze
APPLICATIONS
=
{
Applications
::
Helm
.
application_name
=>
Applications
::
Helm
,
...
...
@@ -18,7 +17,8 @@ module Clusters
Applications
::
CertManager
.
application_name
=>
Applications
::
CertManager
,
Applications
::
Prometheus
.
application_name
=>
Applications
::
Prometheus
,
Applications
::
Runner
.
application_name
=>
Applications
::
Runner
,
Applications
::
Jupyter
.
application_name
=>
Applications
::
Jupyter
Applications
::
Jupyter
.
application_name
=>
Applications
::
Jupyter
,
Applications
::
Knative
.
application_name
=>
Applications
::
Knative
}.
merge
(
PROJECT_ONLY_APPLICATIONS
).
freeze
DEFAULT_ENVIRONMENT
=
'*'
KUBE_INGRESS_BASE_DOMAIN
=
'KUBE_INGRESS_BASE_DOMAIN'
...
...
changelogs/unreleased/instance-group-level-knative.yml
0 → 100644
View file @
34f12f54
---
title
:
Allow Knative to be installed on group and instance level clusters
merge_request
:
32128
author
:
type
:
added
doc/user/clusters/applications.md
View file @
34f12f54
...
...
@@ -188,7 +188,8 @@ You can clone repositories from the files tab in Jupyter:
### Knative
> Available for project-level clusters since GitLab 11.5.
> - Available for project-level clusters since GitLab 11.5.
> - Available for group-level and instance-level clusters since GitLab 12.3.
[
Knative
](
https://cloud.google.com/knative
)
provides a platform to
create, deploy, and manage serverless workloads from a Kubernetes
...
...
spec/features/admin/clusters/applications_spec.rb
0 → 100644
View file @
34f12f54
# frozen_string_literal: true
require
'spec_helper'
require_relative
'../../../../spec/features/clusters/installing_applications_shared_examples'
describe
'Instance-level Cluster Applications'
,
:js
do
include
GoogleApi
::
CloudPlatformHelpers
let
(
:user
)
{
create
(
:admin
)
}
before
do
sign_in
(
user
)
end
describe
'Installing applications'
do
include_examples
"installing applications on a cluster"
do
let
(
:cluster_path
)
{
admin_cluster_path
(
cluster
)
}
let
(
:cluster_factory_args
)
{
[
:instance
]
}
end
end
end
spec/features/clusters/installing_applications_shared_examples.rb
0 → 100644
View file @
34f12f54
# frozen_string_literal: true
shared_examples
"installing applications on a cluster"
do
before
do
visit
cluster_path
end
context
'when cluster is being created'
do
let
(
:cluster
)
{
create
(
:cluster
,
:providing_by_gcp
,
*
cluster_factory_args
)
}
it
'user is unable to install applications'
do
expect
(
page
).
not_to
have_text
(
'Helm'
)
expect
(
page
).
not_to
have_text
(
'Install'
)
end
end
context
'when cluster is created'
do
let
(
:cluster
)
{
create
(
:cluster
,
:provided_by_gcp
,
*
cluster_factory_args
)
}
it
'user can install applications'
do
wait_for_requests
page
.
within
(
'.js-cluster-application-row-helm'
)
do
expect
(
page
.
find
(
:css
,
'.js-cluster-application-install-button'
)[
'disabled'
]).
to
be_nil
expect
(
page
).
to
have_css
(
'.js-cluster-application-install-button'
,
exact_text:
'Install'
)
end
end
context
'when user installs Helm'
do
before
do
allow
(
ClusterInstallAppWorker
).
to
receive
(
:perform_async
)
page
.
within
(
'.js-cluster-application-row-helm'
)
do
page
.
find
(
:css
,
'.js-cluster-application-install-button'
).
click
end
wait_for_requests
end
it
'shows the status transition'
do
page
.
within
(
'.js-cluster-application-row-helm'
)
do
# FE sends request and gets the response, then the buttons is "Installing"
expect
(
page
).
to
have_css
(
'.js-cluster-application-install-button[disabled]'
,
exact_text:
'Installing'
)
Clusters
::
Cluster
.
last
.
application_helm
.
make_installing!
# FE starts polling and update the buttons to "Installing"
expect
(
page
).
to
have_css
(
'.js-cluster-application-install-button[disabled]'
,
exact_text:
'Installing'
)
Clusters
::
Cluster
.
last
.
application_helm
.
make_installed!
expect
(
page
).
not_to
have_css
(
'button'
,
exact_text:
'Install'
,
visible: :all
)
expect
(
page
).
not_to
have_css
(
'button'
,
exact_text:
'Installing'
,
visible: :all
)
expect
(
page
).
to
have_css
(
'.js-cluster-application-uninstall-button:not([disabled])'
,
exact_text:
'Uninstall'
)
end
expect
(
page
).
to
have_content
(
'Helm Tiller was successfully installed on your Kubernetes cluster'
)
end
end
context
'when user installs Knative'
do
before
do
create
(
:clusters_applications_helm
,
:installed
,
cluster:
cluster
)
end
context
'on an abac cluster'
do
let
(
:cluster
)
{
create
(
:cluster
,
:provided_by_gcp
,
:rbac_disabled
,
*
cluster_factory_args
)
}
it
'shows info block and not be installable'
do
page
.
within
(
'.js-cluster-application-row-knative'
)
do
expect
(
page
).
to
have_css
(
'.rbac-notice'
)
expect
(
page
.
find
(
:css
,
'.js-cluster-application-install-button'
)[
'disabled'
]).
to
eq
(
'true'
)
end
end
end
context
'on an rbac cluster'
do
let
(
:cluster
)
{
create
(
:cluster
,
:provided_by_gcp
,
*
cluster_factory_args
)
}
it
'does not show callout block and be installable'
do
page
.
within
(
'.js-cluster-application-row-knative'
)
do
expect
(
page
).
not_to
have_css
(
'p'
,
text:
'You must have an RBAC-enabled cluster'
,
visible: :all
)
expect
(
page
).
to
have_css
(
'.js-cluster-application-install-button:not([disabled])'
)
end
end
describe
'when user clicks install button'
do
def
domainname_form_value
page
.
find
(
'.js-knative-domainname'
).
value
end
before
do
allow
(
ClusterInstallAppWorker
).
to
receive
(
:perform_async
)
allow
(
ClusterWaitForIngressIpAddressWorker
).
to
receive
(
:perform_in
)
allow
(
ClusterWaitForIngressIpAddressWorker
).
to
receive
(
:perform_async
)
page
.
within
(
'.js-cluster-application-row-knative'
)
do
expect
(
page
).
to
have_css
(
'.js-cluster-application-install-button:not([disabled])'
)
page
.
find
(
'.js-knative-domainname'
).
set
(
"domain.example.org"
)
click_button
'Install'
wait_for_requests
expect
(
page
).
to
have_css
(
'.js-cluster-application-install-button'
,
exact_text:
'Installing'
)
Clusters
::
Cluster
.
last
.
application_knative
.
make_installing!
Clusters
::
Cluster
.
last
.
application_knative
.
make_installed!
Clusters
::
Cluster
.
last
.
application_knative
.
update_attribute
(
:external_ip
,
'127.0.0.1'
)
end
end
it
'shows status transition'
do
page
.
within
(
'.js-cluster-application-row-knative'
)
do
expect
(
domainname_form_value
).
to
eq
(
'domain.example.org'
)
expect
(
page
).
to
have_css
(
'.js-cluster-application-uninstall-button'
,
exact_text:
'Uninstall'
)
end
expect
(
page
).
to
have_content
(
'Knative was successfully installed on your Kubernetes cluster'
)
expect
(
page
).
to
have_css
(
'.js-knative-save-domain-button'
),
exact_text:
'Save changes'
end
it
'can then update the domain'
do
page
.
within
(
'.js-cluster-application-row-knative'
)
do
expect
(
ClusterPatchAppWorker
).
to
receive
(
:perform_async
)
expect
(
domainname_form_value
).
to
eq
(
'domain.example.org'
)
page
.
find
(
'.js-knative-domainname'
).
set
(
"new.domain.example.org"
)
click_button
'Save changes'
wait_for_requests
expect
(
domainname_form_value
).
to
eq
(
'new.domain.example.org'
)
end
end
end
end
end
context
'when user installs Cert Manager'
do
before
do
allow
(
ClusterInstallAppWorker
).
to
receive
(
:perform_async
)
allow
(
ClusterWaitForIngressIpAddressWorker
).
to
receive
(
:perform_in
)
allow
(
ClusterWaitForIngressIpAddressWorker
).
to
receive
(
:perform_async
)
create
(
:clusters_applications_helm
,
:installed
,
cluster:
cluster
)
page
.
within
(
'.js-cluster-application-row-cert_manager'
)
do
click_button
'Install'
end
end
it
'shows status transition'
do
def
email_form_value
page
.
find
(
'.js-email'
).
value
end
page
.
within
(
'.js-cluster-application-row-cert_manager'
)
do
expect
(
email_form_value
).
to
eq
(
cluster
.
user
.
email
)
expect
(
page
).
to
have_css
(
'.js-cluster-application-install-button'
,
exact_text:
'Installing'
)
page
.
find
(
'.js-email'
).
set
(
"new_email@example.org"
)
Clusters
::
Cluster
.
last
.
application_cert_manager
.
make_installing!
expect
(
email_form_value
).
to
eq
(
'new_email@example.org'
)
expect
(
page
).
to
have_css
(
'.js-cluster-application-install-button'
,
exact_text:
'Installing'
)
Clusters
::
Cluster
.
last
.
application_cert_manager
.
make_installed!
expect
(
email_form_value
).
to
eq
(
'new_email@example.org'
)
expect
(
page
).
to
have_css
(
'.js-cluster-application-uninstall-button'
,
exact_text:
'Uninstall'
)
end
expect
(
page
).
to
have_content
(
'Cert-Manager was successfully installed on your Kubernetes cluster'
)
end
end
context
'when user installs Ingress'
do
before
do
allow
(
ClusterInstallAppWorker
).
to
receive
(
:perform_async
)
allow
(
ClusterWaitForIngressIpAddressWorker
).
to
receive
(
:perform_in
)
allow
(
ClusterWaitForIngressIpAddressWorker
).
to
receive
(
:perform_async
)
create
(
:clusters_applications_helm
,
:installed
,
cluster:
cluster
)
page
.
within
(
'.js-cluster-application-row-ingress'
)
do
expect
(
page
).
to
have_css
(
'.js-cluster-application-install-button:not([disabled])'
)
page
.
find
(
:css
,
'.js-cluster-application-install-button'
).
click
wait_for_requests
end
end
it
'shows the status transition'
do
page
.
within
(
'.js-cluster-application-row-ingress'
)
do
# FE sends request and gets the response, then the buttons is "Installing"
expect
(
page
).
to
have_css
(
'.js-cluster-application-install-button[disabled]'
,
exact_text:
'Installing'
)
Clusters
::
Cluster
.
last
.
application_ingress
.
make_installing!
# FE starts polling and update the buttons to "Installing"
expect
(
page
).
to
have_css
(
'.js-cluster-application-install-button[disabled]'
,
exact_text:
'Installing'
)
# The application becomes installed but we keep waiting for external IP address
Clusters
::
Cluster
.
last
.
application_ingress
.
make_installed!
expect
(
page
).
to
have_css
(
'.js-cluster-application-install-button[disabled]'
,
exact_text:
'Installed'
)
expect
(
page
).
to
have_selector
(
'.js-no-endpoint-message'
)
expect
(
page
).
to
have_selector
(
'.js-ingress-ip-loading-icon'
)
# We receive the external IP address and display
Clusters
::
Cluster
.
last
.
application_ingress
.
update!
(
external_ip:
'192.168.1.100'
)
expect
(
page
).
not_to
have_css
(
'button'
,
exact_text:
'Install'
,
visible: :all
)
expect
(
page
).
not_to
have_css
(
'button'
,
exact_text:
'Installing'
,
visible: :all
)
expect
(
page
).
to
have_css
(
'.js-cluster-application-uninstall-button:not([disabled])'
,
exact_text:
'Uninstall'
)
expect
(
page
).
not_to
have_css
(
'p'
,
text:
'The endpoint is in the process of being assigned'
,
visible: :all
)
expect
(
page
.
find
(
'.js-endpoint'
).
value
).
to
eq
(
'192.168.1.100'
)
end
expect
(
page
).
to
have_content
(
'Ingress was successfully installed on your Kubernetes cluster'
)
end
end
end
end
spec/features/groups/clusters/applications_spec.rb
0 → 100644
View file @
34f12f54
# frozen_string_literal: true
require
'spec_helper'
require_relative
'../../../../spec/features/clusters/installing_applications_shared_examples'
describe
'Group-level Cluster Applications'
,
:js
do
include
GoogleApi
::
CloudPlatformHelpers
let
(
:group
)
{
create
(
:group
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
group
.
add_maintainer
(
user
)
sign_in
(
user
)
end
describe
'Installing applications'
do
include_examples
"installing applications on a cluster"
do
let
(
:cluster_path
)
{
group_cluster_path
(
group
,
cluster
)
}
let
(
:cluster_factory_args
)
{
[
:group
,
groups:
[
group
]]
}
end
end
end
spec/features/projects/clusters/applications_spec.rb
View file @
34f12f54
This diff is collapsed.
Click to expand it.
spec/finders/issues_finder_spec.rb
View file @
34f12f54
...
...
@@ -42,6 +42,24 @@ describe IssuesFinder do
end
end
context
'filtering by projects'
do
context
'when projects are passed in a list of ids'
do
let
(
:params
)
{
{
projects:
[
project1
.
id
]
}
}
it
'returns the issue belonging to the projects'
do
expect
(
issues
).
to
contain_exactly
(
issue1
)
end
end
context
'when projects are passed in a subquery'
do
let
(
:params
)
{
{
projects:
Project
.
id_in
(
project1
.
id
)
}
}
it
'returns the issue belonging to the projects'
do
expect
(
issues
).
to
contain_exactly
(
issue1
)
end
end
end
context
'filtering by group_id'
do
let
(
:params
)
{
{
group_id:
group
.
id
}
}
...
...
@@ -49,6 +67,30 @@ describe IssuesFinder do
it
'returns all group issues'
do
expect
(
issues
).
to
contain_exactly
(
issue1
)
end
context
'when projects outside the group are passed'
do
let
(
:params
)
{
{
group_id:
group
.
id
,
projects:
[
project2
.
id
]
}
}
it
'returns no issues'
do
expect
(
issues
).
to
be_empty
end
end
context
'when projects of the group are passed'
do
let
(
:params
)
{
{
group_id:
group
.
id
,
projects:
[
project1
.
id
]
}
}
it
'returns the issue within the group and projects'
do
expect
(
issues
).
to
contain_exactly
(
issue1
)
end
end
context
'when projects of the group are passed as a subquery'
do
let
(
:params
)
{
{
group_id:
group
.
id
,
projects:
Project
.
id_in
(
project1
.
id
)
}
}
it
'returns the issue within the group and projects'
do
expect
(
issues
).
to
contain_exactly
(
issue1
)
end
end
end
context
'when include_subgroup param is true'
do
...
...
@@ -59,6 +101,14 @@ describe IssuesFinder do
it
'returns all group and subgroup issues'
do
expect
(
issues
).
to
contain_exactly
(
issue1
,
issue4
)
end
context
'when mixed projects are passed'
do
let
(
:params
)
{
{
group_id:
group
.
id
,
projects:
[
project2
.
id
,
project3
.
id
]
}
}
it
'returns the issue within the group and projects'
do
expect
(
issues
).
to
contain_exactly
(
issue4
)
end
end
end
end
...
...
spec/finders/merge_requests_finder_spec.rb
View file @
34f12f54
...
...
@@ -13,7 +13,7 @@ describe MergeRequestsFinder do
expect
(
merge_requests
).
to
contain_exactly
(
merge_request1
,
merge_request4
,
merge_request5
)
end
it
'filters by project'
do
it
'filters by project
_id
'
do
params
=
{
project_id:
project1
.
id
,
scope:
'authored'
,
state:
'opened'
}
merge_requests
=
described_class
.
new
(
user
,
params
).
execute
...
...
@@ -21,6 +21,14 @@ describe MergeRequestsFinder do
expect
(
merge_requests
).
to
contain_exactly
(
merge_request1
)
end
it
'filters by projects'
do
params
=
{
projects:
[
project2
.
id
,
project3
.
id
]
}
merge_requests
=
described_class
.
new
(
user
,
params
).
execute
expect
(
merge_requests
).
to
contain_exactly
(
merge_request3
,
merge_request4
)
end
it
'filters by commit sha'
do
merge_requests
=
described_class
.
new
(
user
,
...
...
@@ -49,6 +57,16 @@ describe MergeRequestsFinder do
expect
(
merge_requests
).
to
contain_exactly
(
merge_request1
,
merge_request2
,
merge_request5
)
end
it
'filters by group projects including subgroups'
do
# project3 is not in the group, so it should not return merge_request4
projects
=
[
project3
.
id
,
project4
.
id
]
params
=
{
group_id:
group
.
id
,
include_subgroups:
true
,
projects:
projects
}
merge_requests
=
described_class
.
new
(
user
,
params
).
execute
expect
(
merge_requests
).
to
contain_exactly
(
merge_request5
)
end
end
it
'filters by non_archived'
do
...
...
spec/frontend/clusters/components/applications_spec.js
View file @
34f12f54
...
...
@@ -89,7 +89,7 @@ describe('Applications', () => {
});
it
(
'
renders a row for Knative
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-knative
'
)).
toBeNull
();
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-knative
'
)).
not
.
toBeNull
();
});
});
...
...
@@ -126,7 +126,7 @@ describe('Applications', () => {
});
it
(
'
renders a row for Knative
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-knative
'
)).
toBeNull
();
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-knative
'
)).
not
.
toBeNull
();
});
});
...
...
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