Commit 41f645d1 authored by Thong Kuah's avatar Thong Kuah

If a cluster is blocked, it is not configured

This should fix the error in
https://gitlab.com/gitlab-org/gitlab/issues/202064 which is causing job
logs not to show.
parent d07867ab
...@@ -99,6 +99,8 @@ module Clusters ...@@ -99,6 +99,8 @@ module Clusters
def configured? def configured?
kube_client.present? && available? kube_client.present? && available?
rescue Gitlab::UrlBlocker::BlockedUrlError
false
end end
private private
......
---
title: Fix job page not loading because kuberenetes/prometheus URL is blocked
merge_request: 24743
author:
type: fixed
...@@ -4,6 +4,7 @@ require 'spec_helper' ...@@ -4,6 +4,7 @@ require 'spec_helper'
describe Clusters::Applications::Prometheus do describe Clusters::Applications::Prometheus do
include KubernetesHelpers include KubernetesHelpers
include StubRequests
include_examples 'cluster application core specs', :clusters_applications_prometheus include_examples 'cluster application core specs', :clusters_applications_prometheus
include_examples 'cluster application status specs', :clusters_applications_prometheus include_examples 'cluster application status specs', :clusters_applications_prometheus
...@@ -320,6 +321,16 @@ describe Clusters::Applications::Prometheus do ...@@ -320,6 +321,16 @@ describe Clusters::Applications::Prometheus do
it { is_expected.to be_falsey } it { is_expected.to be_falsey }
end end
context 'when the kubernetes URL is blocked' do
before do
blocked_ip = '127.0.0.1' # localhost addresses are blocked by default
stub_all_dns(cluster.platform.api_url, ip_address: blocked_ip)
end
it { is_expected.to be_falsey }
end
end end
context 'when a kubenetes client is not present' do context 'when a kubenetes client is not present' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment