Commit bb6f6b69 authored by Dhiraj Bodicherla's avatar Dhiraj Bodicherla

Remove prometheus IAP feature flag

parent 2b8517ef
...@@ -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,30 +67,23 @@ class PrometheusService < MonitoringService ...@@ -67,30 +67,23 @@ 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
},
{
type: 'text',
name: 'google_iap_audience_client_id',
title: 'Google IAP Audience Client ID',
placeholder: s_('PrometheusService|Client ID of the IAP secured resource (looks like IAP_CLIENT_ID.apps.googleusercontent.com)'),
autocomplete: 'off',
required: false
},
{
type: 'textarea',
name: 'google_iap_service_account_json',
title: 'Google IAP Service Account JSON',
placeholder: s_('PrometheusService|Contents of the credentials.json file of your service account, like: { "type": "service_account", "project_id": ... }'),
required: false
} }
] ]
if Feature.enabled?(:prometheus_service_iap_auth)
result += [
{
type: 'text',
name: 'google_iap_audience_client_id',
title: 'Google IAP Audience Client ID',
placeholder: s_('PrometheusService|Client ID of the IAP secured resource (looks like IAP_CLIENT_ID.apps.googleusercontent.com)'),
autocomplete: 'off',
required: false
},
{
type: 'textarea',
name: 'google_iap_service_account_json',
title: 'Google IAP Service Account JSON',
placeholder: s_('PrometheusService|Contents of the credentials.json file of your service account, like: { "type": "service_account", "project_id": ... }'),
required: false
}
]
end
result
end end
# Check we can connect to the Prometheus API # Check we can connect to the Prometheus API
...@@ -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