Commit a3c9842a authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'remove-prometheus-iap-feature-flag' into 'master'

Remove prometheus IAP feature flag

See merge request gitlab-org/gitlab!36856
parents 7c67e8c7 bb6f6b69
...@@ -54,7 +54,7 @@ class PrometheusService < MonitoringService ...@@ -54,7 +54,7 @@ class PrometheusService < MonitoringService
end end
def fields def fields
result = [ [
{ {
type: 'checkbox', type: 'checkbox',
name: 'manual_configuration', name: 'manual_configuration',
...@@ -67,11 +67,7 @@ class PrometheusService < MonitoringService ...@@ -67,11 +67,7 @@ class PrometheusService < MonitoringService
title: 'API URL', title: 'API URL',
placeholder: s_('PrometheusService|Prometheus API Base URL, like http://prometheus.example.com/'), placeholder: s_('PrometheusService|Prometheus API Base URL, like http://prometheus.example.com/'),
required: true required: true
} },
]
if Feature.enabled?(:prometheus_service_iap_auth)
result += [
{ {
type: 'text', type: 'text',
name: 'google_iap_audience_client_id', name: 'google_iap_audience_client_id',
...@@ -90,9 +86,6 @@ class PrometheusService < MonitoringService ...@@ -90,9 +86,6 @@ class PrometheusService < MonitoringService
] ]
end end
result
end
# Check we can connect to the Prometheus API # Check we can connect to the Prometheus API
def test(*args) def test(*args)
prometheus_client.ping prometheus_client.ping
...@@ -106,7 +99,7 @@ class PrometheusService < MonitoringService ...@@ -106,7 +99,7 @@ class PrometheusService < MonitoringService
options = { allow_local_requests: allow_local_api_url? } options = { allow_local_requests: allow_local_api_url? }
if Feature.enabled?(:prometheus_service_iap_auth) && behind_iap? if behind_iap?
# Adds the Authorization header # Adds the Authorization header
options[:headers] = iap_client.apply({}) options[:headers] = iap_client.apply({})
end end
......
---
title: Prometheus instances behind Google IAP can now be accessed via manual configurations
merge_request: 36856
author:
type: added
...@@ -262,8 +262,6 @@ RSpec.describe PrometheusService, :use_clean_rails_memory_store_caching do ...@@ -262,8 +262,6 @@ RSpec.describe PrometheusService, :use_clean_rails_memory_store_caching do
service.google_iap_audience_client_id = "IAP_CLIENT_ID.apps.googleusercontent.com" service.google_iap_audience_client_id = "IAP_CLIENT_ID.apps.googleusercontent.com"
stub_request(:post, "https://oauth2.googleapis.com/token").to_return(status: 200, body: '{"id_token": "FOO"}', headers: { 'Content-Type': 'application/json; charset=UTF-8' }) stub_request(:post, "https://oauth2.googleapis.com/token").to_return(status: 200, body: '{"id_token": "FOO"}', headers: { 'Content-Type': 'application/json; charset=UTF-8' })
stub_feature_flags(prometheus_service_iap_auth: true)
end end
it 'includes the authorization header' do it 'includes the authorization header' do
...@@ -474,11 +472,7 @@ RSpec.describe PrometheusService, :use_clean_rails_memory_store_caching do ...@@ -474,11 +472,7 @@ RSpec.describe PrometheusService, :use_clean_rails_memory_store_caching do
title: 'API URL', title: 'API URL',
placeholder: s_('PrometheusService|Prometheus API Base URL, like http://prometheus.example.com/'), placeholder: s_('PrometheusService|Prometheus API Base URL, like http://prometheus.example.com/'),
required: true required: true
} },
]
end
let(:feature_flagged_fields) do
[
{ {
type: 'text', type: 'text',
name: 'google_iap_audience_client_id', name: 'google_iap_audience_client_id',
...@@ -498,13 +492,7 @@ RSpec.describe PrometheusService, :use_clean_rails_memory_store_caching do ...@@ -498,13 +492,7 @@ RSpec.describe PrometheusService, :use_clean_rails_memory_store_caching do
end end
it 'returns fields' do it 'returns fields' do
stub_feature_flags(prometheus_service_iap_auth: false)
expect(service.fields).to eq(expected_fields) expect(service.fields).to eq(expected_fields)
end end
it 'returns fields with feature flag on' do
stub_feature_flags(prometheus_service_iap_auth: true)
expect(service.fields).to eq(expected_fields + feature_flagged_fields)
end
end end
end end
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