diff --git a/docs/dev-tools/console/console.asciidoc b/docs/dev-tools/console/console.asciidoc index f29ddb1a600db..48fe936dd2db5 100644 --- a/docs/dev-tools/console/console.asciidoc +++ b/docs/dev-tools/console/console.asciidoc @@ -129,13 +129,3 @@ image::dev-tools/console/images/console-settings.png["Console Settings", width=6 For a list of available keyboard shortcuts, click *Help*. - -[float] -[[console-settings]] -=== Disable Console - -deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."] -If you don’t want to use *Console*, you can disable it by setting `console.enabled` -to `false` in your `kibana.yml` configuration file. Changing this setting -causes the server to regenerate assets on the next startup, -which might cause a delay before pages start being served. diff --git a/docs/migration/migrate_8_0.asciidoc b/docs/migration/migrate_8_0.asciidoc index dc6754fba1ffc..f5f8a95ad24de 100644 --- a/docs/migration/migrate_8_0.asciidoc +++ b/docs/migration/migrate_8_0.asciidoc @@ -17,6 +17,7 @@ See also <> and <>. //NOTE: The notable-breaking-changes tagged regions are re-used in the //Installation and Upgrade Guide +// tag::notable-breaking-changes[] [float] [[breaking_80_index_pattern_changes]] === Index pattern changes @@ -30,18 +31,24 @@ to function as expected. Support for these index patterns has been removed in 8. *Impact:* You must migrate your time_based index patterns to a wildcard pattern, for example, `logstash-*`. - [float] [[breaking_80_setting_changes]] === Settings changes -// tag::notable-breaking-changes[] [float] ==== Multitenancy by changing `kibana.index` is no longer supported *Details:* `kibana.index`, `xpack.reporting.index` and `xpack.task_manager.index` can no longer be specified. *Impact:* Users who relied on changing these settings to achieve multitenancy should use *Spaces*, cross-cluster replication, or cross-cluster search instead. To migrate to *Spaces*, users are encouraged to use saved object management to export their saved objects from a tenant into the default tenant in a space. Improvements are planned to improve on this workflow. See https://github.com/elastic/kibana/issues/82020 for more details. +[float] +==== Disabling most plugins with the `{plugin_name}.enabled` setting is no longer supported +*Details:* The ability for most plugins to be disabled using the `{plugin_name}.enabled` config option has been removed. + +*Impact:* Some plugins, such as `telemetry`, `newsfeed`, `reporting`, and the various `vis_type` plugins will continue to support this setting, however the rest of the plugins that ship with Kibana will not. By default, any newly created plugins will not support this configuration unless it is explicitly added to the plugin's `configSchema`. + +If you are currently using one of these settings in your Kibana config, please remove it before upgrading to 8.0. If you were using these settings to control user access to certain Kibana applications, we recommend leveraging Feature Controls instead. + [float] ==== Legacy browsers are now rejected by default *Details:* `csp.strict` is now enabled by default, so Kibana will fail to load for older, legacy browsers that do not enforce basic Content Security Policy protections - notably Internet Explorer 11. diff --git a/docs/settings/apm-settings.asciidoc b/docs/settings/apm-settings.asciidoc index fc20685885df7..ac6f813ba3a86 100644 --- a/docs/settings/apm-settings.asciidoc +++ b/docs/settings/apm-settings.asciidoc @@ -40,10 +40,6 @@ Changing these settings may disable features of the APM App. [cols="2*<"] |=== -| `xpack.apm.enabled` {ess-icon} - | deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."] - Set to `false` to disable the APM app. Defaults to `true`. - | `xpack.apm.maxServiceEnvironments` {ess-icon} | Maximum number of unique service environments recognized by the UI. Defaults to `100`. diff --git a/docs/settings/dev-settings.asciidoc b/docs/settings/dev-settings.asciidoc deleted file mode 100644 index bcf4420cdadca..0000000000000 --- a/docs/settings/dev-settings.asciidoc +++ /dev/null @@ -1,34 +0,0 @@ -[role="xpack"] -[[dev-settings-kb]] -=== Development tools settings in {kib} -++++ -Development tools settings -++++ - -You do not need to configure any settings to use the development tools in {kib}. -They are enabled by default. - -[float] -[[grok-settings]] -==== Grok Debugger settings - -`xpack.grokdebugger.enabled` {ess-icon}:: -deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."] -Set to `true` to enable the <>. Defaults to `true`. - - -[float] -[[profiler-settings]] -==== {searchprofiler} settings - -`xpack.searchprofiler.enabled`:: -deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."] -Set to `true` to enable the <>. Defaults to `true`. - -[float] -[[painless_lab-settings]] -==== Painless Lab settings - -`xpack.painless_lab.enabled`:: -deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."] -When set to `true`, enables the <>. Defaults to `true`. diff --git a/docs/settings/fleet-settings.asciidoc b/docs/settings/fleet-settings.asciidoc index f6f5b4a79fb6d..f0dfeb619bb38 100644 --- a/docs/settings/fleet-settings.asciidoc +++ b/docs/settings/fleet-settings.asciidoc @@ -20,9 +20,6 @@ See the {fleet-guide}/index.html[{fleet}] docs for more information. [cols="2*<"] |=== -| `xpack.fleet.enabled` {ess-icon} - | deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."] - Set to `true` (default) to enable {fleet}. | `xpack.fleet.agents.enabled` {ess-icon} | Set to `true` (default) to enable {fleet}. |=== diff --git a/docs/settings/general-infra-logs-ui-settings.asciidoc b/docs/settings/general-infra-logs-ui-settings.asciidoc index 1e6dcf012206b..d56c38f120170 100644 --- a/docs/settings/general-infra-logs-ui-settings.asciidoc +++ b/docs/settings/general-infra-logs-ui-settings.asciidoc @@ -1,8 +1,4 @@ -`xpack.infra.enabled`:: -deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."] -Set to `false` to disable the Logs and Metrics app plugin {kib}. Defaults to `true`. - `xpack.infra.sources.default.logAlias`:: Index pattern for matching indices that contain log data. Defaults to `filebeat-*,kibana_sample_data_logs*`. To match multiple wildcard patterns, use a comma to separate the names, with no space after the comma. For example, `logstash-app1-*,default-logs-*`. diff --git a/docs/settings/graph-settings.asciidoc b/docs/settings/graph-settings.asciidoc deleted file mode 100644 index 793a8aae73158..0000000000000 --- a/docs/settings/graph-settings.asciidoc +++ /dev/null @@ -1,12 +0,0 @@ -[role="xpack"] -[[graph-settings-kb]] -=== Graph settings in {kib} -++++ -Graph settings -++++ - -You do not need to configure any settings to use the {graph-features}. - -`xpack.graph.enabled` {ess-icon}:: -deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."] -Set to `false` to disable the {graph-features}. diff --git a/docs/settings/ml-settings.asciidoc b/docs/settings/ml-settings.asciidoc deleted file mode 100644 index e67876c76df0d..0000000000000 --- a/docs/settings/ml-settings.asciidoc +++ /dev/null @@ -1,26 +0,0 @@ -[role="xpack"] -[[ml-settings-kb]] -=== Machine learning settings in {kib} -++++ -Machine learning settings -++++ - -You do not need to configure any settings to use {kib} {ml-features}. They are -enabled by default. - -[[general-ml-settings-kb]] -==== General {ml} settings - -`xpack.ml.enabled` {ess-icon}:: -deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."] -Set to `true` (default) to enable {kib} {ml-features}. + -+ -If set to `false` in `kibana.yml`, the {ml} icon is hidden in this {kib} -instance. If `xpack.ml.enabled` is set to `true` in `elasticsearch.yml`, however, -you can still use the {ml} APIs. To disable {ml} entirely, refer to -{ref}/ml-settings.html[{es} {ml} settings]. - -[[advanced-ml-settings-kb]] -==== Advanced {ml} settings - -Refer to <>. diff --git a/docs/settings/monitoring-settings.asciidoc b/docs/settings/monitoring-settings.asciidoc index 03c11007c64c4..d8bc26b7b3987 100644 --- a/docs/settings/monitoring-settings.asciidoc +++ b/docs/settings/monitoring-settings.asciidoc @@ -31,13 +31,6 @@ For more information, see [cols="2*<"] |=== -| `monitoring.enabled` - | deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."] - Set to `true` (default) to enable the {monitor-features} in {kib}. Unlike the - <> setting, when this setting is `false`, the - monitoring back-end does not run and {kib} stats are not sent to the monitoring - cluster. - | `monitoring.ui.ccs.enabled` | Set to `true` (default) to enable {ref}/modules-cross-cluster-search.html[cross-cluster search] of your monitoring data. The {ref}/modules-remote-clusters.html#remote-cluster-settings[`remote_cluster_client`] role must exist on each node. diff --git a/docs/settings/settings-xkb.asciidoc b/docs/settings/settings-xkb.asciidoc index 1bd38578750d7..64f97525ed747 100644 --- a/docs/settings/settings-xkb.asciidoc +++ b/docs/settings/settings-xkb.asciidoc @@ -13,11 +13,8 @@ For more {kib} configuration settings, see <>. include::alert-action-settings.asciidoc[] include::apm-settings.asciidoc[] include::banners-settings.asciidoc[] -include::dev-settings.asciidoc[] -include::graph-settings.asciidoc[] include::infrastructure-ui-settings.asciidoc[] include::logs-ui-settings.asciidoc[] -include::ml-settings.asciidoc[] include::reporting-settings.asciidoc[] include::spaces-settings.asciidoc[] include::task-manager-settings.asciidoc[] diff --git a/docs/settings/url-drilldown-settings.asciidoc b/docs/settings/url-drilldown-settings.asciidoc index ca414d4f650e9..702829ec34dcc 100644 --- a/docs/settings/url-drilldown-settings.asciidoc +++ b/docs/settings/url-drilldown-settings.asciidoc @@ -8,10 +8,6 @@ Configure the URL drilldown settings in your `kibana.yml` configuration file. [cols="2*<"] |=== -| [[url-drilldown-enabled]] `url_drilldown.enabled` - | deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."] - When `true`, enables URL drilldowns on your {kib} instance. - | [[external-URL-policy]] `externalUrl.policy` | Configures the external URL policies. URL drilldowns respect the global *External URL* service, which you can use to deny or allow external URLs. By default all external URLs are allowed. diff --git a/docs/setup/settings.asciidoc b/docs/setup/settings.asciidoc index 48bf5fe2cd7b3..16fa8eb734204 100644 --- a/docs/setup/settings.asciidoc +++ b/docs/setup/settings.asciidoc @@ -20,11 +20,12 @@ configuration using `${MY_ENV_VAR}` syntax. [cols="2*<"] |=== -| `console.enabled:` - | deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."] -Toggling this causes the server to regenerate assets on the next startup, -which may cause a delay before pages start being served. -Set to `false` to disable Console. *Default: `true`* +| `csp.rules:` + | deprecated:[7.14.0,"In 8.0 and later, this setting will no longer be supported."] +A https://w3c.github.io/webappsec-csp/[Content Security Policy] template +that disables certain unnecessary and potentially insecure capabilities in +the browser. It is strongly recommended that you keep the default CSP rules +that ship with {kib}. | `csp.script_src:` | Add sources for the https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src[Content Security Policy `script-src` directive]. @@ -688,15 +689,6 @@ sources and images. When false, Vega can only get data from {es}. *Default: `fal `exploreDataInChart.enabled` | Enables you to view the underlying documents in a data series from a dashboard panel. *Default: `false`* -| `xpack.license_management.enabled` - | deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."] -Set this value to false to disable the License Management UI. -*Default: `true`* - -| `xpack.rollup.enabled:` - | deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."] -Set this value to false to disable the Rollup UI. *Default: true* - | `i18n.locale` {ess-icon} | Set this value to change the {kib} interface language. Valid locales are: `en`, `zh-CN`, `ja-JP`. *Default: `en`* @@ -706,14 +698,11 @@ Valid locales are: `en`, `zh-CN`, `ja-JP`. *Default: `en`* include::{kib-repo-dir}/settings/alert-action-settings.asciidoc[] include::{kib-repo-dir}/settings/apm-settings.asciidoc[] include::{kib-repo-dir}/settings/banners-settings.asciidoc[] -include::{kib-repo-dir}/settings/dev-settings.asciidoc[] -include::{kib-repo-dir}/settings/graph-settings.asciidoc[] include::{kib-repo-dir}/settings/fleet-settings.asciidoc[] include::{kib-repo-dir}/settings/i18n-settings.asciidoc[] include::{kib-repo-dir}/settings/logging-settings.asciidoc[] include::{kib-repo-dir}/settings/logs-ui-settings.asciidoc[] include::{kib-repo-dir}/settings/infrastructure-ui-settings.asciidoc[] -include::{kib-repo-dir}/settings/ml-settings.asciidoc[] include::{kib-repo-dir}/settings/monitoring-settings.asciidoc[] include::{kib-repo-dir}/settings/reporting-settings.asciidoc[] include::secure-settings.asciidoc[] diff --git a/docs/user/plugins.asciidoc b/docs/user/plugins.asciidoc index c604526d6c933..36f7ce8eb49ed 100644 --- a/docs/user/plugins.asciidoc +++ b/docs/user/plugins.asciidoc @@ -145,23 +145,6 @@ You can also remove a plugin manually by deleting the plugin's subdirectory unde NOTE: Removing a plugin will result in an "optimize" run which will delay the next start of {kib}. -[float] -[[disable-plugin]] -== Disable plugins - -deprecated:[7.16.0,"In 8.0 and later, this setting will only be supported for a subset of plugins that have opted in to the behavior."] - -Use the following command to disable a plugin: - -[source,shell] ------------ -./bin/kibana --.enabled=false <1> ------------ - -NOTE: Disabling or enabling a plugin will result in an "optimize" run which will delay the start of {kib}. - -<1> You can find a plugin's plugin ID as the value of the `name` property in the plugin's `kibana.json` file. - [float] [[configure-plugin-manager]] == Configure the plugin manager diff --git a/packages/kbn-config/src/config_service.test.ts b/packages/kbn-config/src/config_service.test.ts index 4a8164b100626..03744792258c2 100644 --- a/packages/kbn-config/src/config_service.test.ts +++ b/packages/kbn-config/src/config_service.test.ts @@ -261,42 +261,6 @@ test('correctly passes context', async () => { expect(await value$.pipe(first()).toPromise()).toMatchSnapshot(); }); -test('handles enabled path, but only marks the enabled path as used', async () => { - const initialConfig = { - pid: { - enabled: true, - file: '/some/file.pid', - }, - }; - - const rawConfigProvider = rawConfigServiceMock.create({ rawConfig: initialConfig }); - const configService = new ConfigService(rawConfigProvider, defaultEnv, logger); - - const isEnabled = await configService.isEnabledAtPath('pid'); - expect(isEnabled).toBe(true); - - const unusedPaths = await configService.getUnusedPaths(); - expect(unusedPaths).toEqual(['pid.file']); -}); - -test('handles enabled path when path is array', async () => { - const initialConfig = { - pid: { - enabled: true, - file: '/some/file.pid', - }, - }; - - const rawConfigProvider = rawConfigServiceMock.create({ rawConfig: initialConfig }); - const configService = new ConfigService(rawConfigProvider, defaultEnv, logger); - - const isEnabled = await configService.isEnabledAtPath(['pid']); - expect(isEnabled).toBe(true); - - const unusedPaths = await configService.getUnusedPaths(); - expect(unusedPaths).toEqual(['pid.file']); -}); - test('handles disabled path and marks config as used', async () => { const initialConfig = { pid: { @@ -308,6 +272,14 @@ test('handles disabled path and marks config as used', async () => { const rawConfigProvider = rawConfigServiceMock.create({ rawConfig: initialConfig }); const configService = new ConfigService(rawConfigProvider, defaultEnv, logger); + configService.setSchema( + 'pid', + schema.object({ + enabled: schema.boolean({ defaultValue: false }), + file: schema.string(), + }) + ); + const isEnabled = await configService.isEnabledAtPath('pid'); expect(isEnabled).toBe(false); @@ -338,7 +310,7 @@ test('does not throw if schema does not define "enabled" schema', async () => { expect(value.enabled).toBe(undefined); }); -test('treats config as enabled if config path is not present in config', async () => { +test('treats config as enabled if config path is not present in schema', async () => { const initialConfig = {}; const rawConfigProvider = rawConfigServiceMock.create({ rawConfig: initialConfig }); @@ -351,50 +323,58 @@ test('treats config as enabled if config path is not present in config', async ( expect(unusedPaths).toEqual([]); }); -test('read "enabled" even if its schema is not present', async () => { +test('throws if reading "enabled" when it is not present in the schema', async () => { const initialConfig = { foo: { - enabled: true, + enabled: false, }, }; const rawConfigProvider = rawConfigServiceMock.create({ rawConfig: initialConfig }); const configService = new ConfigService(rawConfigProvider, defaultEnv, logger); - const isEnabled = await configService.isEnabledAtPath('foo'); - expect(isEnabled).toBe(true); + configService.setSchema( + 'foo', + schema.object({ + bar: schema.maybe(schema.string()), + }) + ); + + expect( + async () => await configService.isEnabledAtPath('foo') + ).rejects.toThrowErrorMatchingInlineSnapshot( + `"[config validation of [foo].enabled]: definition for this key is missing"` + ); }); -test('logs deprecation if schema is not present and "enabled" is used', async () => { +test('throws if reading "enabled" when no schema exists', async () => { const initialConfig = { foo: { - enabled: true, + enabled: false, }, }; const rawConfigProvider = rawConfigServiceMock.create({ rawConfig: initialConfig }); const configService = new ConfigService(rawConfigProvider, defaultEnv, logger); - await configService.isEnabledAtPath('foo'); - expect(configService.getHandledDeprecatedConfigs()).toMatchInlineSnapshot(` - Array [ - Array [ - "foo", - Array [ - Object { - "configPath": "foo.enabled", - "correctiveActions": Object { - "manualSteps": Array [ - "Remove \\"foo.enabled\\" from the Kibana config file, CLI flag, or environment variable (in Docker only) before upgrading to 8.0.0.", - ], - }, - "message": "Configuring \\"foo.enabled\\" is deprecated and will be removed in 8.0.0.", - "title": "Setting \\"foo.enabled\\" is deprecated", - }, - ], - ], - ] - `); + expect( + async () => await configService.isEnabledAtPath('foo') + ).rejects.toThrowErrorMatchingInlineSnapshot(`"No validation schema has been defined for [foo]"`); +}); + +test('throws if reading any config value when no schema exists', async () => { + const initialConfig = { + foo: { + whatever: 'hi', + }, + }; + + const rawConfigProvider = rawConfigServiceMock.create({ rawConfig: initialConfig }); + const configService = new ConfigService(rawConfigProvider, defaultEnv, logger); + + expect( + async () => await configService.isEnabledAtPath('foo') + ).rejects.toThrowErrorMatchingInlineSnapshot(`"No validation schema has been defined for [foo]"`); }); test('allows plugins to specify "enabled" flag via validation schema', async () => { @@ -425,7 +405,7 @@ test('allows plugins to specify "enabled" flag via validation schema', async () expect(await configService.isEnabledAtPath('baz')).toBe(true); }); -test('does not throw during validation is every schema is valid', async () => { +test('does not throw during validation if every schema is valid', async () => { const rawConfig = getRawConfigProvider({ stringKey: 'foo', numberKey: 42 }); const configService = new ConfigService(rawConfig, defaultEnv, logger); @@ -435,7 +415,7 @@ test('does not throw during validation is every schema is valid', async () => { await expect(configService.validate()).resolves.toBeUndefined(); }); -test('throws during validation is any schema is invalid', async () => { +test('throws during validation if any schema is invalid', async () => { const rawConfig = getRawConfigProvider({ stringKey: 123, numberKey: 42 }); const configService = new ConfigService(rawConfig, defaultEnv, logger); diff --git a/packages/kbn-config/src/config_service.ts b/packages/kbn-config/src/config_service.ts index 458acac953497..08e16a9d2f44b 100644 --- a/packages/kbn-config/src/config_service.ts +++ b/packages/kbn-config/src/config_service.ts @@ -168,51 +168,29 @@ export class ConfigService { public async isEnabledAtPath(path: ConfigPath) { const namespace = pathToString(path); + const hasSchema = this.schemas.has(namespace); - const validatedConfig = this.schemas.has(namespace) - ? await this.atPath<{ enabled?: boolean }>(path).pipe(first()).toPromise() - : undefined; - - const enabledPath = createPluginEnabledPath(path); const config = await this.config$.pipe(first()).toPromise(); - - // if plugin hasn't got a config schema, we try to read "enabled" directly - const isEnabled = validatedConfig?.enabled ?? config.get(enabledPath); - - // if we implicitly added an `enabled` config to a plugin without a schema, - // we log a deprecation warning, as this will not be supported in 8.0 - if (validatedConfig?.enabled === undefined && isEnabled !== undefined) { - const deprecationPath = pathToString(enabledPath); - const deprecatedConfigDetails: DeprecatedConfigDetails = { - configPath: deprecationPath, - title: `Setting "${deprecationPath}" is deprecated`, - message: `Configuring "${deprecationPath}" is deprecated and will be removed in 8.0.0.`, - correctiveActions: { - manualSteps: [ - `Remove "${deprecationPath}" from the Kibana config file, CLI flag, or environment variable (in Docker only) before upgrading to 8.0.0.`, - ], - }, - }; - this.deprecationLog.warn(deprecatedConfigDetails.message); - this.markDeprecatedConfigAsHandled(namespace, deprecatedConfigDetails); + if (!hasSchema && config.has(path)) { + // Throw if there is no schema, but a config exists at the path. + throw new Error(`No validation schema has been defined for [${namespace}]`); } - // not declared. consider that plugin is enabled by default - if (isEnabled === undefined) { - return true; - } + const validatedConfig = hasSchema + ? await this.atPath<{ enabled?: boolean }>(path).pipe(first()).toPromise() + : undefined; - if (isEnabled === false) { - // If the plugin is _not_ enabled, we mark the entire plugin path as - // handled, as it's expected that it won't be used. + const isDisabled = validatedConfig?.enabled === false; + if (isDisabled) { + // If the plugin is explicitly disabled, we mark the entire plugin + // path as handled, as it's expected that it won't be used. this.markAsHandled(path); return false; } - // If plugin enabled we mark the enabled path as handled, as we for example - // can have plugins that don't have _any_ config except for this field, and - // therefore have no reason to try to get the config. - this.markAsHandled(enabledPath); + // If the schema exists and the config is explicitly set to true, + // _or_ if the `enabled` config is undefined, then we treat the + // plugin as enabled. return true; } @@ -286,13 +264,6 @@ export class ConfigService { } } -const createPluginEnabledPath = (configPath: string | string[]) => { - if (Array.isArray(configPath)) { - return configPath.concat('enabled'); - } - return `${configPath}.enabled`; -}; - const pathToString = (path: ConfigPath) => (Array.isArray(path) ? path.join('.') : path); /** diff --git a/packages/kbn-config/src/deprecation/types.ts b/packages/kbn-config/src/deprecation/types.ts index f5bb240f5cc43..7b1eb4a0ea6c1 100644 --- a/packages/kbn-config/src/deprecation/types.ts +++ b/packages/kbn-config/src/deprecation/types.ts @@ -106,7 +106,7 @@ export interface ConfigDeprecationCommand { * * @example * ```typescript - * const provider: ConfigDeprecationProvider = ({ rename, unused }) => [ + * const provider: ConfigDeprecationProvider = ({ deprecate, rename, unused }) => [ * deprecate('deprecatedKey', '8.0.0'), * rename('oldKey', 'newKey'), * unused('deprecatedKey'), @@ -164,7 +164,7 @@ export interface ConfigDeprecationFactory { * @example * Log a deprecation warning indicating 'myplugin.deprecatedKey' should be removed by `8.0.0` * ```typescript - * const provider: ConfigDeprecationProvider = ({ deprecate }) => [ + * const provider: ConfigDeprecationProvider = ({ deprecateFromRoot }) => [ * deprecateFromRoot('deprecatedKey', '8.0.0'), * ] * ``` diff --git a/src/core/server/plugins/plugins_service.test.ts b/src/core/server/plugins/plugins_service.test.ts index d45e7f9bf0bd0..0c077d732c67b 100644 --- a/src/core/server/plugins/plugins_service.test.ts +++ b/src/core/server/plugins/plugins_service.test.ts @@ -1066,32 +1066,46 @@ describe('PluginsService', () => { describe('plugin initialization', () => { beforeEach(() => { + const prebootPlugins = [ + createPlugin('plugin-1-preboot', { + type: PluginType.preboot, + path: 'path-1-preboot', + version: 'version-1', + }), + createPlugin('plugin-2-preboot', { + type: PluginType.preboot, + path: 'path-2-preboot', + version: 'version-2', + }), + ]; + const standardPlugins = [ + createPlugin('plugin-1-standard', { + path: 'path-1-standard', + version: 'version-1', + }), + createPlugin('plugin-2-standard', { + path: 'path-2-standard', + version: 'version-2', + }), + ]; + + for (const plugin of [...prebootPlugins, ...standardPlugins]) { + jest.doMock( + join(plugin.path, 'server'), + () => ({ + config: { + schema: schema.object({ + enabled: schema.maybe(schema.boolean({ defaultValue: true })), + }), + }, + }), + { virtual: true } + ); + } + mockDiscover.mockReturnValue({ error$: from([]), - plugin$: from([ - createPlugin('plugin-1-preboot', { - type: PluginType.preboot, - path: 'path-1-preboot', - version: 'version-1', - configPath: 'plugin1_preboot', - }), - createPlugin('plugin-1-standard', { - path: 'path-1-standard', - version: 'version-1', - configPath: 'plugin1_standard', - }), - createPlugin('plugin-2-preboot', { - type: PluginType.preboot, - path: 'path-2-preboot', - version: 'version-2', - configPath: 'plugin2_preboot', - }), - createPlugin('plugin-2-standard', { - path: 'path-2-standard', - version: 'version-2', - configPath: 'plugin2_standard', - }), - ]), + plugin$: from([...prebootPlugins, ...standardPlugins]), }); prebootMockPluginSystem.uiPlugins.mockReturnValue(new Map()); diff --git a/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker b/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker index 02d4046ca1a22..1827f9b9e8e79 100755 --- a/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker +++ b/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker @@ -23,7 +23,6 @@ kibana_vars=( apm_oss.sourcemapIndices apm_oss.spanIndices apm_oss.transactionIndices - console.enabled console.proxyConfig console.proxyFilter csp.strict @@ -66,7 +65,6 @@ kibana_vars=( elasticsearch.username enterpriseSearch.accessCheckTimeout enterpriseSearch.accessCheckTimeoutWarning - enterpriseSearch.enabled enterpriseSearch.host externalUrl.policy i18n.locale @@ -102,7 +100,6 @@ kibana_vars=( migrations.scrollDuration migrations.skip monitoring.cluster_alerts.email_notifications.email_address - monitoring.enabled monitoring.kibana.collection.enabled monitoring.kibana.collection.interval monitoring.ui.container.elasticsearch.enabled @@ -184,7 +181,6 @@ kibana_vars=( tilemap.options.minZoom tilemap.options.subdomains tilemap.url - url_drilldown.enabled vega.enableExternalUrls vis_type_vega.enableExternalUrls xpack.actions.allowedHosts @@ -209,7 +205,6 @@ kibana_vars=( xpack.alerts.healthCheck.interval xpack.alerts.invalidateApiKeysTask.interval xpack.alerts.invalidateApiKeysTask.removalDelay - xpack.apm.enabled xpack.apm.indices.error xpack.apm.indices.metric xpack.apm.indices.onboarding @@ -229,7 +224,6 @@ kibana_vars=( xpack.banners.placement xpack.banners.textColor xpack.banners.textContent - xpack.canvas.enabled xpack.code.disk.thresholdEnabled xpack.code.disk.watermarkLow xpack.code.indexRepoFrequencyMs @@ -261,14 +255,10 @@ kibana_vars=( xpack.fleet.agents.fleet_server.hosts xpack.fleet.agents.kibana.host xpack.fleet.agents.tlsCheckDisabled - xpack.fleet.enabled xpack.fleet.packages xpack.fleet.registryUrl xpack.graph.canEditDrillDownUrls - xpack.graph.enabled xpack.graph.savePolicy - xpack.grokdebugger.enabled - xpack.infra.enabled xpack.infra.query.partitionFactor xpack.infra.query.partitionSize xpack.infra.sources.default.fields.container @@ -281,13 +271,9 @@ kibana_vars=( xpack.infra.sources.default.metricAlias xpack.ingestManager.fleet.tlsCheckDisabled xpack.ingestManager.registryUrl - xpack.license_management.enabled - xpack.maps.enabled - xpack.ml.enabled xpack.observability.annotations.index xpack.observability.unsafe.alertingExperience.enabled xpack.observability.unsafe.cases.enabled - xpack.painless_lab.enabled xpack.reporting.capture.browser.autoDownload xpack.reporting.capture.browser.chromium.disableSandbox xpack.reporting.capture.browser.chromium.inspect @@ -333,9 +319,7 @@ kibana_vars=( xpack.reporting.queue.timeout xpack.reporting.roles.allow xpack.reporting.roles.enabled - xpack.rollup.enabled xpack.ruleRegistry.write.enabled - xpack.searchprofiler.enabled xpack.security.audit.appender.fileName xpack.security.audit.appender.layout.highlight xpack.security.audit.appender.layout.pattern diff --git a/test/functional/config.js b/test/functional/config.js index 97b3d85a8e243..e0195c4dadc8d 100644 --- a/test/functional/config.js +++ b/test/functional/config.js @@ -46,9 +46,7 @@ export default async function ({ readConfigFile }) { // to be re-enabled once kibana/issues/102552 is completed '--xpack.security.enabled=false', - '--monitoring.enabled=false', '--xpack.reporting.enabled=false', - '--enterpriseSearch.enabled=false', ], }, diff --git a/x-pack/plugins/alerting/server/lib/create_alert_event_log_record_object.test.ts b/x-pack/plugins/alerting/server/lib/create_alert_event_log_record_object.test.ts new file mode 100644 index 0000000000000..0731886bcaeb0 --- /dev/null +++ b/x-pack/plugins/alerting/server/lib/create_alert_event_log_record_object.test.ts @@ -0,0 +1,210 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { createAlertEventLogRecordObject } from './create_alert_event_log_record_object'; +import { UntypedNormalizedAlertType } from '../rule_type_registry'; +import { RecoveredActionGroup } from '../types'; + +describe('createAlertEventLogRecordObject', () => { + const ruleType: jest.Mocked = { + id: 'test', + name: 'My test alert', + actionGroups: [{ id: 'default', name: 'Default' }, RecoveredActionGroup], + defaultActionGroupId: 'default', + minimumLicenseRequired: 'basic', + isExportable: true, + recoveryActionGroup: RecoveredActionGroup, + executor: jest.fn(), + producer: 'alerts', + }; + + test('created alert event "execute-start"', async () => { + expect( + createAlertEventLogRecordObject({ + ruleId: '1', + ruleType, + action: 'execute-start', + timestamp: '1970-01-01T00:00:00.000Z', + task: { + scheduled: '1970-01-01T00:00:00.000Z', + scheduleDelay: 0, + }, + savedObjects: [ + { + id: '1', + type: 'alert', + typeId: ruleType.id, + relation: 'primary', + }, + ], + }) + ).toStrictEqual({ + '@timestamp': '1970-01-01T00:00:00.000Z', + event: { + action: 'execute-start', + category: ['alerts'], + kind: 'alert', + }, + kibana: { + saved_objects: [ + { + id: '1', + namespace: undefined, + rel: 'primary', + type: 'alert', + type_id: 'test', + }, + ], + task: { + schedule_delay: 0, + scheduled: '1970-01-01T00:00:00.000Z', + }, + }, + rule: { + category: 'test', + id: '1', + license: 'basic', + ruleset: 'alerts', + }, + }); + }); + + test('created alert event "recovered-instance"', async () => { + expect( + createAlertEventLogRecordObject({ + ruleId: '1', + ruleName: 'test name', + ruleType, + action: 'recovered-instance', + instanceId: 'test1', + group: 'group 1', + message: 'message text here', + namespace: 'default', + subgroup: 'subgroup value', + state: { + start: '1970-01-01T00:00:00.000Z', + end: '1970-01-01T00:05:00.000Z', + duration: 5, + }, + savedObjects: [ + { + id: '1', + type: 'alert', + typeId: ruleType.id, + relation: 'primary', + }, + ], + }) + ).toStrictEqual({ + event: { + action: 'recovered-instance', + category: ['alerts'], + duration: 5, + end: '1970-01-01T00:05:00.000Z', + kind: 'alert', + start: '1970-01-01T00:00:00.000Z', + }, + kibana: { + alerting: { + action_group_id: 'group 1', + action_subgroup: 'subgroup value', + instance_id: 'test1', + }, + saved_objects: [ + { + id: '1', + namespace: 'default', + rel: 'primary', + type: 'alert', + type_id: 'test', + }, + ], + }, + message: 'message text here', + rule: { + category: 'test', + id: '1', + license: 'basic', + ruleset: 'alerts', + name: 'test name', + }, + }); + }); + + test('created alert event "execute-action"', async () => { + expect( + createAlertEventLogRecordObject({ + ruleId: '1', + ruleName: 'test name', + ruleType, + action: 'execute-action', + instanceId: 'test1', + group: 'group 1', + message: 'action execution start', + namespace: 'default', + subgroup: 'subgroup value', + state: { + start: '1970-01-01T00:00:00.000Z', + end: '1970-01-01T00:05:00.000Z', + duration: 5, + }, + savedObjects: [ + { + id: '1', + type: 'alert', + typeId: ruleType.id, + relation: 'primary', + }, + { + id: '2', + type: 'action', + typeId: '.email', + }, + ], + }) + ).toStrictEqual({ + event: { + action: 'execute-action', + category: ['alerts'], + duration: 5, + end: '1970-01-01T00:05:00.000Z', + kind: 'alert', + start: '1970-01-01T00:00:00.000Z', + }, + kibana: { + alerting: { + action_group_id: 'group 1', + action_subgroup: 'subgroup value', + instance_id: 'test1', + }, + saved_objects: [ + { + id: '1', + namespace: 'default', + rel: 'primary', + type: 'alert', + type_id: 'test', + }, + { + id: '2', + namespace: 'default', + type: 'action', + type_id: '.email', + }, + ], + }, + message: 'action execution start', + rule: { + category: 'test', + id: '1', + license: 'basic', + ruleset: 'alerts', + name: 'test name', + }, + }); + }); +}); diff --git a/x-pack/plugins/alerting/server/lib/create_alert_event_log_record_object.ts b/x-pack/plugins/alerting/server/lib/create_alert_event_log_record_object.ts new file mode 100644 index 0000000000000..12300211cb0bb --- /dev/null +++ b/x-pack/plugins/alerting/server/lib/create_alert_event_log_record_object.ts @@ -0,0 +1,81 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { AlertInstanceState } from '../types'; +import { IEvent } from '../../../event_log/server'; +import { UntypedNormalizedAlertType } from '../rule_type_registry'; + +export type Event = Exclude; + +interface CreateAlertEventLogRecordParams { + ruleId: string; + ruleType: UntypedNormalizedAlertType; + action: string; + ruleName?: string; + instanceId?: string; + message?: string; + state?: AlertInstanceState; + group?: string; + subgroup?: string; + namespace?: string; + timestamp?: string; + task?: { + scheduled?: string; + scheduleDelay?: number; + }; + savedObjects: Array<{ + type: string; + id: string; + typeId: string; + relation?: string; + }>; +} + +export function createAlertEventLogRecordObject(params: CreateAlertEventLogRecordParams): Event { + const { ruleType, action, state, message, task, ruleId, group, subgroup, namespace } = params; + const alerting = + params.instanceId || group || subgroup + ? { + alerting: { + ...(params.instanceId ? { instance_id: params.instanceId } : {}), + ...(group ? { action_group_id: group } : {}), + ...(subgroup ? { action_subgroup: subgroup } : {}), + }, + } + : undefined; + const event: Event = { + ...(params.timestamp ? { '@timestamp': params.timestamp } : {}), + event: { + action, + kind: 'alert', + category: [ruleType.producer], + ...(state?.start ? { start: state.start as string } : {}), + ...(state?.end ? { end: state.end as string } : {}), + ...(state?.duration !== undefined ? { duration: state.duration as number } : {}), + }, + kibana: { + ...(alerting ? alerting : {}), + saved_objects: params.savedObjects.map((so) => ({ + ...(so.relation ? { rel: so.relation } : {}), + type: so.type, + id: so.id, + type_id: so.typeId, + namespace, + })), + ...(task ? { task: { scheduled: task.scheduled, schedule_delay: task.scheduleDelay } } : {}), + }, + ...(message ? { message } : {}), + rule: { + id: ruleId, + license: ruleType.minimumLicenseRequired, + category: ruleType.id, + ruleset: ruleType.producer, + ...(params.ruleName ? { name: params.ruleName } : {}), + }, + }; + return event; +} diff --git a/x-pack/plugins/alerting/server/plugin.ts b/x-pack/plugins/alerting/server/plugin.ts index b63fa94fbad72..3623495058eb0 100644 --- a/x-pack/plugins/alerting/server/plugin.ts +++ b/x-pack/plugins/alerting/server/plugin.ts @@ -373,6 +373,7 @@ export class AlertingPlugin { eventLog: plugins.eventLog, kibanaVersion: this.kibanaVersion, authorization: alertingAuthorizationClientFactory, + eventLogger: this.eventLogger, }); const getRulesClientWithRequest = (request: KibanaRequest) => { diff --git a/x-pack/plugins/alerting/server/rules_client/rules_client.ts b/x-pack/plugins/alerting/server/rules_client/rules_client.ts index 2492517f4bdc3..bde0c35028582 100644 --- a/x-pack/plugins/alerting/server/rules_client/rules_client.ts +++ b/x-pack/plugins/alerting/server/rules_client/rules_client.ts @@ -7,7 +7,7 @@ import Semver from 'semver'; import Boom from '@hapi/boom'; -import { omit, isEqual, map, uniq, pick, truncate, trim } from 'lodash'; +import { omit, isEqual, map, uniq, pick, truncate, trim, mapValues } from 'lodash'; import { i18n } from '@kbn/i18n'; import { estypes } from '@elastic/elasticsearch'; import { @@ -38,6 +38,7 @@ import { AlertWithLegacyId, SanitizedAlertWithLegacyId, PartialAlertWithLegacyId, + RawAlertInstance, } from '../types'; import { validateAlertTypeParams, @@ -60,10 +61,14 @@ import { AlertingAuthorizationFilterType, AlertingAuthorizationFilterOpts, } from '../authorization'; -import { IEventLogClient } from '../../../event_log/server'; +import { + IEvent, + IEventLogClient, + IEventLogger, + SAVED_OBJECT_REL_PRIMARY, +} from '../../../event_log/server'; import { parseIsoOrRelativeDate } from '../lib/iso_or_relative_date'; import { alertInstanceSummaryFromEventLog } from '../lib/alert_instance_summary_from_event_log'; -import { IEvent } from '../../../event_log/server'; import { AuditLogger } from '../../../security/server'; import { parseDuration } from '../../common/parse_duration'; import { retryIfConflicts } from '../lib/retry_if_conflicts'; @@ -73,6 +78,9 @@ import { ruleAuditEvent, RuleAuditAction } from './audit_events'; import { KueryNode, nodeBuilder } from '../../../../../src/plugins/data/common'; import { mapSortField } from './lib'; import { getAlertExecutionStatusPending } from '../lib/alert_execution_status'; +import { AlertInstance } from '../alert_instance'; +import { EVENT_LOG_ACTIONS } from '../plugin'; +import { createAlertEventLogRecordObject } from '../lib/create_alert_event_log_record_object'; export interface RegistryAlertTypeWithAuth extends RegistryRuleType { authorizedConsumers: string[]; @@ -101,6 +109,7 @@ export interface ConstructorOptions { getEventLogClient: () => Promise; kibanaVersion: PluginInitializerContext['env']['packageInfo']['version']; auditLogger?: AuditLogger; + eventLogger?: IEventLogger; } export interface MuteOptions extends IndexType { @@ -215,6 +224,7 @@ export class RulesClient { private readonly encryptedSavedObjectsClient: EncryptedSavedObjectsClient; private readonly kibanaVersion!: PluginInitializerContext['env']['packageInfo']['version']; private readonly auditLogger?: AuditLogger; + private readonly eventLogger?: IEventLogger; constructor({ ruleTypeRegistry, @@ -232,6 +242,7 @@ export class RulesClient { getEventLogClient, kibanaVersion, auditLogger, + eventLogger, }: ConstructorOptions) { this.logger = logger; this.getUserName = getUserName; @@ -248,6 +259,7 @@ export class RulesClient { this.getEventLogClient = getEventLogClient; this.kibanaVersion = kibanaVersion; this.auditLogger = auditLogger; + this.eventLogger = eventLogger; } public async create({ @@ -1199,6 +1211,47 @@ export class RulesClient { version = alert.version; } + if (this.eventLogger && attributes.scheduledTaskId) { + const { state } = taskInstanceToAlertTaskInstance( + await this.taskManager.get(attributes.scheduledTaskId), + attributes as unknown as SanitizedAlert + ); + + const recoveredAlertInstances = mapValues, AlertInstance>( + state.alertInstances ?? {}, + (rawAlertInstance) => new AlertInstance(rawAlertInstance) + ); + const recoveredAlertInstanceIds = Object.keys(recoveredAlertInstances); + + for (const instanceId of recoveredAlertInstanceIds) { + const { group: actionGroup, subgroup: actionSubgroup } = + recoveredAlertInstances[instanceId].getLastScheduledActions() ?? {}; + const instanceState = recoveredAlertInstances[instanceId].getState(); + const message = `instance '${instanceId}' has recovered due to the rule was disabled`; + + const event = createAlertEventLogRecordObject({ + ruleId: id, + ruleName: attributes.name, + ruleType: this.ruleTypeRegistry.get(attributes.alertTypeId), + instanceId, + action: EVENT_LOG_ACTIONS.recoveredInstance, + message, + state: instanceState, + group: actionGroup, + subgroup: actionSubgroup, + namespace: this.namespace, + savedObjects: [ + { + id, + type: 'alert', + typeId: attributes.alertTypeId, + relation: SAVED_OBJECT_REL_PRIMARY, + }, + ], + }); + this.eventLogger.logEvent(event); + } + } try { await this.authorization.ensureAuthorized({ ruleTypeId: attributes.alertTypeId, diff --git a/x-pack/plugins/alerting/server/rules_client/tests/disable.test.ts b/x-pack/plugins/alerting/server/rules_client/tests/disable.test.ts index 6b9b2021db68b..c518d385dd747 100644 --- a/x-pack/plugins/alerting/server/rules_client/tests/disable.test.ts +++ b/x-pack/plugins/alerting/server/rules_client/tests/disable.test.ts @@ -18,6 +18,8 @@ import { InvalidatePendingApiKey } from '../../types'; import { httpServerMock } from '../../../../../../src/core/server/mocks'; import { auditServiceMock } from '../../../../security/server/audit/index.mock'; import { getBeforeSetup, setGlobalDate } from './lib'; +import { eventLoggerMock } from '../../../../event_log/server/event_logger.mock'; +import { TaskStatus } from '../../../../task_manager/server'; const taskManager = taskManagerMock.createStart(); const ruleTypeRegistry = ruleTypeRegistryMock.create(); @@ -26,6 +28,7 @@ const encryptedSavedObjects = encryptedSavedObjectsMock.createClient(); const authorization = alertingAuthorizationMock.create(); const actionsAuthorization = actionsAuthorizationMock.create(); const auditLogger = auditServiceMock.create().asScoped(httpServerMock.createKibanaRequest()); +const eventLogger = eventLoggerMock.create(); const kibanaVersion = 'v7.10.0'; const rulesClientParams: jest.Mocked = { @@ -44,10 +47,26 @@ const rulesClientParams: jest.Mocked = { getEventLogClient: jest.fn(), kibanaVersion, auditLogger, + eventLogger, }; beforeEach(() => { getBeforeSetup(rulesClientParams, taskManager, ruleTypeRegistry); + taskManager.get.mockResolvedValue({ + id: 'task-123', + taskType: 'alerting:123', + scheduledAt: new Date(), + attempts: 1, + status: TaskStatus.Idle, + runAt: new Date(), + startedAt: null, + retryAt: null, + state: {}, + params: { + alertId: '1', + }, + ownerId: null, + }); (auditLogger.log as jest.Mock).mockClear(); }); @@ -217,6 +236,120 @@ describe('disable()', () => { ).toBe('123'); }); + test('disables the rule with calling event log to "recover" the alert instances from the task state', async () => { + unsecuredSavedObjectsClient.create.mockResolvedValueOnce({ + id: '1', + type: 'api_key_pending_invalidation', + attributes: { + apiKeyId: '123', + createdAt: '2019-02-12T21:01:22.479Z', + }, + references: [], + }); + const scheduledTaskId = 'task-123'; + taskManager.get.mockResolvedValue({ + id: scheduledTaskId, + taskType: 'alerting:123', + scheduledAt: new Date(), + attempts: 1, + status: TaskStatus.Idle, + runAt: new Date(), + startedAt: null, + retryAt: null, + state: { + alertInstances: { + '1': { + meta: { + lastScheduledActions: { + group: 'default', + subgroup: 'newSubgroup', + date: new Date().toISOString(), + }, + }, + state: { bar: false }, + }, + }, + }, + params: { + alertId: '1', + }, + ownerId: null, + }); + await rulesClient.disable({ id: '1' }); + expect(unsecuredSavedObjectsClient.get).not.toHaveBeenCalled(); + expect(encryptedSavedObjects.getDecryptedAsInternalUser).toHaveBeenCalledWith('alert', '1', { + namespace: 'default', + }); + expect(unsecuredSavedObjectsClient.update).toHaveBeenCalledWith( + 'alert', + '1', + { + consumer: 'myApp', + schedule: { interval: '10s' }, + alertTypeId: 'myType', + enabled: false, + meta: { + versionApiKeyLastmodified: kibanaVersion, + }, + scheduledTaskId: null, + apiKey: null, + apiKeyOwner: null, + updatedAt: '2019-02-12T21:01:22.479Z', + updatedBy: 'elastic', + actions: [ + { + group: 'default', + id: '1', + actionTypeId: '1', + actionRef: '1', + params: { + foo: true, + }, + }, + ], + }, + { + version: '123', + } + ); + expect(taskManager.removeIfExists).toHaveBeenCalledWith('task-123'); + expect( + (unsecuredSavedObjectsClient.create.mock.calls[0][1] as InvalidatePendingApiKey).apiKeyId + ).toBe('123'); + + expect(eventLogger.logEvent).toHaveBeenCalledTimes(1); + expect(eventLogger.logEvent.mock.calls[0][0]).toStrictEqual({ + event: { + action: 'recovered-instance', + category: ['alerts'], + kind: 'alert', + }, + kibana: { + alerting: { + action_group_id: 'default', + action_subgroup: 'newSubgroup', + instance_id: '1', + }, + saved_objects: [ + { + id: '1', + namespace: 'default', + rel: 'primary', + type: 'alert', + type_id: 'myType', + }, + ], + }, + message: "instance '1' has recovered due to the rule was disabled", + rule: { + category: '123', + id: '1', + license: 'basic', + ruleset: 'alerts', + }, + }); + }); + test('falls back when getDecryptedAsInternalUser throws an error', async () => { encryptedSavedObjects.getDecryptedAsInternalUser.mockRejectedValueOnce(new Error('Fail')); unsecuredSavedObjectsClient.create.mockResolvedValueOnce({ diff --git a/x-pack/plugins/alerting/server/rules_client_conflict_retries.test.ts b/x-pack/plugins/alerting/server/rules_client_conflict_retries.test.ts index dfc55efad41c6..0b35f250ba3c6 100644 --- a/x-pack/plugins/alerting/server/rules_client_conflict_retries.test.ts +++ b/x-pack/plugins/alerting/server/rules_client_conflict_retries.test.ts @@ -325,6 +325,22 @@ beforeEach(() => { params: {}, }); + taskManager.get.mockResolvedValue({ + id: 'task-123', + taskType: 'alerting:123', + scheduledAt: new Date(), + attempts: 1, + status: TaskStatus.Idle, + runAt: new Date(), + startedAt: null, + retryAt: null, + state: {}, + params: { + alertId: '1', + }, + ownerId: null, + }); + const actionsClient = actionsClientMock.create(); actionsClient.getBulk.mockResolvedValue([]); rulesClientParams.getActionsClient.mockResolvedValue(actionsClient); diff --git a/x-pack/plugins/alerting/server/rules_client_factory.ts b/x-pack/plugins/alerting/server/rules_client_factory.ts index 7961d3761d3ef..1e9a021a0be51 100644 --- a/x-pack/plugins/alerting/server/rules_client_factory.ts +++ b/x-pack/plugins/alerting/server/rules_client_factory.ts @@ -17,7 +17,7 @@ import { RuleTypeRegistry, SpaceIdToNamespaceFunction } from './types'; import { SecurityPluginSetup, SecurityPluginStart } from '../../security/server'; import { EncryptedSavedObjectsClient } from '../../encrypted_saved_objects/server'; import { TaskManagerStartContract } from '../../task_manager/server'; -import { IEventLogClientService } from '../../../plugins/event_log/server'; +import { IEventLogClientService, IEventLogger } from '../../../plugins/event_log/server'; import { AlertingAuthorizationClientFactory } from './alerting_authorization_client_factory'; export interface RulesClientFactoryOpts { logger: Logger; @@ -32,6 +32,7 @@ export interface RulesClientFactoryOpts { eventLog: IEventLogClientService; kibanaVersion: PluginInitializerContext['env']['packageInfo']['version']; authorization: AlertingAuthorizationClientFactory; + eventLogger?: IEventLogger; } export class RulesClientFactory { @@ -48,6 +49,7 @@ export class RulesClientFactory { private eventLog!: IEventLogClientService; private kibanaVersion!: PluginInitializerContext['env']['packageInfo']['version']; private authorization!: AlertingAuthorizationClientFactory; + private eventLogger?: IEventLogger; public initialize(options: RulesClientFactoryOpts) { if (this.isInitialized) { @@ -66,6 +68,7 @@ export class RulesClientFactory { this.eventLog = options.eventLog; this.kibanaVersion = options.kibanaVersion; this.authorization = options.authorization; + this.eventLogger = options.eventLogger; } public create(request: KibanaRequest, savedObjects: SavedObjectsServiceStart): RulesClient { @@ -123,6 +126,7 @@ export class RulesClientFactory { async getEventLogClient() { return eventLog.getClient(request); }, + eventLogger: this.eventLogger, }); } } diff --git a/x-pack/plugins/alerting/server/task_runner/create_execution_handler.test.ts b/x-pack/plugins/alerting/server/task_runner/create_execution_handler.test.ts index e3946599aed85..244dcb85b13e9 100644 --- a/x-pack/plugins/alerting/server/task_runner/create_execution_handler.test.ts +++ b/x-pack/plugins/alerting/server/task_runner/create_execution_handler.test.ts @@ -175,7 +175,6 @@ test('enqueues execution per selected action', async () => { "kibana": Object { "alerting": Object { "action_group_id": "default", - "action_subgroup": undefined, "instance_id": "2", }, "saved_objects": Array [ diff --git a/x-pack/plugins/alerting/server/task_runner/create_execution_handler.ts b/x-pack/plugins/alerting/server/task_runner/create_execution_handler.ts index 51301a80b1664..652e032a1cbb0 100644 --- a/x-pack/plugins/alerting/server/task_runner/create_execution_handler.ts +++ b/x-pack/plugins/alerting/server/task_runner/create_execution_handler.ts @@ -10,7 +10,7 @@ import { asSavedObjectExecutionSource, PluginStartContract as ActionsPluginStartContract, } from '../../../actions/server'; -import { IEventLogger, IEvent, SAVED_OBJECT_REL_PRIMARY } from '../../../event_log/server'; +import { IEventLogger, SAVED_OBJECT_REL_PRIMARY } from '../../../event_log/server'; import { EVENT_LOG_ACTIONS } from '../plugin'; import { injectActionParams } from './inject_action_params'; import { @@ -21,8 +21,9 @@ import { AlertInstanceContext, RawAlert, } from '../types'; -import { NormalizedAlertType } from '../rule_type_registry'; +import { NormalizedAlertType, UntypedNormalizedAlertType } from '../rule_type_registry'; import { isEphemeralTaskRejectedDueToCapacityError } from '../../../task_manager/server'; +import { createAlertEventLogRecordObject } from '../lib/create_alert_event_log_record_object'; export interface CreateExecutionHandlerOptions< Params extends AlertTypeParams, @@ -201,43 +202,35 @@ export function createExecutionHandler< await actionsClient.enqueueExecution(enqueueOptions); } - const event: IEvent = { - event: { - action: EVENT_LOG_ACTIONS.executeAction, - kind: 'alert', - category: [alertType.producer], - }, - kibana: { - alerting: { - instance_id: alertInstanceId, - action_group_id: actionGroup, - action_subgroup: actionSubgroup, + const event = createAlertEventLogRecordObject({ + ruleId: alertId, + ruleType: alertType as UntypedNormalizedAlertType, + action: EVENT_LOG_ACTIONS.executeAction, + instanceId: alertInstanceId, + group: actionGroup, + subgroup: actionSubgroup, + ruleName: alertName, + savedObjects: [ + { + type: 'alert', + id: alertId, + typeId: alertType.id, + relation: SAVED_OBJECT_REL_PRIMARY, }, - saved_objects: [ - { - rel: SAVED_OBJECT_REL_PRIMARY, - type: 'alert', - id: alertId, - type_id: alertType.id, - ...namespace, - }, - { type: 'action', id: action.id, type_id: action.actionTypeId, ...namespace }, - ], - }, - rule: { - id: alertId, - license: alertType.minimumLicenseRequired, - category: alertType.id, - ruleset: alertType.producer, - name: alertName, - }, - }; + { + type: 'action', + id: action.id, + typeId: action.actionTypeId, + }, + ], + ...namespace, + message: `alert: ${alertLabel} instanceId: '${alertInstanceId}' scheduled ${ + actionSubgroup + ? `actionGroup(subgroup): '${actionGroup}(${actionSubgroup})'` + : `actionGroup: '${actionGroup}'` + } action: ${actionLabel}`, + }); - event.message = `alert: ${alertLabel} instanceId: '${alertInstanceId}' scheduled ${ - actionSubgroup - ? `actionGroup(subgroup): '${actionGroup}(${actionSubgroup})'` - : `actionGroup: '${actionGroup}'` - } action: ${actionLabel}`; eventLogger.logEvent(event); } }; diff --git a/x-pack/plugins/alerting/server/task_runner/task_runner.test.ts b/x-pack/plugins/alerting/server/task_runner/task_runner.test.ts index c5ccc909eff46..07c4d0371c718 100644 --- a/x-pack/plugins/alerting/server/task_runner/task_runner.test.ts +++ b/x-pack/plugins/alerting/server/task_runner/task_runner.test.ts @@ -1379,7 +1379,6 @@ describe('Task Runner', () => { "kibana": Object { "alerting": Object { "action_group_id": "default", - "action_subgroup": undefined, "instance_id": "1", }, "saved_objects": Array [ @@ -1676,7 +1675,6 @@ describe('Task Runner', () => { "kibana": Object { "alerting": Object { "action_group_id": "recovered", - "action_subgroup": undefined, "instance_id": "2", }, "saved_objects": Array [ @@ -1717,7 +1715,6 @@ describe('Task Runner', () => { "kibana": Object { "alerting": Object { "action_group_id": "default", - "action_subgroup": undefined, "instance_id": "1", }, "saved_objects": Array [ diff --git a/x-pack/plugins/alerting/server/task_runner/task_runner.ts b/x-pack/plugins/alerting/server/task_runner/task_runner.ts index edf9bfe1b4846..8b93d3fa17211 100644 --- a/x-pack/plugins/alerting/server/task_runner/task_runner.ts +++ b/x-pack/plugins/alerting/server/task_runner/task_runner.ts @@ -49,16 +49,18 @@ import { AlertInstanceContext, WithoutReservedActionGroups, } from '../../common'; -import { NormalizedAlertType } from '../rule_type_registry'; +import { NormalizedAlertType, UntypedNormalizedAlertType } from '../rule_type_registry'; import { getEsErrorMessage } from '../lib/errors'; +import { + createAlertEventLogRecordObject, + Event, +} from '../lib/create_alert_event_log_record_object'; const FALLBACK_RETRY_INTERVAL = '5m'; // 1,000,000 nanoseconds in 1 millisecond const Millis2Nanos = 1000 * 1000; -type Event = Exclude; - interface AlertTaskRunResult { state: AlertTaskState; schedule: IntervalSchedule | undefined; @@ -517,37 +519,26 @@ export class TaskRunner< const namespace = this.context.spaceIdToNamespace(spaceId); const eventLogger = this.context.eventLogger; const scheduleDelay = runDate.getTime() - this.taskInstance.runAt.getTime(); - const event: IEvent = { - // explicitly set execute timestamp so it will be before other events - // generated here (new-instance, schedule-action, etc) - '@timestamp': runDateString, - event: { - action: EVENT_LOG_ACTIONS.execute, - kind: 'alert', - category: [this.alertType.producer], + + const event = createAlertEventLogRecordObject({ + timestamp: runDateString, + ruleId: alertId, + ruleType: this.alertType as UntypedNormalizedAlertType, + action: EVENT_LOG_ACTIONS.execute, + namespace, + task: { + scheduled: this.taskInstance.runAt.toISOString(), + scheduleDelay: Millis2Nanos * scheduleDelay, }, - kibana: { - saved_objects: [ - { - rel: SAVED_OBJECT_REL_PRIMARY, - type: 'alert', - id: alertId, - type_id: this.alertType.id, - namespace, - }, - ], - task: { - scheduled: this.taskInstance.runAt.toISOString(), - schedule_delay: Millis2Nanos * scheduleDelay, + savedObjects: [ + { + id: alertId, + type: 'alert', + typeId: this.alertType.id, + relation: SAVED_OBJECT_REL_PRIMARY, }, - }, - rule: { - id: alertId, - license: this.alertType.minimumLicenseRequired, - category: this.alertType.id, - ruleset: this.alertType.producer, - }, - }; + ], + }); eventLogger.startTiming(event); diff --git a/x-pack/plugins/apm/server/index.ts b/x-pack/plugins/apm/server/index.ts index abf9b3f5fb774..1ed54be0271dd 100644 --- a/x-pack/plugins/apm/server/index.ts +++ b/x-pack/plugins/apm/server/index.ts @@ -17,7 +17,6 @@ import { APMPlugin } from './plugin'; // All options should be documented in the APM configuration settings: https://github.com/elastic/kibana/blob/master/docs/settings/apm-settings.asciidoc // and be included on cloud allow list unless there are specific reasons not to const configSchema = schema.object({ - enabled: schema.boolean({ defaultValue: true }), serviceMapEnabled: schema.boolean({ defaultValue: true }), serviceMapFingerprintBucketSize: schema.number({ defaultValue: 100 }), serviceMapTraceIdBucketSize: schema.number({ defaultValue: 65 }), @@ -60,13 +59,7 @@ const configSchema = schema.object({ // plugin config export const config: PluginConfigDescriptor = { - deprecations: ({ - deprecate, - renameFromRoot, - deprecateFromRoot, - unusedFromRoot, - }) => [ - deprecate('enabled', '8.0.0'), + deprecations: ({ renameFromRoot, deprecateFromRoot, unusedFromRoot }) => [ renameFromRoot( 'apm_oss.transactionIndices', 'xpack.apm.indices.transaction' diff --git a/x-pack/plugins/cases/server/config.ts b/x-pack/plugins/cases/server/config.ts index 7a81c47937a6c..bbda9fa7a32ae 100644 --- a/x-pack/plugins/cases/server/config.ts +++ b/x-pack/plugins/cases/server/config.ts @@ -8,7 +8,6 @@ import { schema, TypeOf } from '@kbn/config-schema'; export const ConfigSchema = schema.object({ - enabled: schema.boolean({ defaultValue: true }), markdownPlugins: schema.object({ lens: schema.boolean({ defaultValue: true }), }), diff --git a/x-pack/plugins/cases/server/index.ts b/x-pack/plugins/cases/server/index.ts index ad76724eb49f7..5e433b46b80e5 100644 --- a/x-pack/plugins/cases/server/index.ts +++ b/x-pack/plugins/cases/server/index.ts @@ -15,8 +15,7 @@ export const config: PluginConfigDescriptor = { exposeToBrowser: { markdownPlugins: true, }, - deprecations: ({ deprecate, renameFromRoot }) => [ - deprecate('enabled', '8.0.0'), + deprecations: ({ renameFromRoot }) => [ renameFromRoot('xpack.case.enabled', 'xpack.cases.enabled'), ], }; diff --git a/x-pack/plugins/cases/server/plugin.ts b/x-pack/plugins/cases/server/plugin.ts index c04e495889a74..bef8d45bd86f6 100644 --- a/x-pack/plugins/cases/server/plugin.ts +++ b/x-pack/plugins/cases/server/plugin.ts @@ -15,7 +15,6 @@ import { } from '../../actions/server'; import { APP_ID, ENABLE_CASE_CONNECTOR } from '../common'; -import { ConfigType } from './config'; import { initCaseApi } from './routes/api'; import { createCaseCommentSavedObjectType, @@ -34,10 +33,6 @@ import { SpacesPluginStart } from '../../spaces/server'; import { PluginStartContract as FeaturesPluginStart } from '../../features/server'; import { LensServerPluginSetup } from '../../lens/server'; -function createConfig(context: PluginInitializerContext) { - return context.config.get(); -} - export interface PluginsSetup { security?: SecurityPluginSetup; actions: ActionsPluginSetup; @@ -76,12 +71,6 @@ export class CasePlugin { } public setup(core: CoreSetup, plugins: PluginsSetup) { - const config = createConfig(this.initializerContext); - - if (!config.enabled) { - return; - } - this.securityPluginSetup = plugins.security; this.lensEmbeddableFactory = plugins.lens.lensEmbeddableFactory; diff --git a/x-pack/plugins/cloud/server/config.ts b/x-pack/plugins/cloud/server/config.ts index 2cc413178c3ae..109987cd72d44 100644 --- a/x-pack/plugins/cloud/server/config.ts +++ b/x-pack/plugins/cloud/server/config.ts @@ -29,7 +29,6 @@ const fullStoryConfigSchema = schema.object({ }); const configSchema = schema.object({ - enabled: schema.boolean({ defaultValue: true }), id: schema.maybe(schema.string()), apm: schema.maybe(apmConfigSchema), cname: schema.maybe(schema.string()), @@ -52,6 +51,5 @@ export const config: PluginConfigDescriptor = { organization_url: true, full_story: true, }, - deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')], schema: configSchema, }; diff --git a/x-pack/plugins/encrypted_saved_objects/server/config.test.ts b/x-pack/plugins/encrypted_saved_objects/server/config.test.ts index 1cc5f7974cb13..ea22446d289ae 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/config.test.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/config.test.ts @@ -11,7 +11,6 @@ describe('config schema', () => { it('generates proper defaults', () => { expect(ConfigSchema.validate({})).toMatchInlineSnapshot(` Object { - "enabled": true, "encryptionKey": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "keyRotation": Object { "decryptionOnlyKeys": Array [], @@ -21,7 +20,6 @@ describe('config schema', () => { expect(ConfigSchema.validate({}, { dist: false })).toMatchInlineSnapshot(` Object { - "enabled": true, "encryptionKey": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "keyRotation": Object { "decryptionOnlyKeys": Array [], @@ -32,7 +30,6 @@ describe('config schema', () => { expect(ConfigSchema.validate({ encryptionKey: 'z'.repeat(32) }, { dist: true })) .toMatchInlineSnapshot(` Object { - "enabled": true, "encryptionKey": "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz", "keyRotation": Object { "decryptionOnlyKeys": Array [], @@ -42,7 +39,6 @@ describe('config schema', () => { expect(ConfigSchema.validate({}, { dist: true })).toMatchInlineSnapshot(` Object { - "enabled": true, "keyRotation": Object { "decryptionOnlyKeys": Array [], }, @@ -61,7 +57,6 @@ describe('config schema', () => { ) ).toMatchInlineSnapshot(` Object { - "enabled": true, "encryptionKey": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "keyRotation": Object { "decryptionOnlyKeys": Array [ diff --git a/x-pack/plugins/encrypted_saved_objects/server/config.ts b/x-pack/plugins/encrypted_saved_objects/server/config.ts index fc86336d44836..2cf7c12f95d55 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/config.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/config.ts @@ -12,7 +12,6 @@ export type ConfigType = TypeOf; export const ConfigSchema = schema.object( { - enabled: schema.boolean({ defaultValue: true }), encryptionKey: schema.conditional( schema.contextRef('dist'), true, diff --git a/x-pack/plugins/encrypted_saved_objects/server/index.ts b/x-pack/plugins/encrypted_saved_objects/server/index.ts index b765f1fcaf6fa..d462f06939f6b 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/index.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/index.ts @@ -17,7 +17,6 @@ export type { IsMigrationNeededPredicate } from './create_migration'; export const config: PluginConfigDescriptor = { schema: ConfigSchema, - deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')], }; export const plugin = (initializerContext: PluginInitializerContext) => new EncryptedSavedObjectsPlugin(initializerContext); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_buttons.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_buttons.test.tsx index f293a0050eac9..cef0a8d05ec6b 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_buttons.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_buttons.test.tsx @@ -5,10 +5,13 @@ * 2.0. */ +import '../../../__mocks__/react_router'; +import '../../../__mocks__/shallow_useeffect.mock'; import { setMockActions } from '../../../__mocks__/kea_logic'; import '../../__mocks__/engine_logic.mock'; import React from 'react'; +import { useLocation } from 'react-router-dom'; import { shallow } from 'enzyme'; @@ -60,4 +63,20 @@ describe('DocumentCreationButtons', () => { expect(wrapper.find(EuiCardTo).prop('to')).toEqual('/engines/some-engine/crawler'); }); + + it('calls openDocumentCreation("file") if ?method=json', () => { + const search = '?method=json'; + (useLocation as jest.Mock).mockImplementationOnce(() => ({ search })); + + shallow(); + expect(actions.openDocumentCreation).toHaveBeenCalledWith('file'); + }); + + it('calls openDocumentCreation("api") if ?method=api', () => { + const search = '?method=api'; + (useLocation as jest.Mock).mockImplementationOnce(() => ({ search })); + + shallow(); + expect(actions.openDocumentCreation).toHaveBeenCalledWith('api'); + }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_buttons.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_buttons.tsx index 5bc0fffdf1963..8d48460777b40 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_buttons.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_buttons.tsx @@ -5,8 +5,11 @@ * 2.0. */ -import React from 'react'; +import React, { useEffect } from 'react'; +import { useLocation } from 'react-router-dom'; + +import { Location } from 'history'; import { useActions } from 'kea'; import { @@ -22,6 +25,7 @@ import { import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; +import { parseQueryParams } from '../../../shared/query_params'; import { EuiCardTo } from '../../../shared/react_router_helpers'; import { DOCS_PREFIX, ENGINE_CRAWLER_PATH } from '../../routes'; import { generateEnginePath } from '../engine'; @@ -35,6 +39,20 @@ interface Props { export const DocumentCreationButtons: React.FC = ({ disabled = false }) => { const { openDocumentCreation } = useActions(DocumentCreationLogic); + const { search } = useLocation() as Location; + const { method } = parseQueryParams(search); + + useEffect(() => { + switch (method) { + case 'json': + openDocumentCreation('file'); + break; + case 'api': + openDocumentCreation('api'); + break; + } + }, []); + const crawlerLink = generateEnginePath(ENGINE_CRAWLER_PATH); return ( diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation.test.tsx index b91e33d1c8a92..2316227a27fc7 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation.test.tsx @@ -5,9 +5,12 @@ * 2.0. */ +import '../../../__mocks__/react_router'; +import '../../../__mocks__/shallow_useeffect.mock'; import { setMockActions, setMockValues } from '../../../__mocks__/kea_logic'; import React from 'react'; +import { useLocation } from 'react-router-dom'; import { shallow } from 'enzyme'; @@ -15,6 +18,7 @@ import { EngineCreation } from './'; describe('EngineCreation', () => { const DEFAULT_VALUES = { + ingestionMethod: '', isLoading: false, name: '', rawName: '', @@ -22,6 +26,7 @@ describe('EngineCreation', () => { }; const MOCK_ACTIONS = { + setIngestionMethod: jest.fn(), setRawName: jest.fn(), setLanguage: jest.fn(), submitEngine: jest.fn(), @@ -38,6 +43,14 @@ describe('EngineCreation', () => { expect(wrapper.find('[data-test-subj="EngineCreation"]')).toHaveLength(1); }); + it('EngineCreationLanguageInput calls setIngestionMethod on mount', () => { + const search = '?method=crawler'; + (useLocation as jest.Mock).mockImplementationOnce(() => ({ search })); + + shallow(); + expect(MOCK_ACTIONS.setIngestionMethod).toHaveBeenCalledWith('crawler'); + }); + it('EngineCreationForm calls submitEngine on form submit', () => { const wrapper = shallow(); const simulatedEvent = { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation.tsx index 18b8390081467..d8a651aa73d7d 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation.tsx @@ -5,8 +5,11 @@ * 2.0. */ -import React from 'react'; +import React, { useEffect } from 'react'; +import { useLocation } from 'react-router-dom'; + +import { Location } from 'history'; import { useActions, useValues } from 'kea'; import { @@ -22,6 +25,7 @@ import { EuiButton, } from '@elastic/eui'; +import { parseQueryParams } from '../../../shared/query_params'; import { ENGINES_TITLE } from '../engines'; import { AppSearchPageTemplate } from '../layout'; @@ -39,8 +43,18 @@ import { import { EngineCreationLogic } from './engine_creation_logic'; export const EngineCreation: React.FC = () => { + const { search } = useLocation() as Location; + const { method } = parseQueryParams(search); + const { name, rawName, language, isLoading } = useValues(EngineCreationLogic); - const { setLanguage, setRawName, submitEngine } = useActions(EngineCreationLogic); + const { setIngestionMethod, setLanguage, setRawName, submitEngine } = + useActions(EngineCreationLogic); + + useEffect(() => { + if (typeof method === 'string') { + setIngestionMethod(method); + } + }, []); return ( { const { flashSuccessToast, flashAPIErrors } = mockFlashMessageHelpers; const DEFAULT_VALUES = { + ingestionMethod: '', isLoading: false, name: '', rawName: '', @@ -35,6 +36,17 @@ describe('EngineCreationLogic', () => { }); describe('actions', () => { + describe('setIngestionMethod', () => { + it('sets ingestion method to the provided value', () => { + mount(); + EngineCreationLogic.actions.setIngestionMethod('crawler'); + expect(EngineCreationLogic.values).toEqual({ + ...DEFAULT_VALUES, + ingestionMethod: 'crawler', + }); + }); + }); + describe('setLanguage', () => { it('sets language to the provided value', () => { mount(); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation_logic.ts index 96be98053c56c..d62ed6dc33032 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation_logic.ts @@ -5,20 +5,19 @@ * 2.0. */ -import { generatePath } from 'react-router-dom'; - import { kea, MakeLogicType } from 'kea'; import { flashAPIErrors, flashSuccessToast } from '../../../shared/flash_messages'; import { HttpLogic } from '../../../shared/http'; import { KibanaLogic } from '../../../shared/kibana'; -import { ENGINE_PATH } from '../../routes'; import { formatApiName } from '../../utils/format_api_name'; import { DEFAULT_LANGUAGE, ENGINE_CREATION_SUCCESS_MESSAGE } from './constants'; +import { getRedirectToAfterEngineCreation } from './utils'; interface EngineCreationActions { onEngineCreationSuccess(): void; + setIngestionMethod(method: string): { method: string }; setLanguage(language: string): { language: string }; setRawName(rawName: string): { rawName: string }; submitEngine(): void; @@ -26,6 +25,7 @@ interface EngineCreationActions { } interface EngineCreationValues { + ingestionMethod: string; isLoading: boolean; language: string; name: string; @@ -36,12 +36,19 @@ export const EngineCreationLogic = kea ({ method }), setLanguage: (language) => ({ language }), setRawName: (rawName) => ({ rawName }), submitEngine: true, onSubmitError: true, }, reducers: { + ingestionMethod: [ + '', + { + setIngestionMethod: (_, { method }) => method, + }, + ], isLoading: [ false, { @@ -81,12 +88,12 @@ export const EngineCreationLogic = kea { - const { name } = values; + const { ingestionMethod, name } = values; const { navigateToUrl } = KibanaLogic.values; - const enginePath = generatePath(ENGINE_PATH, { engineName: name }); + const toUrl = getRedirectToAfterEngineCreation({ ingestionMethod, engineName: name }); flashSuccessToast(ENGINE_CREATION_SUCCESS_MESSAGE(name)); - navigateToUrl(enginePath); + navigateToUrl(toUrl); }, }), }); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/utils.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/utils.test.ts new file mode 100644 index 0000000000000..4c8909a87cf53 --- /dev/null +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/utils.test.ts @@ -0,0 +1,28 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { getRedirectToAfterEngineCreation } from './utils'; + +describe('getRedirectToAfterEngineCreation', () => { + it('returns crawler path when ingestionMethod is crawler', () => { + const engineName = 'elastic'; + const redirectTo = getRedirectToAfterEngineCreation({ ingestionMethod: 'crawler', engineName }); + expect(redirectTo).toEqual('/engines/elastic/crawler'); + }); + + it('returns engine overview path when there is no ingestionMethod', () => { + const engineName = 'elastic'; + const redirectTo = getRedirectToAfterEngineCreation({ ingestionMethod: '', engineName }); + expect(redirectTo).toEqual('/engines/elastic'); + }); + + it('returns engine overview path with query param when there is ingestionMethod', () => { + const engineName = 'elastic'; + const redirectTo = getRedirectToAfterEngineCreation({ ingestionMethod: 'api', engineName }); + expect(redirectTo).toEqual('/engines/elastic?method=api'); + }); +}); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/utils.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/utils.ts new file mode 100644 index 0000000000000..1f50a5c31e11a --- /dev/null +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/utils.ts @@ -0,0 +1,29 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { generatePath } from 'react-router-dom'; + +import { ENGINE_CRAWLER_PATH, ENGINE_PATH } from '../../routes'; + +export const getRedirectToAfterEngineCreation = ({ + ingestionMethod, + engineName, +}: { + ingestionMethod?: string; + engineName: string; +}): string => { + if (ingestionMethod === 'crawler') { + return generatePath(ENGINE_CRAWLER_PATH, { engineName }); + } + + let enginePath = generatePath(ENGINE_PATH, { engineName }); + if (ingestionMethod) { + enginePath += `?method=${encodeURIComponent(ingestionMethod)}`; + } + + return enginePath; +}; diff --git a/x-pack/plugins/enterprise_search/server/__mocks__/routerDependencies.mock.ts b/x-pack/plugins/enterprise_search/server/__mocks__/routerDependencies.mock.ts index 08be1a134ae02..1bd47c94a84b7 100644 --- a/x-pack/plugins/enterprise_search/server/__mocks__/routerDependencies.mock.ts +++ b/x-pack/plugins/enterprise_search/server/__mocks__/routerDependencies.mock.ts @@ -19,7 +19,6 @@ export const mockRequestHandler = { }; export const mockConfig = { - enabled: true, host: 'http://localhost:3002', accessCheckTimeout: 5000, accessCheckTimeoutWarning: 300, diff --git a/x-pack/plugins/enterprise_search/server/index.ts b/x-pack/plugins/enterprise_search/server/index.ts index dae584a883bd7..6d8a16fd6844a 100644 --- a/x-pack/plugins/enterprise_search/server/index.ts +++ b/x-pack/plugins/enterprise_search/server/index.ts @@ -16,7 +16,6 @@ export const plugin = (initializerContext: PluginInitializerContext) => { export const configSchema = schema.object({ host: schema.maybe(schema.string()), - enabled: schema.boolean({ defaultValue: true }), accessCheckTimeout: schema.number({ defaultValue: 5000 }), accessCheckTimeoutWarning: schema.number({ defaultValue: 300 }), ssl: schema.object({ @@ -37,5 +36,4 @@ export const config: PluginConfigDescriptor = { exposeToBrowser: { host: true, }, - deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')], }; diff --git a/x-pack/plugins/fleet/server/index.ts b/x-pack/plugins/fleet/server/index.ts index cc754b87686e6..9ce361503ddf3 100644 --- a/x-pack/plugins/fleet/server/index.ts +++ b/x-pack/plugins/fleet/server/index.ts @@ -43,8 +43,7 @@ export const config: PluginConfigDescriptor = { epm: true, agents: true, }, - deprecations: ({ deprecate, renameFromRoot, unused, unusedFromRoot }) => [ - deprecate('enabled', '8.0.0'), + deprecations: ({ renameFromRoot, unused, unusedFromRoot }) => [ // Fleet plugin was named ingestManager before renameFromRoot('xpack.ingestManager.enabled', 'xpack.fleet.enabled'), renameFromRoot('xpack.ingestManager.registryUrl', 'xpack.fleet.registryUrl'), @@ -103,7 +102,6 @@ export const config: PluginConfigDescriptor = { }, ], schema: schema.object({ - enabled: schema.boolean({ defaultValue: true }), registryUrl: schema.maybe(schema.uri({ scheme: ['http', 'https'] })), registryProxyUrl: schema.maybe(schema.uri({ scheme: ['http', 'https'] })), agents: schema.object({ diff --git a/x-pack/plugins/graph/config.ts b/x-pack/plugins/graph/config.ts index d1a84246172b7..44cd9cb32e263 100644 --- a/x-pack/plugins/graph/config.ts +++ b/x-pack/plugins/graph/config.ts @@ -8,7 +8,6 @@ import { schema, TypeOf } from '@kbn/config-schema'; export const configSchema = schema.object({ - enabled: schema.boolean({ defaultValue: true }), savePolicy: schema.oneOf( [ schema.literal('none'), diff --git a/x-pack/plugins/graph/server/index.ts b/x-pack/plugins/graph/server/index.ts index 528e122da9a4d..10ddca631a898 100644 --- a/x-pack/plugins/graph/server/index.ts +++ b/x-pack/plugins/graph/server/index.ts @@ -18,5 +18,4 @@ export const config: PluginConfigDescriptor = { savePolicy: true, }, schema: configSchema, - deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')], }; diff --git a/x-pack/plugins/infra/server/plugin.ts b/x-pack/plugins/infra/server/plugin.ts index b77b81cf41ee1..d1ea60dd23dfc 100644 --- a/x-pack/plugins/infra/server/plugin.ts +++ b/x-pack/plugins/infra/server/plugin.ts @@ -43,7 +43,6 @@ import { RulesService } from './services/rules'; export const config: PluginConfigDescriptor = { schema: schema.object({ - enabled: schema.boolean({ defaultValue: true }), inventory: schema.object({ compositeSize: schema.number({ defaultValue: 2000 }), }), @@ -68,7 +67,6 @@ export const config: PluginConfigDescriptor = { }) ), }), - deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')], }; export type InfraConfig = TypeOf; diff --git a/x-pack/plugins/lens/config.ts b/x-pack/plugins/lens/config.ts deleted file mode 100644 index 56e97d1be7b80..0000000000000 --- a/x-pack/plugins/lens/config.ts +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { schema, TypeOf } from '@kbn/config-schema'; - -export const configSchema = schema.object({ - enabled: schema.boolean({ defaultValue: true }), -}); - -export type ConfigSchema = TypeOf; diff --git a/x-pack/plugins/lens/server/index.ts b/x-pack/plugins/lens/server/index.ts index e2117506e9b72..a87cd3b2d5fad 100644 --- a/x-pack/plugins/lens/server/index.ts +++ b/x-pack/plugins/lens/server/index.ts @@ -8,19 +8,12 @@ // TODO: https://github.com/elastic/kibana/issues/110891 /* eslint-disable @kbn/eslint/no_export_all */ -import { PluginInitializerContext, PluginConfigDescriptor } from 'kibana/server'; +import { PluginInitializerContext } from 'kibana/server'; import { LensServerPlugin } from './plugin'; export type { LensServerPluginSetup } from './plugin'; export * from './plugin'; export * from './migrations/types'; -import { configSchema, ConfigSchema } from '../config'; - -export const config: PluginConfigDescriptor = { - schema: configSchema, - deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')], -}; - export const plugin = (initializerContext: PluginInitializerContext) => new LensServerPlugin(initializerContext); diff --git a/x-pack/plugins/lists/server/config.mock.ts b/x-pack/plugins/lists/server/config.mock.ts index e7c4a4ecee4ab..98d59ef1c2a4d 100644 --- a/x-pack/plugins/lists/server/config.mock.ts +++ b/x-pack/plugins/lists/server/config.mock.ts @@ -21,7 +21,6 @@ export const getConfigMock = (): Partial => ({ }); export const getConfigMockDecoded = (): ConfigType => ({ - enabled: true, importBufferSize: IMPORT_BUFFER_SIZE, importTimeout: IMPORT_TIMEOUT, listIndex: LIST_INDEX, diff --git a/x-pack/plugins/lists/server/config.ts b/x-pack/plugins/lists/server/config.ts index c19639944b1b6..0bb070da05137 100644 --- a/x-pack/plugins/lists/server/config.ts +++ b/x-pack/plugins/lists/server/config.ts @@ -8,7 +8,6 @@ import { TypeOf, schema } from '@kbn/config-schema'; export const ConfigSchema = schema.object({ - enabled: schema.boolean({ defaultValue: true }), importBufferSize: schema.number({ defaultValue: 1000, min: 1 }), importTimeout: schema.duration({ defaultValue: '5m', diff --git a/x-pack/plugins/lists/server/index.ts b/x-pack/plugins/lists/server/index.ts index 7e1283927aa86..772a8cbe7ec35 100644 --- a/x-pack/plugins/lists/server/index.ts +++ b/x-pack/plugins/lists/server/index.ts @@ -20,7 +20,6 @@ export { ExceptionListClient } from './services/exception_lists/exception_list_c export type { ListPluginSetup, ListsApiRequestHandlerContext } from './types'; export const config: PluginConfigDescriptor = { - deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')], schema: ConfigSchema, }; export const plugin = (initializerContext: PluginInitializerContext): ListPlugin => diff --git a/x-pack/plugins/lists/server/services/lists/list_client.mock.ts b/x-pack/plugins/lists/server/services/lists/list_client.mock.ts index 08c14534ac345..f33e6bcbb1143 100644 --- a/x-pack/plugins/lists/server/services/lists/list_client.mock.ts +++ b/x-pack/plugins/lists/server/services/lists/list_client.mock.ts @@ -66,7 +66,6 @@ export class ListClientMock extends ListClient { export const getListClientMock = (): ListClient => { const mock = new ListClientMock({ config: { - enabled: true, importBufferSize: IMPORT_BUFFER_SIZE, importTimeout: IMPORT_TIMEOUT, listIndex: LIST_INDEX, diff --git a/x-pack/plugins/logstash/server/index.ts b/x-pack/plugins/logstash/server/index.ts index 33f3777297f63..2d2ad27bb2fd1 100644 --- a/x-pack/plugins/logstash/server/index.ts +++ b/x-pack/plugins/logstash/server/index.ts @@ -5,15 +5,7 @@ * 2.0. */ -import { schema } from '@kbn/config-schema'; -import { PluginInitializerContext, PluginConfigDescriptor } from 'src/core/server'; +import { PluginInitializerContext } from 'src/core/server'; import { LogstashPlugin } from './plugin'; export const plugin = (context: PluginInitializerContext) => new LogstashPlugin(context); - -export const config: PluginConfigDescriptor = { - schema: schema.object({ - enabled: schema.boolean({ defaultValue: true }), - }), - deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')], -}; diff --git a/x-pack/plugins/maps/config.ts b/x-pack/plugins/maps/config.ts index 3dcae8f94e844..10e7ee75fcecf 100644 --- a/x-pack/plugins/maps/config.ts +++ b/x-pack/plugins/maps/config.ts @@ -8,13 +8,11 @@ import { schema, TypeOf } from '@kbn/config-schema'; export interface MapsConfigType { - enabled: boolean; showMapsInspectorAdapter: boolean; preserveDrawingBuffer: boolean; } export const configSchema = schema.object({ - enabled: schema.boolean({ defaultValue: true }), // flag used in functional testing showMapsInspectorAdapter: schema.boolean({ defaultValue: false }), // flag used in functional testing diff --git a/x-pack/plugins/maps/server/index.ts b/x-pack/plugins/maps/server/index.ts index bfb8745c4ba6f..e00951610bbed 100644 --- a/x-pack/plugins/maps/server/index.ts +++ b/x-pack/plugins/maps/server/index.ts @@ -17,13 +17,11 @@ export const config: PluginConfigDescriptor = { // exposeToBrowser specifies kibana.yml settings to expose to the browser // the value `true` in this context signals configuration is exposed to browser exposeToBrowser: { - enabled: true, showMapsInspectorAdapter: true, preserveDrawingBuffer: true, }, schema: configSchema, - deprecations: ({ deprecate }) => [ - deprecate('enabled', '8.0.0'), + deprecations: () => [ ( completeConfig: Record, rootPath: string, diff --git a/x-pack/plugins/maps/server/plugin.ts b/x-pack/plugins/maps/server/plugin.ts index 88e3dd6096654..8768580089f31 100644 --- a/x-pack/plugins/maps/server/plugin.ts +++ b/x-pack/plugins/maps/server/plugin.ts @@ -138,15 +138,6 @@ export class MapsPlugin implements Plugin { const { usageCollection, home, licensing, features, mapsEms } = plugins; const mapsEmsConfig = mapsEms.config; const config$ = this._initializerContext.config.create(); - const currentConfig = this._initializerContext.config.get(); - - // @ts-ignore - const mapsEnabled = currentConfig.enabled; - // TODO: Consider dynamic way to disable maps app on config change - if (!mapsEnabled) { - this._logger.warn('Maps app disabled by configuration'); - return; - } let isEnterprisePlus = false; let lastLicenseId: string | undefined; diff --git a/x-pack/plugins/metrics_entities/server/config.ts b/x-pack/plugins/metrics_entities/server/config.ts deleted file mode 100644 index 31be256611803..0000000000000 --- a/x-pack/plugins/metrics_entities/server/config.ts +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { TypeOf, schema } from '@kbn/config-schema'; - -export const ConfigSchema = schema.object({ - enabled: schema.boolean({ defaultValue: false }), -}); - -export type ConfigType = TypeOf; diff --git a/x-pack/plugins/metrics_entities/server/index.ts b/x-pack/plugins/metrics_entities/server/index.ts index c8f9d81347bdb..e61dc8b7dc642 100644 --- a/x-pack/plugins/metrics_entities/server/index.ts +++ b/x-pack/plugins/metrics_entities/server/index.ts @@ -5,18 +5,13 @@ * 2.0. */ -import { PluginConfigDescriptor, PluginInitializerContext } from '../../../../src/core/server'; +import { PluginInitializerContext } from '../../../../src/core/server'; -import { ConfigSchema } from './config'; import { MetricsEntitiesPlugin } from './plugin'; // This exports static code and TypeScript types, // as well as, Kibana Platform `plugin()` initializer. -export const config: PluginConfigDescriptor = { - deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')], - schema: ConfigSchema, -}; export const plugin = (initializerContext: PluginInitializerContext): MetricsEntitiesPlugin => { return new MetricsEntitiesPlugin(initializerContext); }; diff --git a/x-pack/plugins/monitoring/public/plugin.ts b/x-pack/plugins/monitoring/public/plugin.ts index 0792d083b3da5..82e49fec5a8d4 100644 --- a/x-pack/plugins/monitoring/public/plugin.ts +++ b/x-pack/plugins/monitoring/public/plugin.ts @@ -57,7 +57,7 @@ export class MonitoringPlugin }); const monitoring = this.initializerContext.config.get(); - if (!monitoring.ui.enabled || !monitoring.enabled) { + if (!monitoring.ui.enabled) { return false; } diff --git a/x-pack/plugins/monitoring/server/config.test.ts b/x-pack/plugins/monitoring/server/config.test.ts index f4604903e0068..8dd1866c274c9 100644 --- a/x-pack/plugins/monitoring/server/config.test.ts +++ b/x-pack/plugins/monitoring/server/config.test.ts @@ -40,7 +40,6 @@ describe('config schema', () => { }, "enabled": true, }, - "enabled": true, "kibana": Object { "collection": Object { "enabled": true, diff --git a/x-pack/plugins/monitoring/server/config.ts b/x-pack/plugins/monitoring/server/config.ts index ddbfd480a9f4e..7b66b35d658cc 100644 --- a/x-pack/plugins/monitoring/server/config.ts +++ b/x-pack/plugins/monitoring/server/config.ts @@ -22,7 +22,6 @@ export const monitoringElasticsearchConfigSchema = elasticsearchConfigSchema.ext }); export const configSchema = schema.object({ - enabled: schema.boolean({ defaultValue: true }), ui: schema.object({ enabled: schema.boolean({ defaultValue: true }), debug_mode: schema.boolean({ defaultValue: false }), diff --git a/x-pack/plugins/monitoring/server/deprecations.ts b/x-pack/plugins/monitoring/server/deprecations.ts index 3072e024450d0..7c3d3e3baf58a 100644 --- a/x-pack/plugins/monitoring/server/deprecations.ts +++ b/x-pack/plugins/monitoring/server/deprecations.ts @@ -18,12 +18,10 @@ import { CLUSTER_ALERTS_ADDRESS_CONFIG_KEY } from '../common/constants'; * @return {Array} array of rename operations and callback function for rename logging */ export const deprecations = ({ - deprecate, rename, renameFromRoot, }: ConfigDeprecationFactory): ConfigDeprecation[] => { return [ - deprecate('enabled', '8.0.0'), // This order matters. The "blanket rename" needs to happen at the end renameFromRoot('xpack.monitoring.max_bucket_size', 'monitoring.ui.max_bucket_size'), renameFromRoot('xpack.monitoring.min_interval_seconds', 'monitoring.ui.min_interval_seconds'), diff --git a/x-pack/plugins/monitoring/server/index.ts b/x-pack/plugins/monitoring/server/index.ts index 97e572d15327c..63cc61e503917 100644 --- a/x-pack/plugins/monitoring/server/index.ts +++ b/x-pack/plugins/monitoring/server/index.ts @@ -20,7 +20,6 @@ export const config: PluginConfigDescriptor> = { schema: configSchema, deprecations, exposeToBrowser: { - enabled: true, ui: true, kibana: true, }, diff --git a/x-pack/plugins/observability/server/index.ts b/x-pack/plugins/observability/server/index.ts index 53c3ecb23546c..1e811e0a5278c 100644 --- a/x-pack/plugins/observability/server/index.ts +++ b/x-pack/plugins/observability/server/index.ts @@ -24,7 +24,6 @@ export const config: PluginConfigDescriptor = { unsafe: true, }, schema: schema.object({ - enabled: schema.boolean({ defaultValue: true }), annotations: schema.object({ enabled: schema.boolean({ defaultValue: true }), index: schema.string({ defaultValue: 'observability-annotations' }), @@ -34,7 +33,6 @@ export const config: PluginConfigDescriptor = { cases: schema.object({ enabled: schema.boolean({ defaultValue: false }) }), }), }), - deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')], }; export type ObservabilityConfig = TypeOf; diff --git a/x-pack/plugins/osquery/public/plugin.ts b/x-pack/plugins/osquery/public/plugin.ts index 8555997d61787..86a1f89f738b6 100644 --- a/x-pack/plugins/osquery/public/plugin.ts +++ b/x-pack/plugins/osquery/public/plugin.ts @@ -37,18 +37,6 @@ export class OsqueryPlugin implements Plugin(); - - if (!config.enabled) { - return {}; - } - const storage = this.storage; const kibanaVersion = this.kibanaVersion; // Register an application into the side navigation menu @@ -78,18 +66,6 @@ export class OsqueryPlugin implements Plugin(); - - if (!config.enabled) { - return {}; - } - if (plugins.fleet) { const { registerExtension } = plugins.fleet; diff --git a/x-pack/plugins/osquery/server/config.ts b/x-pack/plugins/osquery/server/config.ts index 3ec9213ae6d60..1fd4b5dbe5ac2 100644 --- a/x-pack/plugins/osquery/server/config.ts +++ b/x-pack/plugins/osquery/server/config.ts @@ -8,7 +8,6 @@ import { TypeOf, schema } from '@kbn/config-schema'; export const ConfigSchema = schema.object({ - enabled: schema.boolean({ defaultValue: true }), actionEnabled: schema.boolean({ defaultValue: false }), savedQueries: schema.boolean({ defaultValue: true }), packs: schema.boolean({ defaultValue: false }), diff --git a/x-pack/plugins/osquery/server/index.ts b/x-pack/plugins/osquery/server/index.ts index 385515c285093..5deec805cc282 100644 --- a/x-pack/plugins/osquery/server/index.ts +++ b/x-pack/plugins/osquery/server/index.ts @@ -10,10 +10,8 @@ import { OsqueryPlugin } from './plugin'; import { ConfigSchema, ConfigType } from './config'; export const config: PluginConfigDescriptor = { - deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')], schema: ConfigSchema, exposeToBrowser: { - enabled: true, actionEnabled: true, savedQueries: true, packs: true, diff --git a/x-pack/plugins/osquery/server/plugin.ts b/x-pack/plugins/osquery/server/plugin.ts index ff8483fdb385a..420fc429f97f4 100644 --- a/x-pack/plugins/osquery/server/plugin.ts +++ b/x-pack/plugins/osquery/server/plugin.ts @@ -205,10 +205,6 @@ export class OsqueryPlugin implements Plugin [ - deprecate('enabled', '8.0.0'), - unused('unsafe.indexUpgrade.enabled'), - ], + deprecations: ({ deprecate, unused }) => [unused('unsafe.indexUpgrade.enabled')], schema: schema.object({ - enabled: schema.boolean({ defaultValue: true }), write: schema.object({ enabled: schema.boolean({ defaultValue: false }), }), diff --git a/x-pack/plugins/saved_objects_tagging/server/config.ts b/x-pack/plugins/saved_objects_tagging/server/config.ts index 183779aa6f229..9d676576a03c3 100644 --- a/x-pack/plugins/saved_objects_tagging/server/config.ts +++ b/x-pack/plugins/saved_objects_tagging/server/config.ts @@ -9,14 +9,12 @@ import { schema, TypeOf } from '@kbn/config-schema'; import { PluginConfigDescriptor } from 'kibana/server'; const configSchema = schema.object({ - enabled: schema.boolean({ defaultValue: true }), cache_refresh_interval: schema.duration({ defaultValue: '15m' }), }); export type SavedObjectsTaggingConfigType = TypeOf; export const config: PluginConfigDescriptor = { - deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')], schema: configSchema, exposeToBrowser: { cache_refresh_interval: true, diff --git a/x-pack/plugins/security_solution/server/config.ts b/x-pack/plugins/security_solution/server/config.ts index bc5b43c6d25fd..e0b8ad883f4a2 100644 --- a/x-pack/plugins/security_solution/server/config.ts +++ b/x-pack/plugins/security_solution/server/config.ts @@ -17,7 +17,6 @@ import { UnderlyingLogClient } from './lib/detection_engine/rule_execution_log/t const allowedExperimentalValues = getExperimentalAllowedValues(); export const configSchema = schema.object({ - enabled: schema.boolean({ defaultValue: true }), maxRuleImportExportSize: schema.number({ defaultValue: 10000 }), maxRuleImportPayloadBytes: schema.number({ defaultValue: 10485760 }), maxTimelineImportExportSize: schema.number({ defaultValue: 10000 }), diff --git a/x-pack/plugins/security_solution/server/index.ts b/x-pack/plugins/security_solution/server/index.ts index b72a21c0da643..7e3da726f6ebe 100644 --- a/x-pack/plugins/security_solution/server/index.ts +++ b/x-pack/plugins/security_solution/server/index.ts @@ -20,8 +20,7 @@ export const config: PluginConfigDescriptor = { enableExperimental: true, }, schema: configSchema, - deprecations: ({ deprecate, renameFromRoot }) => [ - deprecate('enabled', '8.0.0'), + deprecations: ({ renameFromRoot }) => [ renameFromRoot('xpack.siem.enabled', 'xpack.securitySolution.enabled'), renameFromRoot( 'xpack.siem.maxRuleImportExportSize', diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/index.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/index.ts index 2f401d27813ac..8417115fb1896 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/index.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/index.ts @@ -16,7 +16,6 @@ import { UnderlyingLogClient } from '../../rule_execution_log/types'; export { requestMock, requestContextMock, responseMock, serverMock }; export const createMockConfig = (): ConfigType => ({ - enabled: true, [SIGNALS_INDEX_KEY]: DEFAULT_SIGNALS_INDEX, maxRuleImportExportSize: 10000, maxRuleImportPayloadBytes: 10485760, diff --git a/x-pack/plugins/timelines/public/index.ts b/x-pack/plugins/timelines/public/index.ts index 800f1958f9c94..70f7185e9c486 100644 --- a/x-pack/plugins/timelines/public/index.ts +++ b/x-pack/plugins/timelines/public/index.ts @@ -10,8 +10,6 @@ import { createContext } from 'react'; -import { PluginInitializerContext } from '../../../../src/core/public'; - import { TimelinesPlugin } from './plugin'; import type { StatefulEventContextType } from './types'; export * as tGridActions from './store/t_grid/actions'; @@ -63,8 +61,8 @@ export { StatefulFieldsBrowser } from './components/t_grid/toolbar/fields_browse export { useStatusBulkActionItems } from './hooks/use_status_bulk_action_items'; // This exports static code and TypeScript types, // as well as, Kibana Platform `plugin()` initializer. -export function plugin(initializerContext: PluginInitializerContext) { - return new TimelinesPlugin(initializerContext); +export function plugin() { + return new TimelinesPlugin(); } export const StatefulEventContext = createContext(null); diff --git a/x-pack/plugins/timelines/public/plugin.ts b/x-pack/plugins/timelines/public/plugin.ts index acb7b26d0cf84..2151ff0bc5e9b 100644 --- a/x-pack/plugins/timelines/public/plugin.ts +++ b/x-pack/plugins/timelines/public/plugin.ts @@ -8,12 +8,7 @@ import { Store } from 'redux'; import { Storage } from '../../../../src/plugins/kibana_utils/public'; -import type { - CoreSetup, - Plugin, - PluginInitializerContext, - CoreStart, -} from '../../../../src/core/public'; +import type { CoreSetup, Plugin, CoreStart } from '../../../../src/core/public'; import type { LastUpdatedAtProps, LoadingPanelProps, FieldBrowserProps } from './components'; import { getLastUpdatedLazy, @@ -32,17 +27,12 @@ import { useAddToTimeline, useAddToTimelineSensor } from './hooks/use_add_to_tim import { getHoverActions } from './components/hover_actions'; export class TimelinesPlugin implements Plugin { - constructor(private readonly initializerContext: PluginInitializerContext) {} private _store: Store | undefined; private _storage = new Storage(localStorage); public setup(core: CoreSetup) {} public start(core: CoreStart, { data }: TimelinesStartPlugins): TimelinesUIStart { - const config = this.initializerContext.config.get<{ enabled: boolean }>(); - if (!config.enabled) { - return {} as TimelinesUIStart; - } return { getHoverActions: () => { return getHoverActions(this._store); diff --git a/x-pack/plugins/timelines/server/config.ts b/x-pack/plugins/timelines/server/config.ts deleted file mode 100644 index 958c673333873..0000000000000 --- a/x-pack/plugins/timelines/server/config.ts +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { TypeOf, schema } from '@kbn/config-schema'; - -export const ConfigSchema = schema.object({ - enabled: schema.boolean({ defaultValue: true }), -}); - -export type ConfigType = TypeOf; diff --git a/x-pack/plugins/timelines/server/index.ts b/x-pack/plugins/timelines/server/index.ts index 229a257d8f549..ef18226a0e60c 100644 --- a/x-pack/plugins/timelines/server/index.ts +++ b/x-pack/plugins/timelines/server/index.ts @@ -5,17 +5,9 @@ * 2.0. */ -import { PluginInitializerContext, PluginConfigDescriptor } from '../../../../src/core/server'; +import { PluginInitializerContext } from '../../../../src/core/server'; import { TimelinesPlugin } from './plugin'; -import { ConfigSchema, ConfigType } from './config'; -export const config: PluginConfigDescriptor = { - deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')], - schema: ConfigSchema, - exposeToBrowser: { - enabled: true, - }, -}; export function plugin(initializerContext: PluginInitializerContext) { return new TimelinesPlugin(initializerContext); } diff --git a/x-pack/scripts/functional_tests.js b/x-pack/scripts/functional_tests.js index f7b978c2b58bd..6cb80d6d4b74d 100644 --- a/x-pack/scripts/functional_tests.js +++ b/x-pack/scripts/functional_tests.js @@ -21,7 +21,6 @@ const alwaysImportedTests = [ require.resolve('../test/functional_embedded/config.ts'), require.resolve('../test/functional_cors/config.ts'), require.resolve('../test/functional_enterprise_search/without_host_configured.config.ts'), - require.resolve('../test/functional_vis_wizard/config.ts'), require.resolve('../test/saved_object_tagging/functional/config.ts'), require.resolve('../test/usage_collection/config.ts'), require.resolve('../test/fleet_functional/config.ts'), diff --git a/x-pack/test/alerting_api_integration/common/fixtures/plugins/aad/kibana.json b/x-pack/test/alerting_api_integration/common/fixtures/plugins/aad/kibana.json index 016ba8eee281c..7dea652f7f9bb 100644 --- a/x-pack/test/alerting_api_integration/common/fixtures/plugins/aad/kibana.json +++ b/x-pack/test/alerting_api_integration/common/fixtures/plugins/aad/kibana.json @@ -6,7 +6,6 @@ }, "version": "1.0.0", "kibanaVersion": "kibana", - "configPath": ["xpack"], "requiredPlugins": ["taskManager", "encryptedSavedObjects"], "optionalPlugins": ["spaces"], "server": true, diff --git a/x-pack/test/alerting_api_integration/common/fixtures/plugins/actions_simulators/kibana.json b/x-pack/test/alerting_api_integration/common/fixtures/plugins/actions_simulators/kibana.json index db7372d66b793..5a76689f96d38 100644 --- a/x-pack/test/alerting_api_integration/common/fixtures/plugins/actions_simulators/kibana.json +++ b/x-pack/test/alerting_api_integration/common/fixtures/plugins/actions_simulators/kibana.json @@ -6,7 +6,6 @@ }, "version": "1.0.0", "kibanaVersion": "kibana", - "configPath": ["xpack"], "requiredPlugins": ["actions", "features", "encryptedSavedObjects"], "server": true, "ui": false diff --git a/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts/kibana.json b/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts/kibana.json index 63777d0c26629..22ccd552762f5 100644 --- a/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts/kibana.json +++ b/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts/kibana.json @@ -6,7 +6,6 @@ }, "version": "1.0.0", "kibanaVersion": "kibana", - "configPath": ["xpack"], "requiredPlugins": ["taskManager", "features", "actions", "alerting", "encryptedSavedObjects"], "optionalPlugins": ["security", "spaces"], "server": true, diff --git a/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts_restricted/kibana.json b/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts_restricted/kibana.json index f12f8c3c205aa..206acd533b266 100644 --- a/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts_restricted/kibana.json +++ b/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts_restricted/kibana.json @@ -6,7 +6,6 @@ }, "version": "1.0.0", "kibanaVersion": "kibana", - "configPath": ["xpack"], "requiredPlugins": ["taskManager", "features", "actions", "alerting"], "optionalPlugins": ["spaces"], "server": true, diff --git a/x-pack/test/alerting_api_integration/common/fixtures/plugins/task_manager_fixture/kibana.json b/x-pack/test/alerting_api_integration/common/fixtures/plugins/task_manager_fixture/kibana.json index 6d21226db4994..8adfa8d57e72b 100644 --- a/x-pack/test/alerting_api_integration/common/fixtures/plugins/task_manager_fixture/kibana.json +++ b/x-pack/test/alerting_api_integration/common/fixtures/plugins/task_manager_fixture/kibana.json @@ -6,7 +6,6 @@ }, "version": "1.0.0", "kibanaVersion": "kibana", - "configPath": ["xpack"], "requiredPlugins": ["taskManager"], "server": true, "ui": false diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/disable.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/disable.ts index 7e93cf453929b..fa94eed46dc3f 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/disable.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/disable.ts @@ -14,12 +14,16 @@ import { getUrlPrefix, getTestAlertData, ObjectRemover, + getEventLog, } from '../../../common/lib'; +import { validateEvent } from './event_log'; // eslint-disable-next-line import/no-default-export export default function createDisableAlertTests({ getService }: FtrProviderContext) { const es = getService('es'); const supertestWithoutAuth = getService('supertestWithoutAuth'); + const retry = getService('retry'); + const supertest = getService('supertest'); describe('disable', () => { const objectRemover = new ObjectRemover(supertestWithoutAuth); @@ -75,6 +79,75 @@ export default function createDisableAlertTests({ getService }: FtrProviderConte }); }); + it('should create recovered-instance events for all alert instances', async () => { + const { body: createdAlert } = await supertest + .post(`${getUrlPrefix(Spaces.space1.id)}/api/alerting/rule`) + .set('kbn-xsrf', 'foo') + .send({ + enabled: true, + name: 'abc', + tags: ['foo'], + rule_type_id: 'test.cumulative-firing', + consumer: 'alertsFixture', + schedule: { interval: '5s' }, + throttle: '5s', + actions: [], + params: {}, + notify_when: 'onThrottleInterval', + }) + .expect(200); + objectRemover.add(Spaces.space1.id, createdAlert.id, 'rule', 'alerting'); + + // wait for alert to actually execute + await retry.try(async () => { + const response = await supertest.get( + `${getUrlPrefix(Spaces.space1.id)}/internal/alerting/rule/${createdAlert.id}/state` + ); + + expect(response.status).to.eql(200); + expect(response.body).to.key('alerts', 'rule_type_state', 'previous_started_at'); + expect(response.body.rule_type_state.runCount).to.greaterThan(1); + }); + + await alertUtils.getDisableRequest(createdAlert.id); + const ruleId = createdAlert.id; + + // wait for the events we're expecting + const events = await retry.try(async () => { + return await getEventLog({ + getService, + spaceId: Spaces.space1.id, + type: 'alert', + id: ruleId, + provider: 'alerting', + actions: new Map([ + // make sure the counts of the # of events per type are as expected + ['recovered-instance', { equal: 2 }], + ]), + }); + }); + + const event = events[0]; + expect(event).to.be.ok(); + + validateEvent(event, { + spaceId: Spaces.space1.id, + savedObjects: [ + { type: 'alert', id: ruleId, rel: 'primary', type_id: 'test.cumulative-firing' }, + ], + message: "instance 'instance-0' has recovered due to the rule was disabled", + shouldHaveEventEnd: false, + shouldHaveTask: false, + rule: { + id: ruleId, + category: createdAlert.rule_type_id, + license: 'basic', + ruleset: 'alertsFixture', + name: 'abc', + }, + }); + }); + describe('legacy', () => { it('should handle disable alert request appropriately', async () => { const { body: createdAlert } = await supertestWithoutAuth diff --git a/x-pack/test/api_integration/config.ts b/x-pack/test/api_integration/config.ts index 9721a1827caf3..3690f661c621c 100644 --- a/x-pack/test/api_integration/config.ts +++ b/x-pack/test/api_integration/config.ts @@ -28,7 +28,6 @@ export async function getApiIntegrationConfig({ readConfigFile }: FtrConfigProvi '--map.proxyElasticMapsServiceInMaps=true', '--xpack.security.session.idleTimeout=3600000', // 1 hour '--telemetry.optIn=true', - '--xpack.fleet.enabled=true', '--xpack.fleet.agents.pollingRequestTimeout=5000', // 5 seconds '--xpack.data_enhanced.search.sessions.enabled=true', // enable WIP send to background UI '--xpack.data_enhanced.search.sessions.notTouchedTimeout=15s', // shorten notTouchedTimeout for quicker testing diff --git a/x-pack/test/case_api_integration/common/config.ts b/x-pack/test/case_api_integration/common/config.ts index e6fda129eaa16..2658472a7b84d 100644 --- a/x-pack/test/case_api_integration/common/config.ts +++ b/x-pack/test/case_api_integration/common/config.ts @@ -93,8 +93,6 @@ export function createTestConfig(name: string, options: CreateTestConfigOptions) .isDirectory() ); - const casesConfig = ['--xpack.cases.enabled=true']; - return { testFiles: testFiles ? testFiles : [require.resolve('../tests/common')], servers, @@ -117,7 +115,6 @@ export function createTestConfig(name: string, options: CreateTestConfigOptions) ...xPackApiIntegrationTestsConfig.get('kbnTestServer'), serverArgs: [ ...xPackApiIntegrationTestsConfig.get('kbnTestServer.serverArgs'), - ...casesConfig, `--xpack.actions.allowedHosts=${JSON.stringify(['localhost', 'some.non.existent.com'])}`, `--xpack.actions.enabledActionTypes=${JSON.stringify(enabledActionTypes)}`, '--xpack.eventLog.logEntries=true', diff --git a/x-pack/test/case_api_integration/common/fixtures/plugins/cases_client_user/kibana.json b/x-pack/test/case_api_integration/common/fixtures/plugins/cases_client_user/kibana.json index 22312e27bb1d3..c8ccea36bd6c3 100644 --- a/x-pack/test/case_api_integration/common/fixtures/plugins/cases_client_user/kibana.json +++ b/x-pack/test/case_api_integration/common/fixtures/plugins/cases_client_user/kibana.json @@ -6,7 +6,6 @@ }, "version": "1.0.0", "kibanaVersion": "kibana", - "configPath": ["xpack"], "requiredPlugins": ["features", "cases"], "optionalPlugins": ["security", "spaces"], "server": true, diff --git a/x-pack/test/case_api_integration/common/fixtures/plugins/observability/kibana.json b/x-pack/test/case_api_integration/common/fixtures/plugins/observability/kibana.json index afc0cd39734e3..783a9b60e22a6 100644 --- a/x-pack/test/case_api_integration/common/fixtures/plugins/observability/kibana.json +++ b/x-pack/test/case_api_integration/common/fixtures/plugins/observability/kibana.json @@ -6,7 +6,6 @@ }, "version": "1.0.0", "kibanaVersion": "kibana", - "configPath": ["xpack"], "requiredPlugins": ["features", "cases"], "optionalPlugins": ["security", "spaces"], "server": true, diff --git a/x-pack/test/case_api_integration/common/fixtures/plugins/security_solution/kibana.json b/x-pack/test/case_api_integration/common/fixtures/plugins/security_solution/kibana.json index 8368ed83efaa1..a0d33c9ec09e8 100644 --- a/x-pack/test/case_api_integration/common/fixtures/plugins/security_solution/kibana.json +++ b/x-pack/test/case_api_integration/common/fixtures/plugins/security_solution/kibana.json @@ -6,7 +6,6 @@ }, "version": "1.0.0", "kibanaVersion": "kibana", - "configPath": ["xpack"], "requiredPlugins": ["features", "cases"], "optionalPlugins": ["security", "spaces"], "server": true, diff --git a/x-pack/test/detection_engine_api_integration/basic/config.ts b/x-pack/test/detection_engine_api_integration/basic/config.ts index ead53d3fef129..0c5c7d1649f84 100644 --- a/x-pack/test/detection_engine_api_integration/basic/config.ts +++ b/x-pack/test/detection_engine_api_integration/basic/config.ts @@ -9,7 +9,6 @@ import { createTestConfig } from '../common/config'; // eslint-disable-next-line import/no-default-export export default createTestConfig('basic', { - disabledPlugins: [], license: 'basic', ssl: true, }); diff --git a/x-pack/test/detection_engine_api_integration/common/config.ts b/x-pack/test/detection_engine_api_integration/common/config.ts index eee1f0be5ba37..4fdb23d010ea2 100644 --- a/x-pack/test/detection_engine_api_integration/common/config.ts +++ b/x-pack/test/detection_engine_api_integration/common/config.ts @@ -11,7 +11,6 @@ import { services } from './services'; interface CreateTestConfigOptions { license: string; - disabledPlugins?: string[]; ssl?: boolean; } @@ -33,7 +32,7 @@ const enabledActionTypes = [ ]; export function createTestConfig(name: string, options: CreateTestConfigOptions) { - const { license = 'trial', disabledPlugins = [], ssl = false } = options; + const { license = 'trial', ssl = false } = options; return async ({ readConfigFile }: FtrConfigProviderContext) => { const xPackApiIntegrationTestsConfig = await readConfigFile( @@ -58,10 +57,7 @@ export function createTestConfig(name: string, options: CreateTestConfigOptions) ...xPackApiIntegrationTestsConfig.get('esTestCluster'), license, ssl, - serverArgs: [ - `xpack.license.self_generated.type=${license}`, - `xpack.security.enabled=${!disabledPlugins.includes('security')}`, - ], + serverArgs: [`xpack.license.self_generated.type=${license}`], }, kbnTestServer: { ...xPackApiIntegrationTestsConfig.get('kbnTestServer'), @@ -74,7 +70,6 @@ export function createTestConfig(name: string, options: CreateTestConfigOptions) 'testing_ignored.constant', '/testing_regex*/', ])}`, // See tests within the file "ignore_fields.ts" which use these values in "alertIgnoreFields" - ...disabledPlugins.map((key) => `--xpack.${key}.enabled=false`), ...(ssl ? [ `--elasticsearch.hosts=${servers.elasticsearch.protocol}://${servers.elasticsearch.hostname}:${servers.elasticsearch.port}`, diff --git a/x-pack/test/detection_engine_api_integration/security_and_spaces/config.ts b/x-pack/test/detection_engine_api_integration/security_and_spaces/config.ts index 8b7e43945c8a2..78203525b887a 100644 --- a/x-pack/test/detection_engine_api_integration/security_and_spaces/config.ts +++ b/x-pack/test/detection_engine_api_integration/security_and_spaces/config.ts @@ -9,7 +9,6 @@ import { createTestConfig } from '../common/config'; // eslint-disable-next-line import/no-default-export export default createTestConfig('security_and_spaces', { - disabledPlugins: [], license: 'trial', ssl: true, }); diff --git a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/exception_operators_data_types/keyword_array.ts b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/exception_operators_data_types/keyword_array.ts index 94c8ab6f4664f..e852558aaa6a8 100644 --- a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/exception_operators_data_types/keyword_array.ts +++ b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/exception_operators_data_types/keyword_array.ts @@ -328,7 +328,8 @@ export default ({ getService }: FtrProviderContext) => { }); describe('"exists" operator', () => { - it('will return 1 results if matching against keyword for the empty array', async () => { + // FLAKY https://github.com/elastic/kibana/issues/115308 + it.skip('will return 1 results if matching against keyword for the empty array', async () => { const rule = getRuleForSignalTesting(['keyword_as_array']); const { id } = await createRuleWithExceptionEntries(supertest, rule, [ [ diff --git a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/exception_operators_data_types/text_array.ts b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/exception_operators_data_types/text_array.ts index 2ee7ebfc18be0..f0a5fe7c1ffb1 100644 --- a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/exception_operators_data_types/text_array.ts +++ b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/exception_operators_data_types/text_array.ts @@ -326,7 +326,8 @@ export default ({ getService }: FtrProviderContext) => { }); describe('"exists" operator', () => { - it('will return 1 results if matching against text for the empty array', async () => { + // FLAKY https://github.com/elastic/kibana/issues/115313 + it.skip('will return 1 results if matching against text for the empty array', async () => { const rule = getRuleForSignalTesting(['text_as_array']); const { id } = await createRuleWithExceptionEntries(supertest, rule, [ [ diff --git a/x-pack/test/fleet_functional/config.ts b/x-pack/test/fleet_functional/config.ts index b68fd08b7890f..27fc522f03a36 100644 --- a/x-pack/test/fleet_functional/config.ts +++ b/x-pack/test/fleet_functional/config.ts @@ -29,10 +29,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { }, kbnTestServer: { ...xpackFunctionalConfig.get('kbnTestServer'), - serverArgs: [ - ...xpackFunctionalConfig.get('kbnTestServer.serverArgs'), - '--xpack.fleet.enabled=true', - ], + serverArgs: [...xpackFunctionalConfig.get('kbnTestServer.serverArgs')], }, layout: { fixedHeaderHeight: 200, diff --git a/x-pack/test/functional_execution_context/fixtures/plugins/alerts/kibana.json b/x-pack/test/functional_execution_context/fixtures/plugins/alerts/kibana.json index 7a51160f20041..0537e12718dc5 100644 --- a/x-pack/test/functional_execution_context/fixtures/plugins/alerts/kibana.json +++ b/x-pack/test/functional_execution_context/fixtures/plugins/alerts/kibana.json @@ -6,7 +6,6 @@ }, "version": "1.0.0", "kibanaVersion": "kibana", - "configPath": ["xpack"], "requiredPlugins": ["features", "alerting"], "server": true, "ui": false diff --git a/x-pack/test/functional_vis_wizard/apps/index.ts b/x-pack/test/functional_vis_wizard/apps/index.ts deleted file mode 100644 index b5073206d863e..0000000000000 --- a/x-pack/test/functional_vis_wizard/apps/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { FtrProviderContext } from '../ftr_provider_context'; - -export default function ({ loadTestFile }: FtrProviderContext) { - describe('Visualization Wizard', function () { - this.tags('ciGroup4'); - - loadTestFile(require.resolve('./visualization_wizard')); - }); -} diff --git a/x-pack/test/functional_vis_wizard/apps/visualization_wizard.ts b/x-pack/test/functional_vis_wizard/apps/visualization_wizard.ts deleted file mode 100644 index 2dc7533468db4..0000000000000 --- a/x-pack/test/functional_vis_wizard/apps/visualization_wizard.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import expect from '@kbn/expect'; -import { FtrProviderContext } from '../ftr_provider_context'; - -export default function ({ getService, getPageObjects }: FtrProviderContext) { - const esArchiver = getService('esArchiver'); - const PageObjects = getPageObjects(['visualize']); - - describe('lens and maps disabled', function () { - before(async function () { - await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional'); - await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/visualize/default'); - }); - - after(async function () { - await esArchiver.unload('x-pack/test/functional/es_archives/logstash_functional'); - await esArchiver.unload('x-pack/test/functional/es_archives/visualize/default'); - }); - - it('should not display lens and maps cards', async function () { - await PageObjects.visualize.navigateToNewVisualization(); - const expectedChartTypes = ['Custom visualization', 'TSVB']; - - // find all the chart types and make sure that maps and lens cards are not there - const chartTypes = (await PageObjects.visualize.getPromotedVisTypes()).sort(); - expect(chartTypes).to.eql(expectedChartTypes); - }); - }); -} diff --git a/x-pack/test/functional_vis_wizard/config.ts b/x-pack/test/functional_vis_wizard/config.ts deleted file mode 100644 index 523b59b6ccd1c..0000000000000 --- a/x-pack/test/functional_vis_wizard/config.ts +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { FtrConfigProviderContext } from '@kbn/test'; - -export default async function ({ readConfigFile }: FtrConfigProviderContext) { - const xPackFunctionalConfig = await readConfigFile(require.resolve('../functional/config')); - - return { - // default to the xpack functional config - ...xPackFunctionalConfig.getAll(), - testFiles: [require.resolve('./apps')], - junit: { - reportName: 'X-Pack Visualization Wizard Tests with Lens and Maps disabled', - }, - kbnTestServer: { - ...xPackFunctionalConfig.get('kbnTestServer'), - serverArgs: [ - ...xPackFunctionalConfig.get('kbnTestServer.serverArgs'), - '--xpack.lens.enabled=false', - '--xpack.maps.enabled=false', - ], - }, - }; -} diff --git a/x-pack/test/functional_vis_wizard/ftr_provider_context.d.ts b/x-pack/test/functional_vis_wizard/ftr_provider_context.d.ts deleted file mode 100644 index ab1e999222808..0000000000000 --- a/x-pack/test/functional_vis_wizard/ftr_provider_context.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { GenericFtrProviderContext } from '@kbn/test'; -import { pageObjects } from '../functional/page_objects'; -import { services } from '../functional/services'; - -export type FtrProviderContext = GenericFtrProviderContext; -export { pageObjects }; diff --git a/x-pack/test/functional_with_es_ssl/fixtures/plugins/alerts/kibana.json b/x-pack/test/functional_with_es_ssl/fixtures/plugins/alerts/kibana.json index 717fe9966be39..8c798aa3fbe0a 100644 --- a/x-pack/test/functional_with_es_ssl/fixtures/plugins/alerts/kibana.json +++ b/x-pack/test/functional_with_es_ssl/fixtures/plugins/alerts/kibana.json @@ -3,7 +3,6 @@ "owner": { "name": "Alerting Services", "githubTeam": "kibana-alerting-services" }, "version": "1.0.0", "kibanaVersion": "kibana", - "configPath": ["xpack"], "requiredPlugins": ["alerting", "triggersActionsUi", "features"], "server": true, "ui": true diff --git a/x-pack/test/plugin_api_integration/plugins/event_log/kibana.json b/x-pack/test/plugin_api_integration/plugins/event_log/kibana.json index 7ba0617010112..42cfa0f766e3e 100644 --- a/x-pack/test/plugin_api_integration/plugins/event_log/kibana.json +++ b/x-pack/test/plugin_api_integration/plugins/event_log/kibana.json @@ -6,7 +6,6 @@ }, "version": "1.0.0", "kibanaVersion": "kibana", - "configPath": ["xpack"], "requiredPlugins": ["eventLog"], "server": true, "ui": false diff --git a/x-pack/test/plugin_api_integration/plugins/sample_task_plugin/kibana.json b/x-pack/test/plugin_api_integration/plugins/sample_task_plugin/kibana.json index 7a9fd345739a0..0171004f1c7b5 100644 --- a/x-pack/test/plugin_api_integration/plugins/sample_task_plugin/kibana.json +++ b/x-pack/test/plugin_api_integration/plugins/sample_task_plugin/kibana.json @@ -6,7 +6,6 @@ }, "version": "1.0.0", "kibanaVersion": "kibana", - "configPath": ["xpack"], "requiredPlugins": ["taskManager"], "server": true, "ui": false diff --git a/x-pack/test/plugin_api_perf/plugins/task_manager_performance/kibana.json b/x-pack/test/plugin_api_perf/plugins/task_manager_performance/kibana.json index 1cc106fd95b36..995427773ad92 100644 --- a/x-pack/test/plugin_api_perf/plugins/task_manager_performance/kibana.json +++ b/x-pack/test/plugin_api_perf/plugins/task_manager_performance/kibana.json @@ -3,7 +3,6 @@ "owner": { "name": "Alerting Services", "githubTeam": "kibana-alerting-services" }, "version": "1.0.0", "kibanaVersion": "kibana", - "configPath": ["xpack"], "requiredPlugins": ["taskManager"], "server": true, "ui": false diff --git a/x-pack/test/plugin_functional/config.ts b/x-pack/test/plugin_functional/config.ts index 7033836285e3c..8f3c5be04a8bc 100644 --- a/x-pack/test/plugin_functional/config.ts +++ b/x-pack/test/plugin_functional/config.ts @@ -48,7 +48,6 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { KIBANA_ROOT, 'test/plugin_functional/plugins/core_provider_plugin' )}`, - '--xpack.timelines.enabled=true', ...plugins.map((pluginDir) => `--plugin-path=${resolve(__dirname, 'plugins', pluginDir)}`), ], }, diff --git a/x-pack/test/saved_objects_field_count/config.ts b/x-pack/test/saved_objects_field_count/config.ts index 8144bac35ec7b..7967b6c4f3b9c 100644 --- a/x-pack/test/saved_objects_field_count/config.ts +++ b/x-pack/test/saved_objects_field_count/config.ts @@ -26,14 +26,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { kbnTestServer: { ...kibanaCommonTestsConfig.get('kbnTestServer'), - serverArgs: [ - ...kibanaCommonTestsConfig.get('kbnTestServer.serverArgs'), - // Enable plugins that are disabled by default to include their metrics - // TODO: Find a way to automatically enable all discovered plugins - '--xpack.fleet.enabled=true', - '--xpack.lists.enabled=true', - '--xpack.securitySolution.enabled=true', - ], + serverArgs: [...kibanaCommonTestsConfig.get('kbnTestServer.serverArgs')], }, }; }