Commit bb6f6b69 authored by Dhiraj Bodicherla's avatar Dhiraj Bodicherla

Remove prometheus IAP feature flag

parent 2b8517ef
......@@ -54,7 +54,7 @@ class PrometheusService < MonitoringService
end
def fields
result = [
[
{
type: 'checkbox',
name: 'manual_configuration',
......@@ -67,30 +67,23 @@ class PrometheusService < MonitoringService
title: 'API URL',
placeholder: s_('PrometheusService|Prometheus API Base URL, like http://prometheus.example.com/'),
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
# Check we can connect to the Prometheus API
......@@ -106,7 +99,7 @@ class PrometheusService < MonitoringService
options = { allow_local_requests: allow_local_api_url? }
if Feature.enabled?(:prometheus_service_iap_auth) && behind_iap?
if behind_iap?
# Adds the Authorization header
options[:headers] = iap_client.apply({})
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
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_feature_flags(prometheus_service_iap_auth: true)
end
it 'includes the authorization header' do
......@@ -474,11 +472,7 @@ RSpec.describe PrometheusService, :use_clean_rails_memory_store_caching do
title: 'API URL',
placeholder: s_('PrometheusService|Prometheus API Base URL, like http://prometheus.example.com/'),
required: true
}
]
end
let(:feature_flagged_fields) do
[
},
{
type: 'text',
name: 'google_iap_audience_client_id',
......@@ -498,13 +492,7 @@ RSpec.describe PrometheusService, :use_clean_rails_memory_store_caching do
end
it 'returns fields' do
stub_feature_flags(prometheus_service_iap_auth: false)
expect(service.fields).to eq(expected_fields)
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
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