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
7c613cdf
Commit
7c613cdf
authored
Oct 16, 2018
by
Peter Leitzen
Committed by
Sean McGivern
Oct 16, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "Prometheus not showing as installed, even though it is"
parent
0ea2d5db
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
129 additions
and
78 deletions
+129
-78
app/models/clusters/applications/jupyter.rb
app/models/clusters/applications/jupyter.rb
+1
-1
app/models/clusters/cluster.rb
app/models/clusters/cluster.rb
+3
-2
app/models/clusters/concerns/application_core.rb
app/models/clusters/concerns/application_core.rb
+1
-1
app/models/clusters/concerns/application_status.rb
app/models/clusters/concerns/application_status.rb
+4
-0
app/models/project_services/prometheus_service.rb
app/models/project_services/prometheus_service.rb
+4
-4
app/views/projects/services/prometheus/_configuration_banner.html.haml
...jects/services/prometheus/_configuration_banner.html.haml
+1
-1
changelogs/unreleased/51972-prometheus-not-showing-as-installed-even-though-it-is.yml
...prometheus-not-showing-as-installed-even-though-it-is.yml
+5
-0
ee/app/controllers/ee/projects/clusters_controller.rb
ee/app/controllers/ee/projects/clusters_controller.rb
+1
-1
ee/app/views/projects/clusters/_health.html.haml
ee/app/views/projects/clusters/_health.html.haml
+1
-1
spec/models/clusters/applications/ingress_spec.rb
spec/models/clusters/applications/ingress_spec.rb
+1
-1
spec/models/clusters/applications/prometheus_spec.rb
spec/models/clusters/applications/prometheus_spec.rb
+1
-1
spec/models/clusters/applications/runner_spec.rb
spec/models/clusters/applications/runner_spec.rb
+1
-1
spec/models/clusters/cluster_spec.rb
spec/models/clusters/cluster_spec.rb
+5
-2
spec/models/project_services/prometheus_service_spec.rb
spec/models/project_services/prometheus_service_spec.rb
+17
-6
spec/support/shared_examples/models/cluster_application_core_shared_examples.rb
...amples/models/cluster_application_core_shared_examples.rb
+0
-56
spec/support/shared_examples/models/cluster_application_status_shared_examples.rb
...ples/models/cluster_application_status_shared_examples.rb
+83
-0
No files found.
app/models/clusters/applications/jupyter.rb
View file @
7c613cdf
...
...
@@ -19,7 +19,7 @@ module Clusters
def
set_initial_status
return
unless
not_installable?
if
cluster
&
.
application_ingress_
installed
?
&&
cluster
.
application_ingress
.
external_ip
if
cluster
&
.
application_ingress_
available
?
&&
cluster
.
application_ingress
.
external_ip
self
.
status
=
'installable'
end
end
...
...
app/models/clusters/cluster.rb
View file @
7c613cdf
...
...
@@ -45,8 +45,9 @@ module Clusters
delegate
:active?
,
to: :platform_kubernetes
,
prefix:
true
,
allow_nil:
true
delegate
:rbac?
,
to: :platform_kubernetes
,
prefix:
true
,
allow_nil:
true
delegate
:installed?
,
to: :application_helm
,
prefix:
true
,
allow_nil:
true
delegate
:installed?
,
to: :application_ingress
,
prefix:
true
,
allow_nil:
true
delegate
:available?
,
to: :application_helm
,
prefix:
true
,
allow_nil:
true
delegate
:available?
,
to: :application_ingress
,
prefix:
true
,
allow_nil:
true
delegate
:available?
,
to: :application_prometheus
,
prefix:
true
,
allow_nil:
true
enum
platform_type:
{
kubernetes:
1
...
...
app/models/clusters/concerns/application_core.rb
View file @
7c613cdf
...
...
@@ -15,7 +15,7 @@ module Clusters
def
set_initial_status
return
unless
not_installable?
self
.
status
=
'installable'
if
cluster
&
.
application_helm_
installed
?
self
.
status
=
'installable'
if
cluster
&
.
application_helm_
available
?
end
def
self
.
application_name
...
...
app/models/clusters/concerns/application_status.rb
View file @
7c613cdf
...
...
@@ -66,6 +66,10 @@ module Clusters
end
end
end
def
available?
installed?
||
updated?
end
end
end
end
app/models/project_services/prometheus_service.rb
View file @
7c613cdf
...
...
@@ -26,7 +26,7 @@ class PrometheusService < MonitoringService
end
def
editable?
manual_configuration?
||
!
prometheus_
installed
?
manual_configuration?
||
!
prometheus_
available
?
end
def
title
...
...
@@ -75,17 +75,17 @@ class PrometheusService < MonitoringService
RestClient
::
Resource
.
new
(
api_url
)
if
api_url
&&
manual_configuration?
&&
active?
end
def
prometheus_
installed
?
def
prometheus_
available
?
return
false
if
template?
return
false
unless
project
project
.
clusters
.
enabled
.
any?
{
|
cluster
|
cluster
.
application_prometheus
&
.
installed
?
}
project
.
clusters
.
enabled
.
any?
{
|
cluster
|
cluster
.
application_prometheus
_available
?
}
end
private
def
synchronize_service_state
self
.
active
=
prometheus_
installed
?
||
manual_configuration?
self
.
active
=
prometheus_
available
?
||
manual_configuration?
true
end
...
...
app/views/projects/services/prometheus/_configuration_banner.html.haml
View file @
7c613cdf
...
...
@@ -7,7 +7,7 @@
-
else
.container-fluid
.row
-
if
service
.
prometheus_
installed
?
-
if
service
.
prometheus_
available
?
.col-sm-2
.svg-container
=
image_tag
'illustrations/monitoring/getting_started.svg'
...
...
changelogs/unreleased/51972-prometheus-not-showing-as-installed-even-though-it-is.yml
0 → 100644
View file @
7c613cdf
---
title
:
Show available clusters when installed or updated
merge_request
:
22356
author
:
type
:
fixed
ee/app/controllers/ee/projects/clusters_controller.rb
View file @
7c613cdf
...
...
@@ -22,7 +22,7 @@ module EE
private
def
prometheus_adapter
return
unless
cluster
&
.
application_prometheus
&
.
installed
?
return
unless
cluster
&
.
application_prometheus
_available
?
cluster
.
application_prometheus
end
...
...
ee/app/views/projects/clusters/_health.html.haml
View file @
7c613cdf
...
...
@@ -2,7 +2,7 @@
%section
.settings.no-animate.expanded.cluster-health-graphs
#cluster-health
%h4
=
s_
(
'ClusterIntegration|Kubernetes cluster health'
)
-
if
@cluster
&
.
application_prometheus
&
.
installed
?
-
if
@cluster
&
.
application_prometheus
_available
?
#prometheus-graphs
{
data:
{
"settings-path"
:
edit_project_service_path
(
@project
,
'prometheus'
),
"clusters-path"
:
project_clusters_path
(
@project
),
"documentation-path"
:
help_page_path
(
'administration/monitoring/prometheus/index.md'
),
...
...
spec/models/clusters/applications/ingress_spec.rb
View file @
7c613cdf
...
...
@@ -4,7 +4,7 @@ describe Clusters::Applications::Ingress do
let
(
:ingress
)
{
create
(
:clusters_applications_ingress
)
}
include_examples
'cluster application core specs'
,
:clusters_applications_ingress
include_examples
'cluster application status specs'
,
:cluster
_application
_ingress
include_examples
'cluster application status specs'
,
:cluster
s_applications
_ingress
before
do
allow
(
ClusterWaitForIngressIpAddressWorker
).
to
receive
(
:perform_in
)
...
...
spec/models/clusters/applications/prometheus_spec.rb
View file @
7c613cdf
...
...
@@ -4,7 +4,7 @@ describe Clusters::Applications::Prometheus do
include
KubernetesHelpers
include_examples
'cluster application core specs'
,
:clusters_applications_prometheus
include_examples
'cluster application status specs'
,
:cluster
_application
_prometheus
include_examples
'cluster application status specs'
,
:cluster
s_applications
_prometheus
describe
'.installed'
do
subject
{
described_class
.
installed
}
...
...
spec/models/clusters/applications/runner_spec.rb
View file @
7c613cdf
...
...
@@ -4,7 +4,7 @@ describe Clusters::Applications::Runner do
let
(
:ci_runner
)
{
create
(
:ci_runner
)
}
include_examples
'cluster application core specs'
,
:clusters_applications_runner
include_examples
'cluster application status specs'
,
:cluster
_application
_runner
include_examples
'cluster application status specs'
,
:cluster
s_applications
_runner
it
{
is_expected
.
to
belong_to
(
:runner
)
}
...
...
spec/models/clusters/cluster_spec.rb
View file @
7c613cdf
# frozen_string_literal: true
require
'spec_helper'
describe
Clusters
::
Cluster
do
...
...
@@ -15,8 +17,9 @@ describe Clusters::Cluster do
it
{
is_expected
.
to
delegate_method
(
:on_creation?
).
to
(
:provider
)
}
it
{
is_expected
.
to
delegate_method
(
:active?
).
to
(
:platform_kubernetes
).
with_prefix
}
it
{
is_expected
.
to
delegate_method
(
:rbac?
).
to
(
:platform_kubernetes
).
with_prefix
}
it
{
is_expected
.
to
delegate_method
(
:installed?
).
to
(
:application_helm
).
with_prefix
}
it
{
is_expected
.
to
delegate_method
(
:installed?
).
to
(
:application_ingress
).
with_prefix
}
it
{
is_expected
.
to
delegate_method
(
:available?
).
to
(
:application_helm
).
with_prefix
}
it
{
is_expected
.
to
delegate_method
(
:available?
).
to
(
:application_ingress
).
with_prefix
}
it
{
is_expected
.
to
delegate_method
(
:available?
).
to
(
:application_prometheus
).
with_prefix
}
it
{
is_expected
.
to
respond_to
:project
}
describe
'.enabled'
do
...
...
spec/models/project_services/prometheus_service_spec.rb
View file @
7c613cdf
# frozen_string_literal: true
require
'spec_helper'
describe
PrometheusService
,
:use_clean_rails_memory_store_caching
do
...
...
@@ -83,13 +85,22 @@ describe PrometheusService, :use_clean_rails_memory_store_caching do
end
end
describe
'#prometheus_
installed
?'
do
describe
'#prometheus_
available
?'
do
context
'clusters with installed prometheus'
do
let!
(
:cluster
)
{
create
(
:cluster
,
projects:
[
project
])
}
let!
(
:prometheus
)
{
create
(
:clusters_applications_prometheus
,
:installed
,
cluster:
cluster
)
}
it
'returns true'
do
expect
(
service
.
prometheus_installed?
).
to
be
(
true
)
expect
(
service
.
prometheus_available?
).
to
be
(
true
)
end
end
context
'clusters with updated prometheus'
do
let!
(
:cluster
)
{
create
(
:cluster
,
projects:
[
project
])
}
let!
(
:prometheus
)
{
create
(
:clusters_applications_prometheus
,
:updated
,
cluster:
cluster
)
}
it
'returns true'
do
expect
(
service
.
prometheus_available?
).
to
be
(
true
)
end
end
...
...
@@ -98,7 +109,7 @@ describe PrometheusService, :use_clean_rails_memory_store_caching do
let!
(
:prometheus
)
{
create
(
:clusters_applications_prometheus
,
cluster:
cluster
)
}
it
'returns false'
do
expect
(
service
.
prometheus_
installed
?
).
to
be
(
false
)
expect
(
service
.
prometheus_
available
?
).
to
be
(
false
)
end
end
...
...
@@ -106,13 +117,13 @@ describe PrometheusService, :use_clean_rails_memory_store_caching do
let
(
:cluster
)
{
create
(
:cluster
,
projects:
[
project
])
}
it
'returns false'
do
expect
(
service
.
prometheus_
installed
?
).
to
be
(
false
)
expect
(
service
.
prometheus_
available
?
).
to
be
(
false
)
end
end
context
'no clusters'
do
it
'returns false'
do
expect
(
service
.
prometheus_
installed
?
).
to
be
(
false
)
expect
(
service
.
prometheus_
available
?
).
to
be
(
false
)
end
end
end
...
...
@@ -150,7 +161,7 @@ describe PrometheusService, :use_clean_rails_memory_store_caching do
context
'with prometheus installed in the cluster'
do
before
do
allow
(
service
).
to
receive
(
:prometheus_
installed
?
).
and_return
(
true
)
allow
(
service
).
to
receive
(
:prometheus_
available
?
).
and_return
(
true
)
end
context
'when service is inactive'
do
...
...
spec/support/shared_examples/models/cluster_application_core_shared_examples.rb
View file @
7c613cdf
...
...
@@ -11,60 +11,4 @@ shared_examples 'cluster application core specs' do |application_name|
expect
(
Clusters
::
Cluster
::
APPLICATIONS
[
subject
.
name
]).
to
eq
(
described_class
)
end
end
describe
'status state machine'
do
describe
'#make_installing'
do
subject
{
create
(
application_name
,
:scheduled
)
}
it
'is installing'
do
subject
.
make_installing!
expect
(
subject
).
to
be_installing
end
end
describe
'#make_installed'
do
subject
{
create
(
application_name
,
:installing
)
}
it
'is installed'
do
subject
.
make_installed
expect
(
subject
).
to
be_installed
end
end
describe
'#make_errored'
do
subject
{
create
(
application_name
,
:installing
)
}
let
(
:reason
)
{
'some errors'
}
it
'is errored'
do
subject
.
make_errored
(
reason
)
expect
(
subject
).
to
be_errored
expect
(
subject
.
status_reason
).
to
eq
(
reason
)
end
end
describe
'#make_scheduled'
do
subject
{
create
(
application_name
,
:installable
)
}
it
'is scheduled'
do
subject
.
make_scheduled
expect
(
subject
).
to
be_scheduled
end
describe
'when was errored'
do
subject
{
create
(
application_name
,
:errored
)
}
it
'clears #status_reason'
do
expect
(
subject
.
status_reason
).
not_to
be_nil
subject
.
make_scheduled!
expect
(
subject
.
status_reason
).
to
be_nil
end
end
end
end
end
spec/support/shared_examples/models/cluster_application_status_shared_examples.rb
View file @
7c613cdf
...
...
@@ -28,4 +28,87 @@ shared_examples 'cluster application status specs' do |application_name|
end
end
end
describe
'status state machine'
do
describe
'#make_installing'
do
subject
{
create
(
application_name
,
:scheduled
)
}
it
'is installing'
do
subject
.
make_installing!
expect
(
subject
).
to
be_installing
end
end
describe
'#make_installed'
do
subject
{
create
(
application_name
,
:installing
)
}
it
'is installed'
do
subject
.
make_installed
expect
(
subject
).
to
be_installed
end
end
describe
'#make_errored'
do
subject
{
create
(
application_name
,
:installing
)
}
let
(
:reason
)
{
'some errors'
}
it
'is errored'
do
subject
.
make_errored
(
reason
)
expect
(
subject
).
to
be_errored
expect
(
subject
.
status_reason
).
to
eq
(
reason
)
end
end
describe
'#make_scheduled'
do
subject
{
create
(
application_name
,
:installable
)
}
it
'is scheduled'
do
subject
.
make_scheduled
expect
(
subject
).
to
be_scheduled
end
describe
'when was errored'
do
subject
{
create
(
application_name
,
:errored
)
}
it
'clears #status_reason'
do
expect
(
subject
.
status_reason
).
not_to
be_nil
subject
.
make_scheduled!
expect
(
subject
.
status_reason
).
to
be_nil
end
end
end
end
describe
'#available?'
do
using
RSpec
::
Parameterized
::
TableSyntax
where
(
:trait
,
:available
)
do
:not_installable
|
false
:installable
|
false
:scheduled
|
false
:installing
|
false
:installed
|
true
:updating
|
false
:updated
|
true
:errored
|
false
:update_errored
|
false
:timeouted
|
false
end
with_them
do
subject
{
build
(
application_name
,
trait
)
}
if
params
[
:available
]
it
{
is_expected
.
to
be_available
}
else
it
{
is_expected
.
not_to
be_available
}
end
end
end
end
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