Commit 2efff769 authored by Alexander Turinske's avatar Alexander Turinske

Remove threat_monitoring_alerts feature flag

- remove all instances of it
- show alerts tab by default
- remove yml definition
- update tests

Changelog: added
parent c690eafb
...@@ -165,7 +165,8 @@ button at the bottom of the editor. ...@@ -165,7 +165,8 @@ button at the bottom of the editor.
### Configuring Network Policy Alerts ### Configuring Network Policy Alerts
> [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/3438) and [enabled by default](https://gitlab.com/gitlab-org/gitlab/-/issues/287676) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 13.9. > - [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/3438) and [enabled by default](https://gitlab.com/gitlab-org/gitlab/-/issues/287676) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 13.9.
> - The feature flag was removed and the Threat Monitoring Alerts Project was [made generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/287676) in GitLab 14.0.
You can use policy alerts to track your policy's impact. Alerts are only available if you've You can use policy alerts to track your policy's impact. Alerts are only available if you've
[installed](../../clusters/agent/repository.md) [installed](../../clusters/agent/repository.md)
...@@ -186,25 +187,6 @@ There are two ways to create policy alerts: ...@@ -186,25 +187,6 @@ There are two ways to create policy alerts:
Once added, the UI updates and displays a warning about the dangers of too many alerts. Once added, the UI updates and displays a warning about the dangers of too many alerts.
#### Enable or disable Policy Alerts **(ULTIMATE)**
Policy Alerts is under development but ready for production use.
It is deployed behind a feature flag that is **enabled by default**.
[GitLab administrators with access to the GitLab Rails console](../../../administration/feature_flags.md)
can opt to disable it.
To enable it:
```ruby
Feature.enable(:threat_monitoring_alerts)
```
To disable it:
```ruby
Feature.disable(:threat_monitoring_alerts)
```
### Container Network Policy Alert list ### Container Network Policy Alert list
> [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/3438) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 13.9. > [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/3438) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 13.9.
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
import { GlIcon, GlLink, GlPopover, GlTabs, GlTab } from '@gitlab/ui'; import { GlIcon, GlLink, GlPopover, GlTabs, GlTab } from '@gitlab/ui';
import { mapActions } from 'vuex'; import { mapActions } from 'vuex';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import Alerts from './alerts/alerts.vue'; import Alerts from './alerts/alerts.vue';
import NetworkPolicyList from './network_policy_list.vue'; import NetworkPolicyList from './network_policy_list.vue';
import NoEnvironmentEmptyState from './no_environment_empty_state.vue'; import NoEnvironmentEmptyState from './no_environment_empty_state.vue';
...@@ -23,7 +22,6 @@ export default { ...@@ -23,7 +22,6 @@ export default {
NetworkPolicyList, NetworkPolicyList,
NoEnvironmentEmptyState, NoEnvironmentEmptyState,
}, },
mixins: [glFeatureFlagsMixin()],
inject: ['documentationPath'], inject: ['documentationPath'],
props: { props: {
defaultEnvironmentId: { defaultEnvironmentId: {
...@@ -52,11 +50,6 @@ export default { ...@@ -52,11 +50,6 @@ export default {
isSetUpMaybe: this.isValidEnvironmentId(this.defaultEnvironmentId), isSetUpMaybe: this.isValidEnvironmentId(this.defaultEnvironmentId),
}; };
}, },
computed: {
showAlertsTab() {
return this.glFeatures.threatMonitoringAlerts;
},
},
created() { created() {
if (this.isSetUpMaybe) { if (this.isSetUpMaybe) {
this.setCurrentEnvironmentId(this.defaultEnvironmentId); this.setCurrentEnvironmentId(this.defaultEnvironmentId);
...@@ -106,11 +99,7 @@ export default { ...@@ -106,11 +99,7 @@ export default {
</header> </header>
<gl-tabs content-class="gl-pt-0"> <gl-tabs content-class="gl-pt-0">
<gl-tab <gl-tab :title="s__('ThreatMonitoring|Alerts')" data-testid="threat-monitoring-alerts-tab">
v-if="showAlertsTab"
:title="s__('ThreatMonitoring|Alerts')"
data-testid="threat-monitoring-alerts-tab"
>
<alerts /> <alerts />
</gl-tab> </gl-tab>
<gl-tab ref="networkPolicyTab" :title="s__('ThreatMonitoring|Policies')"> <gl-tab ref="networkPolicyTab" :title="s__('ThreatMonitoring|Policies')">
......
...@@ -6,12 +6,6 @@ module Projects ...@@ -6,12 +6,6 @@ module Projects
before_action :authorize_read_threat_monitoring! before_action :authorize_read_threat_monitoring!
before_action do
push_frontend_feature_flag(:threat_monitoring_alerts, project, default_enabled: :yaml)
end
before_action :threat_monitoring_ff_enabled, only: [:alert_details]
feature_category :web_firewall feature_category :web_firewall
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
...@@ -35,11 +29,5 @@ module Projects ...@@ -35,11 +29,5 @@ module Projects
render_404 render_404
end end
end end
private
def threat_monitoring_ff_enabled
render_404 unless Feature.enabled?(:threat_monitoring_alerts, project, default_enabled: :yaml)
end
end end
end end
---
title: Remove threat_monitoring_alerts feature flag
merge_request: 62148
author:
type: other
---
name: threat_monitoring_alerts
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/48400
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/287676
milestone: '13.7'
type: development
group: group::container security
default_enabled: true
...@@ -249,29 +249,6 @@ RSpec.describe Projects::ThreatMonitoringController do ...@@ -249,29 +249,6 @@ RSpec.describe Projects::ThreatMonitoringController do
sign_in(user) sign_in(user)
end end
context 'with threat_monitoring feature and threat_monitoring_alerts feature flag' do
using RSpec::Parameterized::TableSyntax
where(:feature_flag, :feature, :http_status) do
false | false | :not_found
false | true | :not_found
true | false | :not_found
true | true | :ok
end
with_them do
before do
stub_licensed_features(threat_monitoring: feature)
stub_feature_flags(threat_monitoring_alerts: feature_flag)
end
specify do
subject
expect(response).to have_gitlab_http_status(http_status)
end
end
end
context 'when feature is available' do context 'when feature is available' do
before do before do
stub_licensed_features(threat_monitoring: true) stub_licensed_features(threat_monitoring: true)
...@@ -301,6 +278,18 @@ RSpec.describe Projects::ThreatMonitoringController do ...@@ -301,6 +278,18 @@ RSpec.describe Projects::ThreatMonitoringController do
end end
end end
end end
context 'when feature is not available' do
before do
stub_licensed_features(threat_monitoring: false)
end
it 'returns 404' do
subject
expect(response).to have_gitlab_http_status(:not_found)
end
end
end end
context 'with unauthorized user' do context 'with unauthorized user' do
......
...@@ -45,7 +45,6 @@ describe('ThreatMonitoringApp component', () => { ...@@ -45,7 +45,6 @@ describe('ThreatMonitoringApp component', () => {
}, },
provide: { provide: {
documentationPath, documentationPath,
glFeatures: { threatMonitoringAlerts: false },
...provide, ...provide,
}, },
store, store,
...@@ -131,15 +130,11 @@ describe('ThreatMonitoringApp component', () => { ...@@ -131,15 +130,11 @@ describe('ThreatMonitoringApp component', () => {
it('renders the network policy tab', () => { it('renders the network policy tab', () => {
expect(findNetworkPolicyTab().element).toMatchSnapshot(); expect(findNetworkPolicyTab().element).toMatchSnapshot();
}); });
it('does not show the alert tab', () => {
expect(findAlertTab().exists()).toBe(false);
});
}); });
describe('alerts tab', () => { describe('alerts tab', () => {
beforeEach(() => { beforeEach(() => {
factory({ provide: { glFeatures: { threatMonitoringAlerts: true } } }); factory();
}); });
it('shows the alerts tab', () => { it('shows the alerts tab', () => {
expect(findAlertTab().exists()).toBe(true); expect(findAlertTab().exists()).toBe(true);
......
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