From c1e89492375b696b25ff63257c3cbe58ce86cc18 Mon Sep 17 00:00:00 2001 From: Shinya Maeda Date: Wed, 16 May 2018 21:35:24 +0900 Subject: [PATCH] Rescue Kubeclient::HttpError when generating prometheus_client --- app/models/clusters/applications/prometheus.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/models/clusters/applications/prometheus.rb b/app/models/clusters/applications/prometheus.rb index 7b25d8c4089..c702c4ee807 100644 --- a/app/models/clusters/applications/prometheus.rb +++ b/app/models/clusters/applications/prometheus.rb @@ -49,6 +49,11 @@ module Clusters # ensures headers containing auth data are appended to original k8s client options options = kube_client.rest_client.options.merge(headers: kube_client.headers) RestClient::Resource.new(proxy_url, options) + rescue Kubeclient::HttpError + # 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 private