From 0a6b5e92b84a940cae33f94754ce336009b2e036 Mon Sep 17 00:00:00 2001 From: Sander Philipse <94373878+sphilipse@users.noreply.github.com> Date: Wed, 19 Jul 2023 16:21:02 +0800 Subject: [PATCH] [Serverless Search] Remove unwanted alterting rule and connector types (#162105) ## Summary This moves alerting in Serverless Search to the Stack Management alerting page, and removes To remove these rule types, I had to disable the observability, securitySolution, uptime, monitoring and infra plugins and make sure that their server plugins (not just the frontend plugins) respected the `enabled: false` flag. --- config/serverless.es.yml | 10 ++++++++++ x-pack/plugins/infra/common/plugin_config_types.ts | 1 + .../metric_threshold/metric_threshold_executor.test.ts | 1 + .../plugins/infra/server/lib/sources/sources.test.ts | 1 + x-pack/plugins/infra/server/plugin.ts | 1 + x-pack/plugins/serverless_search/kibana.jsonc | 1 - x-pack/plugins/serverless_search/public/layout/nav.tsx | 7 ++++++- x-pack/plugins/serverless_search/public/plugin.ts | 3 +-- x-pack/plugins/serverless_search/public/types.ts | 2 -- x-pack/plugins/serverless_search/tsconfig.json | 1 - 10 files changed, 21 insertions(+), 7 deletions(-) diff --git a/config/serverless.es.yml b/config/serverless.es.yml index c8f1e8afa7914..5433ce9be7676 100644 --- a/config/serverless.es.yml +++ b/config/serverless.es.yml @@ -2,8 +2,15 @@ ## Disable APM and Uptime, enable Enterprise Search xpack.apm.enabled: false + +xpack.cloudSecurityPosture.enabled: false +xpack.infra.enabled: false +xpack.observability.enabled: false +xpack.securitySolution.enabled: false +xpack.serverless.observability.enabled: false xpack.uptime.enabled: false enterpriseSearch.enabled: false +monitoring.ui.enabled: false ## Enable the Serverless Search plugin xpack.serverless.search.enabled: true @@ -16,3 +23,6 @@ xpack.serverless.plugin.developer.projectSwitcher.currentType: 'search' # Specify in telemetry the project type telemetry.labels.serverless: search + +# Alerts config +xpack.actions.enabledActionTypes: ['.email', '.index', '.slack', '.jira', '.webhook', '.teams'] diff --git a/x-pack/plugins/infra/common/plugin_config_types.ts b/x-pack/plugins/infra/common/plugin_config_types.ts index 2c3a3bd2efeb7..52803a09ae499 100644 --- a/x-pack/plugins/infra/common/plugin_config_types.ts +++ b/x-pack/plugins/infra/common/plugin_config_types.ts @@ -14,6 +14,7 @@ export interface InfraConfig { group_by_page_size: number; }; }; + enabled: boolean; inventory: { compositeSize: number; }; diff --git a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/metric_threshold_executor.test.ts b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/metric_threshold_executor.test.ts index 0f3559be27c68..1a72feeba0913 100644 --- a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/metric_threshold_executor.test.ts +++ b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/metric_threshold_executor.test.ts @@ -1901,6 +1901,7 @@ const createMockStaticConfiguration = (sources: any): InfraConfig => ({ logs: { app_target: 'logs-ui', }, + enabled: true, sources, }); diff --git a/x-pack/plugins/infra/server/lib/sources/sources.test.ts b/x-pack/plugins/infra/server/lib/sources/sources.test.ts index a8d78d1ba09f1..9f7d5e9bd1be1 100644 --- a/x-pack/plugins/infra/server/lib/sources/sources.test.ts +++ b/x-pack/plugins/infra/server/lib/sources/sources.test.ts @@ -125,6 +125,7 @@ const createMockStaticConfiguration = (sources: any): InfraConfig => ({ app_target: 'logs-ui', }, sources, + enabled: true, }); const createRequestContext = (savedObject?: SavedObject) => { diff --git a/x-pack/plugins/infra/server/plugin.ts b/x-pack/plugins/infra/server/plugin.ts index 07bafb4781e70..3655a65f706d3 100644 --- a/x-pack/plugins/infra/server/plugin.ts +++ b/x-pack/plugins/infra/server/plugin.ts @@ -60,6 +60,7 @@ import { mapSourceToLogView } from './utils/map_source_to_log_view'; export const config: PluginConfigDescriptor = { schema: schema.object({ + enabled: schema.boolean({ defaultValue: true }), // Setting variants only allowed in the Serverless offering, otherwise always default `logs-ui` value logs: schema.conditional( schema.contextRef('serverless'), diff --git a/x-pack/plugins/serverless_search/kibana.jsonc b/x-pack/plugins/serverless_search/kibana.jsonc index 99043b16c7ab1..a8c6b8c3b77ee 100644 --- a/x-pack/plugins/serverless_search/kibana.jsonc +++ b/x-pack/plugins/serverless_search/kibana.jsonc @@ -17,7 +17,6 @@ "grokdebugger", "management", "ml", - "observabilityShared", "painlessLab", "searchprofiler", "security", diff --git a/x-pack/plugins/serverless_search/public/layout/nav.tsx b/x-pack/plugins/serverless_search/public/layout/nav.tsx index a8efa012bddc8..4601d40c14366 100644 --- a/x-pack/plugins/serverless_search/public/layout/nav.tsx +++ b/x-pack/plugins/serverless_search/public/layout/nav.tsx @@ -67,7 +67,12 @@ const navigationTree: NavigationTreeDefinition = { ); }, }, - { link: 'observability-overview:alerts' }, + { + link: 'management:triggersActions', + title: i18n.translate('xpack.serverlessSearch.nav.alerts', { + defaultMessage: 'Alerts', + }), + }, ], }, { diff --git a/x-pack/plugins/serverless_search/public/plugin.ts b/x-pack/plugins/serverless_search/public/plugin.ts index fc2c00255ffb1..b4914b710bafa 100644 --- a/x-pack/plugins/serverless_search/public/plugin.ts +++ b/x-pack/plugins/serverless_search/public/plugin.ts @@ -69,11 +69,10 @@ export class ServerlessSearchPlugin public start( core: CoreStart, - { serverless, management, observabilityShared, cloud }: ServerlessSearchPluginStartDependencies + { serverless, management, cloud }: ServerlessSearchPluginStartDependencies ): ServerlessSearchPluginStart { serverless.setProjectHome('/app/elasticsearch'); serverless.setSideNavComponent(createComponent(core, { serverless, cloud })); - observabilityShared.setIsSidebarEnabled(false); management.setupCardsNavigation({ enabled: true, hideLinksTo: [appIds.MAINTENANCE_WINDOWS], diff --git a/x-pack/plugins/serverless_search/public/types.ts b/x-pack/plugins/serverless_search/public/types.ts index 137c12a37e683..5b984289e2bd7 100644 --- a/x-pack/plugins/serverless_search/public/types.ts +++ b/x-pack/plugins/serverless_search/public/types.ts @@ -10,7 +10,6 @@ import { ManagementSetup, ManagementStart } from '@kbn/management-plugin/public' import { SecurityPluginStart } from '@kbn/security-plugin/public'; import { ServerlessPluginSetup, ServerlessPluginStart } from '@kbn/serverless/public'; import { SharePluginStart } from '@kbn/share-plugin/public'; -import { ObservabilitySharedPluginStart } from '@kbn/observability-shared-plugin/public'; // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface ServerlessSearchPluginSetup {} @@ -27,7 +26,6 @@ export interface ServerlessSearchPluginSetupDependencies { export interface ServerlessSearchPluginStartDependencies { cloud: CloudStart; management: ManagementStart; - observabilityShared: ObservabilitySharedPluginStart; security: SecurityPluginStart; serverless: ServerlessPluginStart; share: SharePluginStart; diff --git a/x-pack/plugins/serverless_search/tsconfig.json b/x-pack/plugins/serverless_search/tsconfig.json index af420adfd6140..91a3f465ca4c6 100644 --- a/x-pack/plugins/serverless_search/tsconfig.json +++ b/x-pack/plugins/serverless_search/tsconfig.json @@ -30,6 +30,5 @@ "@kbn/ml-plugin", "@kbn/management-cards-navigation", "@kbn/core-elasticsearch-server", - "@kbn/observability-shared-plugin", ] }