Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/clusters/applications/prometheus.rb')
-rw-r--r--app/models/clusters/applications/prometheus.rb39
1 files changed, 2 insertions, 37 deletions
diff --git a/app/models/clusters/applications/prometheus.rb b/app/models/clusters/applications/prometheus.rb
index 55a9a0ccb81..b9c136abab4 100644
--- a/app/models/clusters/applications/prometheus.rb
+++ b/app/models/clusters/applications/prometheus.rb
@@ -3,7 +3,7 @@
module Clusters
module Applications
class Prometheus < ApplicationRecord
- include PrometheusAdapter
+ include ::Clusters::Concerns::PrometheusClient
VERSION = '10.4.1'
@@ -32,7 +32,7 @@ module Clusters
end
state_machine :status do
- after_transition any => [:installed] do |application|
+ after_transition any => [:installed, :externally_installed] do |application|
application.run_after_commit do
Clusters::Applications::ActivateServiceWorker
.perform_async(application.cluster_id, ::PrometheusService.to_param) # rubocop:disable CodeReuse/ServiceClass
@@ -58,14 +58,6 @@ module Clusters
'https://gitlab-org.gitlab.io/cluster-integration/helm-stable-archive'
end
- def service_name
- 'prometheus-prometheus-server'
- end
-
- def service_port
- 80
- end
-
def install_command
helm_command_module::InstallCommand.new(
name: name,
@@ -106,29 +98,6 @@ module Clusters
files.merge('values.yaml': replaced_values)
end
- def prometheus_client
- return unless kube_client
-
- proxy_url = kube_client.proxy_url('service', service_name, service_port, Gitlab::Kubernetes::Helm::NAMESPACE)
-
- # ensures headers containing auth data are appended to original k8s client options
- options = kube_client.rest_client.options
- .merge(prometheus_client_default_options)
- .merge(headers: kube_client.headers)
- Gitlab::PrometheusClient.new(proxy_url, options)
- rescue Kubeclient::HttpError, Errno::ECONNRESET, Errno::ECONNREFUSED, Errno::ENETUNREACH
- # If users have mistakenly set parameters or removed the depended clusters,
- # `proxy_url` could raise an exception because gitlab can not communicate with the cluster.
- # Since `PrometheusAdapter#can_query?` is eargely loaded on environement pages in gitlab,
- # we need to silence the exceptions
- end
-
- def configured?
- kube_client.present? && available?
- rescue Gitlab::UrlBlocker::BlockedUrlError
- false
- end
-
def generate_alert_manager_token!
unless alert_manager_token.present?
update!(alert_manager_token: generate_token)
@@ -146,10 +115,6 @@ module Clusters
.perform_async(cluster_id, ::PrometheusService.to_param) # rubocop:disable CodeReuse/ServiceClass
end
- def kube_client
- cluster&.kubeclient&.core_client
- end
-
def install_knative_metrics
return [] unless cluster.application_knative_available?