From 6a8218afb80f9c83a02269fd4e62debb931fd4e1 Mon Sep 17 00:00:00 2001 From: pgayvallet Date: Wed, 13 Oct 2021 08:03:50 +0200 Subject: [PATCH 01/12] Add `deprecation.skip_deprecated_settings` config setting --- .../src/deprecation/deprecation_factory.ts | 4 ++++ packages/kbn-config/src/deprecation/types.ts | 2 ++ .../server/deprecations/deprecation_config.ts | 21 +++++++++++++++++++ src/core/server/deprecations/index.ts | 1 + src/core/server/server.ts | 3 ++- 5 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 src/core/server/deprecations/deprecation_config.ts diff --git a/packages/kbn-config/src/deprecation/deprecation_factory.ts b/packages/kbn-config/src/deprecation/deprecation_factory.ts index 1d61733715bd9..ea4db280e915b 100644 --- a/packages/kbn-config/src/deprecation/deprecation_factory.ts +++ b/packages/kbn-config/src/deprecation/deprecation_factory.ts @@ -37,6 +37,7 @@ const _deprecate = ( return; } addDeprecation({ + configPath: fullPath, title: getDeprecationTitle(fullPath), message: i18n.translate('kbnConfig.deprecations.deprecatedSettingMessage', { defaultMessage: 'Configuring "{fullPath}" is deprecated and will be removed in {removeBy}.', @@ -73,6 +74,7 @@ const _rename = ( const newValue = get(config, fullNewPath); if (newValue === undefined) { addDeprecation({ + configPath: fullOldPath, title: getDeprecationTitle(fullOldPath), message: i18n.translate('kbnConfig.deprecations.replacedSettingMessage', { defaultMessage: `Setting "{fullOldPath}" has been replaced by "{fullNewPath}"`, @@ -95,6 +97,7 @@ const _rename = ( }; } else { addDeprecation({ + configPath: fullOldPath, title: getDeprecationTitle(fullOldPath), message: i18n.translate('kbnConfig.deprecations.conflictSettingMessage', { defaultMessage: @@ -135,6 +138,7 @@ const _unused = ( return; } addDeprecation({ + configPath: fullPath, title: getDeprecationTitle(fullPath), message: i18n.translate('kbnConfig.deprecations.unusedSettingMessage', { defaultMessage: 'You no longer need to configure "{fullPath}".', diff --git a/packages/kbn-config/src/deprecation/types.ts b/packages/kbn-config/src/deprecation/types.ts index 12b561aa2b1b9..7fbb69a8ee64a 100644 --- a/packages/kbn-config/src/deprecation/types.ts +++ b/packages/kbn-config/src/deprecation/types.ts @@ -20,6 +20,8 @@ export type AddConfigDeprecation = (details: DeprecatedConfigDetails) => void; * @public */ export interface DeprecatedConfigDetails { + /** The path of the deprecated config setting */ + configPath: string; /** The title to be displayed for the deprecation. */ title?: string; /** The message to be displayed for the deprecation. */ diff --git a/src/core/server/deprecations/deprecation_config.ts b/src/core/server/deprecations/deprecation_config.ts new file mode 100644 index 0000000000000..9328e73dbbd7b --- /dev/null +++ b/src/core/server/deprecations/deprecation_config.ts @@ -0,0 +1,21 @@ +/* + * 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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { schema, TypeOf } from '@kbn/config-schema'; +import { ServiceConfigDescriptor } from '../internal_types'; + +const configSchema = schema.object({ + skip_deprecated_settings: schema.arrayOf(schema.string(), { defaultValue: [] }), +}); + +export type DeprecationConfigType = TypeOf; + +export const config: ServiceConfigDescriptor = { + path: 'deprecation', + schema: configSchema, +}; diff --git a/src/core/server/deprecations/index.ts b/src/core/server/deprecations/index.ts index 5c2a0b87b42de..168b716fe2c1e 100644 --- a/src/core/server/deprecations/index.ts +++ b/src/core/server/deprecations/index.ts @@ -21,3 +21,4 @@ export type { } from './deprecations_service'; export { DeprecationsService } from './deprecations_service'; +export { config } from './deprecation_config'; diff --git a/src/core/server/server.ts b/src/core/server/server.ts index 8b0714e899139..1ccfdbfd6c891 100644 --- a/src/core/server/server.ts +++ b/src/core/server/server.ts @@ -50,7 +50,7 @@ import { ServiceConfigDescriptor, } from './internal_types'; import { CoreUsageDataService } from './core_usage_data'; -import { DeprecationsService } from './deprecations'; +import { DeprecationsService, config as deprecationConfig } from './deprecations'; import { CoreRouteHandlerContext } from './core_route_handler_context'; import { config as externalUrlConfig } from './external_url'; import { config as executionContextConfig } from './execution_context'; @@ -381,6 +381,7 @@ export class Server { statusConfig, pidConfig, i18nConfig, + deprecationConfig, ]; this.configService.addDeprecationProvider(rootConfigPath, coreDeprecationProvider); From bdde4c139514151319b51de57a324a0cfb3fd923 Mon Sep 17 00:00:00 2001 From: pgayvallet Date: Wed, 13 Oct 2021 08:08:03 +0200 Subject: [PATCH 02/12] fix deprecation from service --- packages/kbn-config/src/config_service.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/kbn-config/src/config_service.ts b/packages/kbn-config/src/config_service.ts index 5103aa1a2d49d..458acac953497 100644 --- a/packages/kbn-config/src/config_service.ts +++ b/packages/kbn-config/src/config_service.ts @@ -184,6 +184,7 @@ export class ConfigService { 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: { From 637c87dfaa738bd5a633454efb6c9b8eba7776d2 Mon Sep 17 00:00:00 2001 From: pgayvallet Date: Wed, 13 Oct 2021 11:20:49 +0200 Subject: [PATCH 03/12] fix existing config deprecations --- packages/kbn-config/src/deprecation/types.ts | 2 +- .../config/deprecation/core_deprecations.ts | 2 ++ .../deprecations/deprecations_service.test.ts | 2 ++ .../server/deprecations/deprecations_service.ts | 1 + src/core/server/deprecations/types.ts | 17 ++++++++--------- .../elasticsearch/elasticsearch_config.ts | 5 +++++ src/core/server/kibana_config.ts | 1 + .../saved_objects/saved_objects_config.ts | 1 + .../telemetry/server/config/deprecations.ts | 1 + .../core_plugin_deprecations/server/config.ts | 1 + x-pack/plugins/actions/server/index.ts | 3 +++ x-pack/plugins/fleet/server/index.ts | 1 + x-pack/plugins/maps/server/index.ts | 1 + .../plugins/monitoring/server/deprecations.ts | 5 +++++ x-pack/plugins/reporting/server/config/index.ts | 2 ++ .../security/server/config_deprecations.ts | 5 +++++ x-pack/plugins/spaces/server/config.ts | 1 + x-pack/plugins/task_manager/server/index.ts | 2 ++ 18 files changed, 43 insertions(+), 10 deletions(-) diff --git a/packages/kbn-config/src/deprecation/types.ts b/packages/kbn-config/src/deprecation/types.ts index 7fbb69a8ee64a..f5bb240f5cc43 100644 --- a/packages/kbn-config/src/deprecation/types.ts +++ b/packages/kbn-config/src/deprecation/types.ts @@ -32,7 +32,7 @@ export interface DeprecatedConfigDetails { * - critical: needs to be addressed before upgrade. */ level?: 'warning' | 'critical'; - /** (optional) set false to prevent the config service from logging the deprecation message. */ + /** (optional) set to `true` to prevent the config service from logging the deprecation message. */ silent?: boolean; /** (optional) link to the documentation for more details on the deprecation. */ documentationUrl?: string; diff --git a/src/core/server/config/deprecation/core_deprecations.ts b/src/core/server/config/deprecation/core_deprecations.ts index 79fb2aac60da4..6e72ff99036e2 100644 --- a/src/core/server/config/deprecation/core_deprecations.ts +++ b/src/core/server/config/deprecation/core_deprecations.ts @@ -11,6 +11,7 @@ import { ConfigDeprecationProvider, ConfigDeprecation } from '@kbn/config'; const rewriteBasePathDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecation) => { if (settings.server?.basePath && !settings.server?.rewriteBasePath) { addDeprecation({ + configPath: 'server.basePath', message: 'You should set server.basePath along with server.rewriteBasePath. Starting in 7.0, Kibana ' + 'will expect that all requests start with server.basePath rather than expecting you to rewrite ' + @@ -31,6 +32,7 @@ const rewriteCorsSettings: ConfigDeprecation = (settings, fromPath, addDeprecati const corsSettings = settings.server?.cors; if (typeof corsSettings === 'boolean') { addDeprecation({ + configPath: 'server.cors', message: '"server.cors" is deprecated and has been replaced by "server.cors.enabled"', level: 'warning', correctiveActions: { diff --git a/src/core/server/deprecations/deprecations_service.test.ts b/src/core/server/deprecations/deprecations_service.test.ts index dfc1c852f773e..4c08bb95ed748 100644 --- a/src/core/server/deprecations/deprecations_service.test.ts +++ b/src/core/server/deprecations/deprecations_service.test.ts @@ -73,6 +73,7 @@ describe('DeprecationsService', () => { 'testDomain', [ { + configPath: 'test', message: 'testMessage', documentationUrl: 'testDocUrl', correctiveActions: { @@ -124,6 +125,7 @@ describe('DeprecationsService', () => { 'testDomain', [ { + configPath: 'test', message: 'testMessage', level: 'warning', correctiveActions: { diff --git a/src/core/server/deprecations/deprecations_service.ts b/src/core/server/deprecations/deprecations_service.ts index cfc0aae443d1b..eb7808871dd2b 100644 --- a/src/core/server/deprecations/deprecations_service.ts +++ b/src/core/server/deprecations/deprecations_service.ts @@ -9,6 +9,7 @@ import { DeprecationsFactory } from './deprecations_factory'; import { DomainDeprecationDetails, RegisterDeprecationsConfig } from './types'; import { registerRoutes } from './routes'; +// import { config as deprecationConfig, DeprecationConfigType } from './deprecation_config'; import { CoreContext } from '../core_context'; import { CoreService } from '../../types'; diff --git a/src/core/server/deprecations/types.ts b/src/core/server/deprecations/types.ts index e24c6a13fceea..c5e510e7bfc3b 100644 --- a/src/core/server/deprecations/types.ts +++ b/src/core/server/deprecations/types.ts @@ -6,18 +6,10 @@ * Side Public License, v 1. */ +import type { MaybePromise } from '@kbn/utility-types'; import type { SavedObjectsClientContract } from '../saved_objects/types'; import type { IScopedClusterClient } from '../elasticsearch'; -type MaybePromise = T | Promise; - -/** - * @internal - */ -export interface DomainDeprecationDetails extends DeprecationsDetails { - domainId: string; -} - /** * @public */ @@ -82,6 +74,13 @@ export interface DeprecationsDetails { }; } +/** + * @internal + */ +export interface DomainDeprecationDetails extends DeprecationsDetails { + domainId: string; +} + /** * @public */ diff --git a/src/core/server/elasticsearch/elasticsearch_config.ts b/src/core/server/elasticsearch/elasticsearch_config.ts index 7470ff7081717..f130504e3293a 100644 --- a/src/core/server/elasticsearch/elasticsearch_config.ts +++ b/src/core/server/elasticsearch/elasticsearch_config.ts @@ -178,6 +178,7 @@ const deprecations: ConfigDeprecationProvider = () => [ } if (es.username === 'elastic') { addDeprecation({ + configPath: `${fromPath}.username`, message: `Setting [${fromPath}.username] to "elastic" is deprecated. You should use the "kibana_system" user instead.`, correctiveActions: { manualSteps: [`Replace [${fromPath}.username] from "elastic" to "kibana_system".`], @@ -185,6 +186,7 @@ const deprecations: ConfigDeprecationProvider = () => [ }); } else if (es.username === 'kibana') { addDeprecation({ + configPath: `${fromPath}.username`, message: `Setting [${fromPath}.username] to "kibana" is deprecated. You should use the "kibana_system" user instead.`, correctiveActions: { manualSteps: [`Replace [${fromPath}.username] from "kibana" to "kibana_system".`], @@ -193,6 +195,7 @@ const deprecations: ConfigDeprecationProvider = () => [ } if (es.ssl?.key !== undefined && es.ssl?.certificate === undefined) { addDeprecation({ + configPath: `${fromPath}.ssl.key`, message: `Setting [${fromPath}.ssl.key] without [${fromPath}.ssl.certificate] is deprecated. This has no effect, you should use both settings to enable TLS client authentication to Elasticsearch.`, correctiveActions: { manualSteps: [ @@ -202,6 +205,7 @@ const deprecations: ConfigDeprecationProvider = () => [ }); } else if (es.ssl?.certificate !== undefined && es.ssl?.key === undefined) { addDeprecation({ + configPath: `${fromPath}.ssl.certificate`, message: `Setting [${fromPath}.ssl.certificate] without [${fromPath}.ssl.key] is deprecated. This has no effect, you should use both settings to enable TLS client authentication to Elasticsearch.`, correctiveActions: { manualSteps: [ @@ -211,6 +215,7 @@ const deprecations: ConfigDeprecationProvider = () => [ }); } else if (es.logQueries === true) { addDeprecation({ + configPath: `${fromPath}.logQueries`, message: `Setting [${fromPath}.logQueries] is deprecated and no longer used. You should set the log level to "debug" for the "elasticsearch.queries" context in "logging.loggers".`, correctiveActions: { manualSteps: [ diff --git a/src/core/server/kibana_config.ts b/src/core/server/kibana_config.ts index ead3f2cc2776a..859f25d7082f1 100644 --- a/src/core/server/kibana_config.ts +++ b/src/core/server/kibana_config.ts @@ -17,6 +17,7 @@ const deprecations: ConfigDeprecationProvider = () => [ const kibana = settings[fromPath]; if (kibana?.index) { addDeprecation({ + configPath: 'kibana.index', title: i18n.translate('core.kibana.index.deprecationTitle', { defaultMessage: `Setting "kibana.index" is deprecated`, }), diff --git a/src/core/server/saved_objects/saved_objects_config.ts b/src/core/server/saved_objects/saved_objects_config.ts index 0c27f170f590b..c9b4b4499fa80 100644 --- a/src/core/server/saved_objects/saved_objects_config.ts +++ b/src/core/server/saved_objects/saved_objects_config.ts @@ -27,6 +27,7 @@ const migrationDeprecations: ConfigDeprecationProvider = () => [ const migrationsConfig = settings[fromPath]; if (migrationsConfig?.enableV2 !== undefined) { addDeprecation({ + configPath: `${fromPath}.enableV2`, message: '"migrations.enableV2" is deprecated and will be removed in an upcoming release without any further notice.', documentationUrl: 'https://ela.st/kbn-so-migration-v2', diff --git a/src/plugins/telemetry/server/config/deprecations.ts b/src/plugins/telemetry/server/config/deprecations.ts index 013ee51a2ddd9..38553be7d5774 100644 --- a/src/plugins/telemetry/server/config/deprecations.ts +++ b/src/plugins/telemetry/server/config/deprecations.ts @@ -35,6 +35,7 @@ export const deprecateEndpointConfigs: ConfigDeprecation = ( } addDeprecation({ + configPath: fullConfigPath, title: i18n.translate('telemetry.endpointConfigs.deprecationTitle', { defaultMessage: 'Setting "{configPath}" is deprecated', values: { configPath: fullConfigPath }, diff --git a/test/plugin_functional/plugins/core_plugin_deprecations/server/config.ts b/test/plugin_functional/plugins/core_plugin_deprecations/server/config.ts index 650567f761aa3..5b9145be52661 100644 --- a/test/plugin_functional/plugins/core_plugin_deprecations/server/config.ts +++ b/test/plugin_functional/plugins/core_plugin_deprecations/server/config.ts @@ -22,6 +22,7 @@ type ConfigType = TypeOf; const configSecretDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecation) => { if (get(settings, 'corePluginDeprecations.secret') !== 42) { addDeprecation({ + configPath: 'corePluginDeprecations.secret', documentationUrl: 'config-secret-doc-url', message: 'Kibana plugin functional tests will no longer allow corePluginDeprecations.secret ' + diff --git a/x-pack/plugins/actions/server/index.ts b/x-pack/plugins/actions/server/index.ts index f012ec83c2dfb..14cdfacd360a2 100644 --- a/x-pack/plugins/actions/server/index.ts +++ b/x-pack/plugins/actions/server/index.ts @@ -69,6 +69,7 @@ export const config: PluginConfigDescriptor = { ) ) { addDeprecation({ + configPath: 'xpack.actions.customHostSettings.ssl.rejectUnauthorized', message: `"xpack.actions.customHostSettings[].ssl.rejectUnauthorized" is deprecated.` + `Use "xpack.actions.customHostSettings[].ssl.verificationMode" instead, ` + @@ -96,6 +97,7 @@ export const config: PluginConfigDescriptor = { const actions = get(settings, fromPath); if (actions?.hasOwnProperty('rejectUnauthorized')) { addDeprecation({ + configPath: `${fromPath}.rejectUnauthorized`, message: `"xpack.actions.rejectUnauthorized" is deprecated. Use "xpack.actions.verificationMode" instead, ` + `with the setting "verificationMode:full" eql to "rejectUnauthorized:true", ` + @@ -122,6 +124,7 @@ export const config: PluginConfigDescriptor = { const actions = get(settings, fromPath); if (actions?.hasOwnProperty('proxyRejectUnauthorizedCertificates')) { addDeprecation({ + configPath: `${fromPath}.proxyRejectUnauthorizedCertificates`, message: `"xpack.actions.proxyRejectUnauthorizedCertificates" is deprecated. Use "xpack.actions.proxyVerificationMode" instead, ` + `with the setting "proxyVerificationMode:full" eql to "rejectUnauthorized:true",` + diff --git a/x-pack/plugins/fleet/server/index.ts b/x-pack/plugins/fleet/server/index.ts index 897f160810e29..cc754b87686e6 100644 --- a/x-pack/plugins/fleet/server/index.ts +++ b/x-pack/plugins/fleet/server/index.ts @@ -89,6 +89,7 @@ export const config: PluginConfigDescriptor = { delete fullConfig.xpack.fleet.agents.elasticsearch.host; fullConfig.xpack.fleet.agents.elasticsearch.hosts = [oldValue]; addDeprecation({ + configPath: 'xpack.fleet.agents.elasticsearch.host', message: `Config key [xpack.fleet.agents.elasticsearch.host] is deprecated and replaced by [xpack.fleet.agents.elasticsearch.hosts]`, correctiveActions: { manualSteps: [ diff --git a/x-pack/plugins/maps/server/index.ts b/x-pack/plugins/maps/server/index.ts index 603273efe0d95..bfb8745c4ba6f 100644 --- a/x-pack/plugins/maps/server/index.ts +++ b/x-pack/plugins/maps/server/index.ts @@ -33,6 +33,7 @@ export const config: PluginConfigDescriptor = { return completeConfig; } addDeprecation({ + configPath: 'map.proxyElasticMapsServiceInMaps', documentationUrl: 'https://www.elastic.co/guide/en/kibana/current/maps-connect-to-ems.html#elastic-maps-server', message: i18n.translate('xpack.maps.deprecation.proxyEMS.message', { diff --git a/x-pack/plugins/monitoring/server/deprecations.ts b/x-pack/plugins/monitoring/server/deprecations.ts index cb09bbdb5a87c..3072e024450d0 100644 --- a/x-pack/plugins/monitoring/server/deprecations.ts +++ b/x-pack/plugins/monitoring/server/deprecations.ts @@ -50,6 +50,7 @@ export const deprecations = ({ const emailNotificationsEnabled = get(config, 'cluster_alerts.email_notifications.enabled'); if (emailNotificationsEnabled && !get(config, CLUSTER_ALERTS_ADDRESS_CONFIG_KEY)) { addDeprecation({ + configPath: `cluster_alerts.email_notifications.enabled`, message: `Config key [${fromPath}.${CLUSTER_ALERTS_ADDRESS_CONFIG_KEY}] will be required for email notifications to work in 8.0."`, correctiveActions: { manualSteps: [ @@ -65,6 +66,7 @@ export const deprecations = ({ if (es) { if (es.username === 'elastic') { addDeprecation({ + configPath: 'elasticsearch.username', message: `Setting [${fromPath}.username] to "elastic" is deprecated. You should use the "kibana_system" user instead.`, correctiveActions: { manualSteps: [`Replace [${fromPath}.username] from "elastic" to "kibana_system".`], @@ -72,6 +74,7 @@ export const deprecations = ({ }); } else if (es.username === 'kibana') { addDeprecation({ + configPath: 'elasticsearch.username', message: `Setting [${fromPath}.username] to "kibana" is deprecated. You should use the "kibana_system" user instead.`, correctiveActions: { manualSteps: [`Replace [${fromPath}.username] from "kibana" to "kibana_system".`], @@ -86,6 +89,7 @@ export const deprecations = ({ if (ssl) { if (ssl.key !== undefined && ssl.certificate === undefined) { addDeprecation({ + configPath: 'elasticsearch.ssl.key', message: `Setting [${fromPath}.key] without [${fromPath}.certificate] is deprecated. This has no effect, you should use both settings to enable TLS client authentication to Elasticsearch.`, correctiveActions: { manualSteps: [ @@ -95,6 +99,7 @@ export const deprecations = ({ }); } else if (ssl.certificate !== undefined && ssl.key === undefined) { addDeprecation({ + configPath: 'elasticsearch.ssl.certificate', message: `Setting [${fromPath}.certificate] without [${fromPath}.key] is deprecated. This has no effect, you should use both settings to enable TLS client authentication to Elasticsearch.`, correctiveActions: { manualSteps: [ diff --git a/x-pack/plugins/reporting/server/config/index.ts b/x-pack/plugins/reporting/server/config/index.ts index f8fa47bc00bb0..00e8eafde3020 100644 --- a/x-pack/plugins/reporting/server/config/index.ts +++ b/x-pack/plugins/reporting/server/config/index.ts @@ -24,6 +24,7 @@ export const config: PluginConfigDescriptor = { const reporting = get(settings, fromPath); if (reporting?.index) { addDeprecation({ + configPath: `${fromPath}.index`, title: i18n.translate('xpack.reporting.deprecations.reportingIndex.title', { defaultMessage: 'Setting "{fromPath}.index" is deprecated', values: { fromPath }, @@ -46,6 +47,7 @@ export const config: PluginConfigDescriptor = { if (reporting?.roles?.enabled !== false) { addDeprecation({ + configPath: `${fromPath}.roles.enabled`, title: i18n.translate('xpack.reporting.deprecations.reportingRoles.title', { defaultMessage: 'Setting "{fromPath}.roles" is deprecated', values: { fromPath }, diff --git a/x-pack/plugins/security/server/config_deprecations.ts b/x-pack/plugins/security/server/config_deprecations.ts index dbe708eab51a2..f118a2aea8662 100644 --- a/x-pack/plugins/security/server/config_deprecations.ts +++ b/x-pack/plugins/security/server/config_deprecations.ts @@ -35,6 +35,7 @@ export const securityConfigDeprecationProvider: ConfigDeprecationProvider = ({ const legacyAuditLoggerEnabled = !settings?.xpack?.security?.audit?.appender; if (auditLoggingEnabled && legacyAuditLoggerEnabled) { addDeprecation({ + configPath: 'xpack.security.audit.appender', title: i18n.translate('xpack.security.deprecations.auditLoggerTitle', { defaultMessage: 'The legacy audit logger is deprecated', }), @@ -59,6 +60,7 @@ export const securityConfigDeprecationProvider: ConfigDeprecationProvider = ({ (settings, fromPath, addDeprecation) => { if (Array.isArray(settings?.xpack?.security?.authc?.providers)) { addDeprecation({ + configPath: 'xpack.security.authc.providers', title: i18n.translate('xpack.security.deprecations.authcProvidersTitle', { defaultMessage: 'Defining "xpack.security.authc.providers" as an array of provider types is deprecated', @@ -92,6 +94,7 @@ export const securityConfigDeprecationProvider: ConfigDeprecationProvider = ({ if (hasProviderType('basic') && hasProviderType('token')) { addDeprecation({ + configPath: 'xpack.security.authc.providers', title: i18n.translate('xpack.security.deprecations.basicAndTokenProvidersTitle', { defaultMessage: 'Both "basic" and "token" authentication providers are enabled in "xpack.security.authc.providers"', @@ -121,6 +124,7 @@ export const securityConfigDeprecationProvider: ConfigDeprecationProvider = ({ >; if (Object.values(samlProviders).find((provider) => !!provider.maxRedirectURLSize)) { addDeprecation({ + configPath: 'xpack.security.authc.providers.saml.provider.maxRedirectURLSize', title: i18n.translate('xpack.security.deprecations.maxRedirectURLSizeTitle', { defaultMessage: '"xpack.security.authc.providers.saml..maxRedirectURLSize" is deprecated', @@ -143,6 +147,7 @@ export const securityConfigDeprecationProvider: ConfigDeprecationProvider = ({ (settings, fromPath, addDeprecation) => { if (settings?.xpack?.security?.enabled === false) { addDeprecation({ + configPath: 'xpack.security.enabled', title: i18n.translate('xpack.security.deprecations.enabledTitle', { defaultMessage: 'Disabling the security plugin "xpack.security.enabled" is deprecated', }), diff --git a/x-pack/plugins/spaces/server/config.ts b/x-pack/plugins/spaces/server/config.ts index 2a2f363d769f7..29f8e0cdf692f 100644 --- a/x-pack/plugins/spaces/server/config.ts +++ b/x-pack/plugins/spaces/server/config.ts @@ -27,6 +27,7 @@ export function createConfig$(context: PluginInitializerContext) { const disabledDeprecation: ConfigDeprecation = (config, fromPath, addDeprecation) => { if (config.xpack?.spaces?.enabled === false) { addDeprecation({ + configPath: 'xpack.spaces.enabled', message: `Disabling the Spaces plugin (xpack.spaces.enabled) will not be supported in the next major version (8.0)`, correctiveActions: { manualSteps: [`Remove "xpack.spaces.enabled: false" from your Kibana configuration`], diff --git a/x-pack/plugins/task_manager/server/index.ts b/x-pack/plugins/task_manager/server/index.ts index 7667a18fcef54..100f95729d1b7 100644 --- a/x-pack/plugins/task_manager/server/index.ts +++ b/x-pack/plugins/task_manager/server/index.ts @@ -49,6 +49,7 @@ export const config: PluginConfigDescriptor = { const taskManager = get(settings, fromPath); if (taskManager?.index) { addDeprecation({ + configPath: `${fromPath}.index`, documentationUrl: 'https://ela.st/kbn-remove-legacy-multitenancy', message: `"${fromPath}.index" is deprecated. Multitenancy by changing "kibana.index" will not be supported starting in 8.0. See https://ela.st/kbn-remove-legacy-multitenancy for more details`, correctiveActions: { @@ -61,6 +62,7 @@ export const config: PluginConfigDescriptor = { } if (taskManager?.max_workers > MAX_WORKERS_LIMIT) { addDeprecation({ + configPath: `${fromPath}.max_workers`, message: `setting "${fromPath}.max_workers" (${taskManager?.max_workers}) greater than ${MAX_WORKERS_LIMIT} is deprecated. Values greater than ${MAX_WORKERS_LIMIT} will not be supported starting in 8.0.`, correctiveActions: { manualSteps: [ From 57fff55712c35f69695392cd2d59c6bf7e40cf79 Mon Sep 17 00:00:00 2001 From: pgayvallet Date: Wed, 13 Oct 2021 11:29:33 +0200 Subject: [PATCH 04/12] fix kbn-config unit tests --- packages/kbn-config/src/config_service.test.ts | 8 ++++++++ .../src/deprecation/deprecation_factory.test.ts | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/packages/kbn-config/src/config_service.test.ts b/packages/kbn-config/src/config_service.test.ts index e8fd7ab187596..4a8164b100626 100644 --- a/packages/kbn-config/src/config_service.test.ts +++ b/packages/kbn-config/src/config_service.test.ts @@ -382,6 +382,7 @@ test('logs deprecation if schema is not present and "enabled" is used', async () "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.", @@ -452,10 +453,12 @@ test('logs deprecation warning during validation', async () => { mockApplyDeprecations.mockImplementationOnce((config, deprecations, createAddDeprecation) => { const addDeprecation = createAddDeprecation!(''); addDeprecation({ + configPath: 'test1', message: 'some deprecation message', correctiveActions: { manualSteps: ['do X'] }, }); addDeprecation({ + configPath: 'test2', message: 'another deprecation message', correctiveActions: { manualSteps: ['do Y'] }, }); @@ -521,11 +524,13 @@ test('does not log warnings for silent deprecations during validation', async () .mockImplementationOnce((config, deprecations, createAddDeprecation) => { const addDeprecation = createAddDeprecation!(''); addDeprecation({ + configPath: 'test1', message: 'some deprecation message', correctiveActions: { manualSteps: ['do X'] }, silent: true, }); addDeprecation({ + configPath: 'test2', message: 'another deprecation message', correctiveActions: { manualSteps: ['do Y'] }, }); @@ -534,6 +539,7 @@ test('does not log warnings for silent deprecations during validation', async () .mockImplementationOnce((config, deprecations, createAddDeprecation) => { const addDeprecation = createAddDeprecation!(''); addDeprecation({ + configPath: 'silent', message: 'I am silent', silent: true, correctiveActions: { manualSteps: ['do Z'] }, @@ -617,6 +623,7 @@ describe('getHandledDeprecatedConfigs', () => { deprecations.forEach((deprecation) => { const addDeprecation = createAddDeprecation!(deprecation.path); addDeprecation({ + configPath: 'test1', message: `some deprecation message`, documentationUrl: 'some-url', correctiveActions: { manualSteps: ['do X'] }, @@ -633,6 +640,7 @@ describe('getHandledDeprecatedConfigs', () => { "base", Array [ Object { + "configPath": "test1", "correctiveActions": Object { "manualSteps": Array [ "do X", diff --git a/packages/kbn-config/src/deprecation/deprecation_factory.test.ts b/packages/kbn-config/src/deprecation/deprecation_factory.test.ts index 415c8fb9f0610..d9fe90ff711ed 100644 --- a/packages/kbn-config/src/deprecation/deprecation_factory.test.ts +++ b/packages/kbn-config/src/deprecation/deprecation_factory.test.ts @@ -43,6 +43,7 @@ describe('DeprecationFactory', () => { Array [ Array [ Object { + "configPath": "myplugin.deprecated", "correctiveActions": Object { "manualSteps": Array [ "Remove \\"myplugin.deprecated\\" from the Kibana config file, CLI flag, or environment variable (in Docker only) before upgrading to 8.0.0.", @@ -79,6 +80,7 @@ describe('DeprecationFactory', () => { Array [ Array [ Object { + "configPath": "myplugin.section.deprecated", "correctiveActions": Object { "manualSteps": Array [ "Remove \\"myplugin.section.deprecated\\" from the Kibana config file, CLI flag, or environment variable (in Docker only) before upgrading to 8.0.0.", @@ -134,6 +136,7 @@ describe('DeprecationFactory', () => { Array [ Array [ Object { + "configPath": "myplugin.deprecated", "correctiveActions": Object { "manualSteps": Array [ "Remove \\"myplugin.deprecated\\" from the Kibana config file, CLI flag, or environment variable (in Docker only) before upgrading to 8.0.0.", @@ -197,6 +200,7 @@ describe('DeprecationFactory', () => { Array [ Array [ Object { + "configPath": "myplugin.deprecated", "correctiveActions": Object { "manualSteps": Array [ "Replace \\"myplugin.deprecated\\" with \\"myplugin.renamed\\" in the Kibana config file, CLI flag, or environment variable (in Docker only).", @@ -254,6 +258,7 @@ describe('DeprecationFactory', () => { Array [ Array [ Object { + "configPath": "myplugin.oldsection.deprecated", "correctiveActions": Object { "manualSteps": Array [ "Replace \\"myplugin.oldsection.deprecated\\" with \\"myplugin.newsection.renamed\\" in the Kibana config file, CLI flag, or environment variable (in Docker only).", @@ -286,6 +291,7 @@ describe('DeprecationFactory', () => { Array [ Array [ Object { + "configPath": "myplugin.deprecated", "correctiveActions": Object { "manualSteps": Array [ "Make sure \\"myplugin.renamed\\" contains the correct value in the config file, CLI flag, or environment variable (in Docker only).", @@ -331,6 +337,7 @@ describe('DeprecationFactory', () => { Array [ Array [ Object { + "configPath": "myplugin.deprecated", "correctiveActions": Object { "manualSteps": Array [ "Replace \\"myplugin.deprecated\\" with \\"myplugin.renamed\\" in the Kibana config file, CLI flag, or environment variable (in Docker only).", @@ -373,6 +380,7 @@ describe('DeprecationFactory', () => { Array [ Array [ Object { + "configPath": "oldplugin.deprecated", "correctiveActions": Object { "manualSteps": Array [ "Replace \\"oldplugin.deprecated\\" with \\"newplugin.renamed\\" in the Kibana config file, CLI flag, or environment variable (in Docker only).", @@ -427,6 +435,7 @@ describe('DeprecationFactory', () => { Array [ Array [ Object { + "configPath": "myplugin.deprecated", "correctiveActions": Object { "manualSteps": Array [ "Make sure \\"myplugin.renamed\\" contains the correct value in the config file, CLI flag, or environment variable (in Docker only).", @@ -461,6 +470,7 @@ describe('DeprecationFactory', () => { Array [ Array [ Object { + "configPath": "myplugin.deprecated", "correctiveActions": Object { "manualSteps": Array [ "Remove \\"myplugin.deprecated\\" from the Kibana config file, CLI flag, or environment variable (in Docker only).", @@ -494,6 +504,7 @@ describe('DeprecationFactory', () => { Array [ Array [ Object { + "configPath": "myplugin.section.deprecated", "correctiveActions": Object { "manualSteps": Array [ "Remove \\"myplugin.section.deprecated\\" from the Kibana config file, CLI flag, or environment variable (in Docker only).", @@ -546,6 +557,7 @@ describe('DeprecationFactory', () => { Array [ Array [ Object { + "configPath": "myplugin.deprecated", "correctiveActions": Object { "manualSteps": Array [ "Remove \\"myplugin.deprecated\\" from the Kibana config file, CLI flag, or environment variable (in Docker only).", From 5eec8e23fb9cb17c88d9839eb6a21ddc92df9caa Mon Sep 17 00:00:00 2001 From: pgayvallet Date: Wed, 13 Oct 2021 12:31:27 +0200 Subject: [PATCH 05/12] adapt deprecation types --- .../deprecations/deprecations_factory.test.ts | 27 +++++++----- .../deprecations/deprecations_factory.ts | 10 ++++- .../deprecations/deprecations_service.mock.ts | 2 +- .../deprecations/deprecations_service.ts | 41 ++++++++++++++----- src/core/server/deprecations/index.ts | 3 ++ src/core/server/deprecations/types.ts | 28 +++++++++++-- src/core/server/index.ts | 3 ++ src/core/server/server.ts | 2 +- 8 files changed, 88 insertions(+), 28 deletions(-) diff --git a/src/core/server/deprecations/deprecations_factory.test.ts b/src/core/server/deprecations/deprecations_factory.test.ts index 85ef521538b15..eb57561a00e00 100644 --- a/src/core/server/deprecations/deprecations_factory.test.ts +++ b/src/core/server/deprecations/deprecations_factory.test.ts @@ -7,20 +7,25 @@ */ import type { GetDeprecationsContext } from './types'; -import { DeprecationsFactory } from './deprecations_factory'; +import { DeprecationsFactory, DeprecationsFactoryConfig } from './deprecations_factory'; import { loggerMock } from '../logging/logger.mock'; describe('DeprecationsFactory', () => { - const logger = loggerMock.create(); + let logger: ReturnType; + let config: DeprecationsFactoryConfig; + beforeEach(() => { - loggerMock.clear(logger); + logger = loggerMock.create(); + config = { + ignoredConfigDeprecations: [], + }; }); describe('getRegistry', () => { const domainId = 'test-plugin'; it('creates a registry for a domainId', async () => { - const deprecationsFactory = new DeprecationsFactory({ logger }); + const deprecationsFactory = new DeprecationsFactory({ logger, config }); const registry = deprecationsFactory.getRegistry(domainId); expect(registry).toHaveProperty('registerDeprecations'); @@ -28,7 +33,7 @@ describe('DeprecationsFactory', () => { }); it('creates one registry for a domainId', async () => { - const deprecationsFactory = new DeprecationsFactory({ logger }); + const deprecationsFactory = new DeprecationsFactory({ logger, config }); const registry = deprecationsFactory.getRegistry(domainId); const sameRegistry = deprecationsFactory.getRegistry(domainId); @@ -36,7 +41,7 @@ describe('DeprecationsFactory', () => { }); it('returns a registered registry', () => { - const deprecationsFactory = new DeprecationsFactory({ logger }); + const deprecationsFactory = new DeprecationsFactory({ logger, config }); const mockRegistry = 'mock-reg'; const mockRegistries = { set: jest.fn(), @@ -61,7 +66,7 @@ describe('DeprecationsFactory', () => { } as unknown as GetDeprecationsContext; it('returns a flattened array of deprecations', async () => { - const deprecationsFactory = new DeprecationsFactory({ logger }); + const deprecationsFactory = new DeprecationsFactory({ logger, config }); const mockPluginDeprecationsInfo = [ { message: 'mockPlugin message', @@ -110,7 +115,7 @@ describe('DeprecationsFactory', () => { }); it(`returns a failure message for failed getDeprecations functions`, async () => { - const deprecationsFactory = new DeprecationsFactory({ logger }); + const deprecationsFactory = new DeprecationsFactory({ logger, config }); const domainId = 'mockPlugin'; const mockError = new Error(); @@ -142,7 +147,7 @@ describe('DeprecationsFactory', () => { }); it(`returns successful results even when some getDeprecations fail`, async () => { - const deprecationsFactory = new DeprecationsFactory({ logger }); + const deprecationsFactory = new DeprecationsFactory({ logger, config }); const mockPluginRegistry = deprecationsFactory.getRegistry('mockPlugin'); const anotherMockPluginRegistry = deprecationsFactory.getRegistry('anotherMockPlugin'); const mockError = new Error(); @@ -190,7 +195,7 @@ describe('DeprecationsFactory', () => { } as unknown as GetDeprecationsContext; it('returns a flattened array of DeprecationInfo', async () => { - const deprecationsFactory = new DeprecationsFactory({ logger }); + const deprecationsFactory = new DeprecationsFactory({ logger, config }); const deprecationsRegistry = deprecationsFactory.getRegistry('mockPlugin'); const deprecationsBody = [ { @@ -225,7 +230,7 @@ describe('DeprecationsFactory', () => { }); it('removes empty entries from the returned array', async () => { - const deprecationsFactory = new DeprecationsFactory({ logger }); + const deprecationsFactory = new DeprecationsFactory({ logger, config }); const deprecationsRegistry = deprecationsFactory.getRegistry('mockPlugin'); const deprecationsBody = [ { diff --git a/src/core/server/deprecations/deprecations_factory.ts b/src/core/server/deprecations/deprecations_factory.ts index 9905f0b26b4f3..6958829abfe09 100644 --- a/src/core/server/deprecations/deprecations_factory.ts +++ b/src/core/server/deprecations/deprecations_factory.ts @@ -17,13 +17,21 @@ import type { export interface DeprecationsFactoryDeps { logger: Logger; + config: DeprecationsFactoryConfig; +} + +export interface DeprecationsFactoryConfig { + ignoredConfigDeprecations: string[]; } export class DeprecationsFactory { private readonly registries: Map = new Map(); private readonly logger: Logger; - constructor({ logger }: DeprecationsFactoryDeps) { + // private readonly config: DeprecationsFactoryConfig; + + constructor({ logger, config }: DeprecationsFactoryDeps) { this.logger = logger; + // this.config = config; } public getRegistry = (domainId: string): DeprecationsRegistry => { diff --git a/src/core/server/deprecations/deprecations_service.mock.ts b/src/core/server/deprecations/deprecations_service.mock.ts index 2f9c8bade6405..c274c4409cce2 100644 --- a/src/core/server/deprecations/deprecations_service.mock.ts +++ b/src/core/server/deprecations/deprecations_service.mock.ts @@ -50,7 +50,7 @@ const createDeprecationsServiceMock = () => { stop: jest.fn(), }; - mocked.setup.mockReturnValue(createInternalSetupContractMock()); + mocked.setup.mockResolvedValue(createInternalSetupContractMock()); return mocked; }; diff --git a/src/core/server/deprecations/deprecations_service.ts b/src/core/server/deprecations/deprecations_service.ts index eb7808871dd2b..0c3fd75987aa6 100644 --- a/src/core/server/deprecations/deprecations_service.ts +++ b/src/core/server/deprecations/deprecations_service.ts @@ -6,12 +6,14 @@ * Side Public License, v 1. */ +import { take } from 'rxjs/operators'; + import { DeprecationsFactory } from './deprecations_factory'; import { DomainDeprecationDetails, RegisterDeprecationsConfig } from './types'; import { registerRoutes } from './routes'; -// import { config as deprecationConfig, DeprecationConfigType } from './deprecation_config'; - +import { config as deprecationConfig, DeprecationConfigType } from './deprecation_config'; import { CoreContext } from '../core_context'; +import { IConfigService } from '../config'; import { CoreService } from '../../types'; import { InternalHttpServiceSetup } from '../http'; import { Logger } from '../logging'; @@ -104,6 +106,7 @@ export interface DeprecationsServiceSetup { export interface DeprecationsClient { getAllDeprecations: () => Promise; } + export interface InternalDeprecationsServiceStart { /** * Creates a {@link DeprecationsClient} with provided SO client and ES client. @@ -130,22 +133,33 @@ export class DeprecationsService implements CoreService { private readonly logger: Logger; - private readonly deprecationsFactory: DeprecationsFactory; + private readonly configService: IConfigService; + private deprecationsFactory?: DeprecationsFactory; - constructor(private readonly coreContext: Pick) { + constructor(coreContext: Pick) { this.logger = coreContext.logger.get('deprecations-service'); - this.deprecationsFactory = new DeprecationsFactory({ - logger: this.logger, - }); + this.configService = coreContext.configService; } - public setup({ http }: DeprecationsSetupDeps): InternalDeprecationsServiceSetup { + public async setup({ http }: DeprecationsSetupDeps): Promise { this.logger.debug('Setting up Deprecations service'); - const deprecationsFactory = this.deprecationsFactory; + + const config = await this.configService + .atPath(deprecationConfig.path) + .pipe(take(1)) + .toPromise(); + + this.deprecationsFactory = new DeprecationsFactory({ + logger: this.logger, + config: { + ignoredConfigDeprecations: config.skip_deprecated_settings, + }, + }); registerRoutes({ http }); this.registerConfigDeprecationsInfo(this.deprecationsFactory); + const deprecationsFactory = this.deprecationsFactory; return { getRegistry: (domainId: string): DeprecationsServiceSetup => { const registry = deprecationsFactory.getRegistry(domainId); @@ -157,6 +171,9 @@ export class DeprecationsService } public start(): InternalDeprecationsServiceStart { + if (!this.deprecationsFactory) { + throw new Error('`setup` must be called before `start`'); + } return { asScopedToClient: this.createScopedDeprecations(), }; @@ -170,7 +187,7 @@ export class DeprecationsService ) => DeprecationsClient { return (esClient: IScopedClusterClient, savedObjectsClient: SavedObjectsClientContract) => { return { - getAllDeprecations: this.deprecationsFactory.getAllDeprecations.bind(null, { + getAllDeprecations: this.deprecationsFactory!.getAllDeprecations.bind(null, { savedObjectsClient, esClient, }), @@ -179,7 +196,7 @@ export class DeprecationsService } private registerConfigDeprecationsInfo(deprecationsFactory: DeprecationsFactory) { - const handledDeprecatedConfigs = this.coreContext.configService.getHandledDeprecatedConfigs(); + const handledDeprecatedConfigs = this.configService.getHandledDeprecatedConfigs(); for (const [domainId, deprecationsContexts] of handledDeprecatedConfigs) { const deprecationsRegistry = deprecationsFactory.getRegistry(domainId); @@ -187,12 +204,14 @@ export class DeprecationsService getDeprecations: () => { return deprecationsContexts.map( ({ + configPath, title = `${domainId} has a deprecated setting`, level = 'critical', message, correctiveActions, documentationUrl, }) => ({ + configPath, title, level, message, diff --git a/src/core/server/deprecations/index.ts b/src/core/server/deprecations/index.ts index 168b716fe2c1e..d9225750f04a1 100644 --- a/src/core/server/deprecations/index.ts +++ b/src/core/server/deprecations/index.ts @@ -7,7 +7,10 @@ */ export type { + BaseDeprecationDetails, DeprecationsDetails, + ConfigDeprecationDetails, + FeatureDeprecationDetails, GetDeprecationsContext, RegisterDeprecationsConfig, DeprecationsGetResponse, diff --git a/src/core/server/deprecations/types.ts b/src/core/server/deprecations/types.ts index c5e510e7bfc3b..3990a76f7578e 100644 --- a/src/core/server/deprecations/types.ts +++ b/src/core/server/deprecations/types.ts @@ -11,9 +11,11 @@ import type { SavedObjectsClientContract } from '../saved_objects/types'; import type { IScopedClusterClient } from '../elasticsearch'; /** + * Base properties shared by all types of deprecations + * * @public */ -export interface DeprecationsDetails { +export interface BaseDeprecationDetails { /** * The title of the deprecation. * Check the README for writing deprecations in `src/core/server/deprecations/README.mdx` @@ -74,12 +76,32 @@ export interface DeprecationsDetails { }; } +/** + * @public + */ +export interface ConfigDeprecationDetails extends BaseDeprecationDetails { + configPath: string; + deprecationType: 'config'; +} + +/** + * @public + */ +export interface FeatureDeprecationDetails extends BaseDeprecationDetails { + deprecationType?: 'feature' | undefined; +} + +/** + * @public + */ +export type DeprecationsDetails = ConfigDeprecationDetails | FeatureDeprecationDetails; + /** * @internal */ -export interface DomainDeprecationDetails extends DeprecationsDetails { +export type DomainDeprecationDetails = DeprecationsDetails & { domainId: string; -} +}; /** * @public diff --git a/src/core/server/index.ts b/src/core/server/index.ts index 2e46e8f68570c..c92a91c96da95 100644 --- a/src/core/server/index.ts +++ b/src/core/server/index.ts @@ -387,7 +387,10 @@ export { EventLoopDelaysMonitor } from './metrics'; export type { I18nServiceSetup } from './i18n'; export type { + BaseDeprecationDetails, DeprecationsDetails, + ConfigDeprecationDetails, + FeatureDeprecationDetails, RegisterDeprecationsConfig, GetDeprecationsContext, DeprecationsServiceSetup, diff --git a/src/core/server/server.ts b/src/core/server/server.ts index 1ccfdbfd6c891..2d3b87207fcbe 100644 --- a/src/core/server/server.ts +++ b/src/core/server/server.ts @@ -203,7 +203,7 @@ export class Server { executionContext: executionContextSetup, }); - const deprecationsSetup = this.deprecations.setup({ + const deprecationsSetup = await this.deprecations.setup({ http: httpSetup, }); From 69c8660641c771f82df0982f07a189e0dc7164c7 Mon Sep 17 00:00:00 2001 From: pgayvallet Date: Wed, 13 Oct 2021 13:19:25 +0200 Subject: [PATCH 06/12] fix more deprecations --- test/plugin_functional/test_suites/core/deprecations.ts | 3 +++ x-pack/plugins/stack_alerts/server/index.ts | 1 + .../plugins/upgrade_assistant/server/lib/kibana_status.test.ts | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/test/plugin_functional/test_suites/core/deprecations.ts b/test/plugin_functional/test_suites/core/deprecations.ts index dbaf10008e35e..d8dc82a56cb55 100644 --- a/test/plugin_functional/test_suites/core/deprecations.ts +++ b/test/plugin_functional/test_suites/core/deprecations.ts @@ -19,6 +19,7 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide const CorePluginDeprecationsPluginDeprecations: DomainDeprecationDetails[] = [ { + configPath: 'corePluginDeprecations.oldProperty', title: 'Setting "corePluginDeprecations.oldProperty" is deprecated', level: 'critical', message: @@ -33,6 +34,7 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide requireRestart: true, }, { + configPath: 'corePluginDeprecations.noLongerUsed', title: 'Setting "corePluginDeprecations.noLongerUsed" is deprecated', level: 'critical', message: 'You no longer need to configure "corePluginDeprecations.noLongerUsed".', @@ -46,6 +48,7 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide requireRestart: true, }, { + configPath: 'corePluginDeprecations.secret', title: 'corePluginDeprecations has a deprecated setting', level: 'critical', message: diff --git a/x-pack/plugins/stack_alerts/server/index.ts b/x-pack/plugins/stack_alerts/server/index.ts index 9491f3e646c70..1ac774a2d6c3f 100644 --- a/x-pack/plugins/stack_alerts/server/index.ts +++ b/x-pack/plugins/stack_alerts/server/index.ts @@ -18,6 +18,7 @@ export const config: PluginConfigDescriptor = { const stackAlerts = get(settings, fromPath); if (stackAlerts?.enabled === false || stackAlerts?.enabled === true) { addDeprecation({ + configPath: 'xpack.stack_alerts.enabled', message: `"xpack.stack_alerts.enabled" is deprecated. The ability to disable this plugin will be removed in 8.0.0.`, correctiveActions: { manualSteps: [`Remove "xpack.stack_alerts.enabled" from your kibana configs.`], diff --git a/x-pack/plugins/upgrade_assistant/server/lib/kibana_status.test.ts b/x-pack/plugins/upgrade_assistant/server/lib/kibana_status.test.ts index 63532543a418b..296a313abef38 100644 --- a/x-pack/plugins/upgrade_assistant/server/lib/kibana_status.test.ts +++ b/x-pack/plugins/upgrade_assistant/server/lib/kibana_status.test.ts @@ -20,7 +20,7 @@ const mockKibanaDeprecations: DomainDeprecationDetails[] = [ 'Using Kibana role-mapping management, change all role-mappings which assing the kibana_user role to the kibana_admin role.', ], }, - deprecationType: 'config', + deprecationType: 'feature', documentationUrl: 'testDocUrl', level: 'critical', message: 'testMessage', From 41ac30dca22157ef6492fd22464e779ba3021a19 Mon Sep 17 00:00:00 2001 From: pgayvallet Date: Wed, 13 Oct 2021 14:04:37 +0200 Subject: [PATCH 07/12] add filtering and adapt unit tests --- .../deprecations/deprecations_factory.test.ts | 134 +++++++++++++++--- .../deprecations/deprecations_factory.ts | 31 ++-- 2 files changed, 138 insertions(+), 27 deletions(-) diff --git a/src/core/server/deprecations/deprecations_factory.test.ts b/src/core/server/deprecations/deprecations_factory.test.ts index eb57561a00e00..d68a83b8b19d4 100644 --- a/src/core/server/deprecations/deprecations_factory.test.ts +++ b/src/core/server/deprecations/deprecations_factory.test.ts @@ -9,6 +9,7 @@ import type { GetDeprecationsContext } from './types'; import { DeprecationsFactory, DeprecationsFactoryConfig } from './deprecations_factory'; import { loggerMock } from '../logging/logger.mock'; +import { DeprecationsDetails } from './types'; describe('DeprecationsFactory', () => { let logger: ReturnType; @@ -102,8 +103,8 @@ describe('DeprecationsFactory', () => { getDeprecations: jest.fn().mockResolvedValue(anotherMockPluginDeprecationsInfo), }); - const derpecations = await deprecationsFactory.getAllDeprecations(mockDependencies); - expect(derpecations).toStrictEqual( + const deprecations = await deprecationsFactory.getAllDeprecations(mockDependencies); + expect(deprecations).toStrictEqual( [ mockPluginDeprecationsInfo.map((info) => ({ ...info, domainId: 'mockPlugin' })), anotherMockPluginDeprecationsInfo.map((info) => ({ @@ -166,14 +167,14 @@ describe('DeprecationsFactory', () => { anotherMockPluginRegistry.registerDeprecations({ getDeprecations: jest.fn().mockRejectedValue(mockError), }); - const derpecations = await deprecationsFactory.getAllDeprecations(mockDependencies); + const deprecations = await deprecationsFactory.getAllDeprecations(mockDependencies); expect(logger.warn).toBeCalledTimes(1); expect(logger.warn).toBeCalledWith( `Failed to get deprecations info for plugin "anotherMockPlugin".`, mockError ); - expect(derpecations).toStrictEqual([ + expect(deprecations).toStrictEqual([ ...mockPluginDeprecationsInfo.map((info) => ({ ...info, domainId: 'mockPlugin' })), { domainId: 'anotherMockPlugin', @@ -186,6 +187,85 @@ describe('DeprecationsFactory', () => { }, ]); }); + + it('excludes config deprecations explicitly ignored via `ignoredConfigDeprecations`', async () => { + const deprecationsFactory = new DeprecationsFactory({ + logger, + config: { + ignoredConfigDeprecations: ['mockPlugin.foo', 'anotherMockPlugin.bar'], + }, + }); + const mockPluginDeprecationsInfo: DeprecationsDetails[] = [ + { + configPath: 'mockPlugin.foo', + title: 'mockPlugin.foo is deprecated', + message: 'mockPlugin.foo is deprecated and will be removed in a future Kibana version', + level: 'critical', + deprecationType: 'config', + correctiveActions: { + manualSteps: ['come on', 'do something'], + }, + }, + { + configPath: 'mockPlugin.bar', + title: 'mockPlugin.bar is deprecated', + message: 'mockPlugin.bar is deprecated and will be removed in a future Kibana version', + level: 'critical', + deprecationType: 'config', + correctiveActions: { + manualSteps: ['come on', 'do something'], + }, + }, + ]; + const anotherMockPluginDeprecationsInfo: DeprecationsDetails[] = [ + { + configPath: 'anotherMockPlugin.foo', + title: 'anotherMockPlugin.foo is deprecated', + message: + 'anotherMockPlugin.foo is deprecated and will be removed in a future Kibana version', + level: 'critical', + deprecationType: 'config', + correctiveActions: { + manualSteps: ['come on', 'do something'], + }, + }, + { + configPath: 'anotherMockPlugin.bar', + title: 'anotherMockPlugin.bar is deprecated', + message: + 'anotherMockPlugin.bar is deprecated and will be removed in a future Kibana version', + level: 'critical', + deprecationType: 'config', + correctiveActions: { + manualSteps: ['come on', 'do something'], + }, + }, + ]; + + const mockPluginRegistry = deprecationsFactory.getRegistry('mockPlugin'); + mockPluginRegistry.registerDeprecations({ + getDeprecations: jest.fn().mockResolvedValue(mockPluginDeprecationsInfo), + }); + + const anotherMockPluginRegistry = deprecationsFactory.getRegistry('anotherMockPlugin'); + anotherMockPluginRegistry.registerDeprecations({ + getDeprecations: jest.fn().mockResolvedValue(anotherMockPluginDeprecationsInfo), + }); + + const deprecations = await deprecationsFactory.getAllDeprecations(mockDependencies); + + expect(deprecations).toHaveLength(2); + expect(deprecations).toEqual([ + expect.objectContaining({ + configPath: 'mockPlugin.bar', + title: 'mockPlugin.bar is deprecated', + }), + expect.objectContaining({ + configPath: 'anotherMockPlugin.foo', + title: 'anotherMockPlugin.foo is deprecated', + }), + ]); + }); }); describe('getDeprecations', () => { @@ -220,40 +300,62 @@ describe('DeprecationsFactory', () => { getDeprecations: jest.fn().mockResolvedValue(deprecationsBody), }); - const derpecations = await deprecationsFactory.getDeprecations( + const deprecations = await deprecationsFactory.getDeprecations( 'mockPlugin', mockDependencies ); - expect(derpecations).toStrictEqual( + expect(deprecations).toStrictEqual( deprecationsBody.flat().map((body) => ({ ...body, domainId: 'mockPlugin' })) ); }); - it('removes empty entries from the returned array', async () => { - const deprecationsFactory = new DeprecationsFactory({ logger, config }); + it('excludes config deprecations explicitly ignored via `ignoredConfigDeprecations`', async () => { + const deprecationsFactory = new DeprecationsFactory({ + logger, + config: { + ignoredConfigDeprecations: ['test.foo'], + }, + }); const deprecationsRegistry = deprecationsFactory.getRegistry('mockPlugin'); - const deprecationsBody = [ + const deprecationsBody: DeprecationsDetails[] = [ { - message: 'mockPlugin message', + configPath: 'test.foo', + title: 'test.foo is deprecated', + message: 'test.foo is deprecated and will be removed in a future Kibana version', level: 'critical', + deprecationType: 'config', correctiveActions: { - manualSteps: ['mockPlugin step 1', 'mockPlugin step 2'], + manualSteps: ['come on', 'do something'], + }, + }, + { + configPath: 'test.bar', + title: 'test.bar is deprecated', + message: 'test.bar is deprecated and will be removed in a future Kibana version', + level: 'critical', + deprecationType: 'config', + correctiveActions: { + manualSteps: ['come on', 'do something'], }, }, - [undefined], - undefined, ]; deprecationsRegistry.registerDeprecations({ getDeprecations: jest.fn().mockResolvedValue(deprecationsBody), }); - const derpecations = await deprecationsFactory.getDeprecations( + const deprecations = await deprecationsFactory.getDeprecations( 'mockPlugin', mockDependencies ); - expect(derpecations).toHaveLength(1); - expect(derpecations).toStrictEqual([{ ...deprecationsBody[0], domainId: 'mockPlugin' }]); + expect(deprecations).toHaveLength(1); + expect(deprecations[0]).toEqual( + expect.objectContaining({ + deprecationType: 'config', + configPath: 'test.bar', + title: 'test.bar is deprecated', + }) + ); }); }); }); diff --git a/src/core/server/deprecations/deprecations_factory.ts b/src/core/server/deprecations/deprecations_factory.ts index 6958829abfe09..ad28af2db528e 100644 --- a/src/core/server/deprecations/deprecations_factory.ts +++ b/src/core/server/deprecations/deprecations_factory.ts @@ -27,11 +27,11 @@ export interface DeprecationsFactoryConfig { export class DeprecationsFactory { private readonly registries: Map = new Map(); private readonly logger: Logger; - // private readonly config: DeprecationsFactoryConfig; + private readonly config: DeprecationsFactoryConfig; constructor({ logger, config }: DeprecationsFactoryDeps) { this.logger = logger; - // this.config = config; + this.config = config; } public getRegistry = (domainId: string): DeprecationsRegistry => { @@ -49,7 +49,7 @@ export class DeprecationsFactory { dependencies: GetDeprecationsContext ): Promise => { const infoBody = await this.getDeprecationsBody(domainId, dependencies); - return this.createDeprecationInfo(domainId, infoBody).flat(); + return this.createDeprecationInfo(domainId, infoBody); }; public getAllDeprecations = async ( @@ -71,13 +71,10 @@ export class DeprecationsFactory { domainId: string, deprecationInfoBody: DeprecationsDetails[] ): DomainDeprecationDetails[] => { - return deprecationInfoBody - .flat() - .filter(Boolean) - .map((pluginDeprecation) => ({ - ...pluginDeprecation, - domainId, - })); + return deprecationInfoBody.map((pluginDeprecation) => ({ + ...pluginDeprecation, + domainId, + })); }; private getDeprecationsBody = async ( @@ -121,7 +118,7 @@ export class DeprecationsFactory { ]; } - return settledResult.value; + return filterIgnoredDeprecations(settledResult.value.flat(), this.config); }); } catch (err) { this.logger.warn(`Failed to get deprecations info for plugin "${domainId}".`, err); @@ -129,3 +126,15 @@ export class DeprecationsFactory { } }; } + +const filterIgnoredDeprecations = ( + deprecations: DeprecationsDetails[], + config: DeprecationsFactoryConfig +): DeprecationsDetails[] => { + return deprecations.filter((deprecation) => { + if (deprecation.deprecationType === 'config') { + return !config.ignoredConfigDeprecations.includes(deprecation.configPath); + } + return true; + }); +}; From 06df184d5eab662c563ba707f2350ec4b31c5cfb Mon Sep 17 00:00:00 2001 From: pgayvallet Date: Thu, 14 Oct 2021 07:59:44 +0200 Subject: [PATCH 08/12] add service unit tests --- .../deprecations_service.test.mocks.ts | 18 ++++++ .../deprecations/deprecations_service.test.ts | 58 ++++++++++++++----- 2 files changed, 61 insertions(+), 15 deletions(-) create mode 100644 src/core/server/deprecations/deprecations_service.test.mocks.ts diff --git a/src/core/server/deprecations/deprecations_service.test.mocks.ts b/src/core/server/deprecations/deprecations_service.test.mocks.ts new file mode 100644 index 0000000000000..3174698725f96 --- /dev/null +++ b/src/core/server/deprecations/deprecations_service.test.mocks.ts @@ -0,0 +1,18 @@ +/* + * 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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { mockDeprecationsFactory } from './deprecations_factory.mock'; + +export const mockedDeprecationFactoryInstance = mockDeprecationsFactory.create(); +export const DeprecationsFactoryMock = jest + .fn() + .mockImplementation(() => mockedDeprecationFactoryInstance); + +jest.doMock('./deprecations_factory', () => ({ + DeprecationsFactory: DeprecationsFactoryMock, +})); diff --git a/src/core/server/deprecations/deprecations_service.test.ts b/src/core/server/deprecations/deprecations_service.test.ts index 4c08bb95ed748..a058ac38d5b01 100644 --- a/src/core/server/deprecations/deprecations_service.test.ts +++ b/src/core/server/deprecations/deprecations_service.test.ts @@ -6,42 +6,69 @@ * Side Public License, v 1. */ +import { DeprecationsFactoryMock } from './deprecations_service.test.mocks'; + /* eslint-disable dot-notation */ -import { DeprecationsService } from './deprecations_service'; +import { DeprecationsService, DeprecationsSetupDeps } from './deprecations_service'; import { httpServiceMock } from '../http/http_service.mock'; -import { mockRouter } from '../http/router/router.mock'; -import { savedObjectsClientMock, elasticsearchServiceMock } from '../mocks'; +import { savedObjectsClientMock, elasticsearchServiceMock, configServiceMock } from '../mocks'; import { mockCoreContext } from '../core_context.mock'; import { mockDeprecationsFactory } from './deprecations_factory.mock'; import { mockDeprecationsRegistry } from './deprecations_registry.mock'; describe('DeprecationsService', () => { - const coreContext = mockCoreContext.create(); - const http = httpServiceMock.createInternalSetupContract(); - const router = mockRouter.create(); - http.createRouter.mockReturnValue(router); - const deprecationsCoreSetupDeps = { http }; + let coreContext: ReturnType; + let http: ReturnType; + let router: ReturnType; + let deprecationsCoreSetupDeps: DeprecationsSetupDeps; + + beforeEach(() => { + const configService = configServiceMock.create({ + atPath: { skip_deprecated_settings: ['hello', 'world'] }, + }); + coreContext = mockCoreContext.create({ configService }); + http = httpServiceMock.createInternalSetupContract(); + router = httpServiceMock.createRouter(); + http.createRouter.mockReturnValue(router); + deprecationsCoreSetupDeps = { http }; + }); - beforeEach(() => jest.clearAllMocks()); + afterEach(() => { + jest.clearAllMocks(); + DeprecationsFactoryMock.mockClear(); + }); describe('#setup', () => { - it('registers routes', () => { + it('registers routes', async () => { const deprecationsService = new DeprecationsService(coreContext); - deprecationsService.setup(deprecationsCoreSetupDeps); - // Registers correct base api path + await deprecationsService.setup(deprecationsCoreSetupDeps); + // registers correct base api path expect(http.createRouter).toBeCalledWith('/api/deprecations'); // registers get route '/' expect(router.get).toHaveBeenCalledTimes(1); expect(router.get).toHaveBeenCalledWith({ path: '/', validate: false }, expect.any(Function)); }); - it('calls registerConfigDeprecationsInfo', () => { + it('calls registerConfigDeprecationsInfo', async () => { const deprecationsService = new DeprecationsService(coreContext); const mockRegisterConfigDeprecationsInfo = jest.fn(); deprecationsService['registerConfigDeprecationsInfo'] = mockRegisterConfigDeprecationsInfo; - deprecationsService.setup(deprecationsCoreSetupDeps); + await deprecationsService.setup(deprecationsCoreSetupDeps); expect(mockRegisterConfigDeprecationsInfo).toBeCalledTimes(1); }); + + it('creates DeprecationsFactory with the correct parameters', async () => { + const deprecationsService = new DeprecationsService(coreContext); + await deprecationsService.setup(deprecationsCoreSetupDeps); + + expect(DeprecationsFactoryMock).toHaveBeenCalledTimes(1); + expect(DeprecationsFactoryMock).toHaveBeenCalledWith({ + logger: expect.any(Object), + config: { + ignoredConfigDeprecations: ['hello', 'world'], + }, + }); + }); }); describe('#start', () => { @@ -51,7 +78,7 @@ describe('DeprecationsService', () => { const savedObjectsClient = savedObjectsClientMock.create(); const deprecationsService = new DeprecationsService(coreContext); - deprecationsService.setup(deprecationsCoreSetupDeps); + await deprecationsService.setup(deprecationsCoreSetupDeps); const start = deprecationsService.start(); const deprecationsClient = start.asScopedToClient(esClient, savedObjectsClient); @@ -101,6 +128,7 @@ describe('DeprecationsService', () => { expect(configDeprecations).toMatchInlineSnapshot(` Array [ Object { + "configPath": "test", "correctiveActions": Object { "manualSteps": Array [ "Using Kibana user management, change all users using the kibana_user role to the kibana_admin role.", From 7d3a66bd963cf53755b69a19fea0bb585122a0a4 Mon Sep 17 00:00:00 2001 From: pgayvallet Date: Thu, 14 Oct 2021 08:52:18 +0200 Subject: [PATCH 09/12] update generated doc --- ...kibana-plugin-core-public.doclinksstart.md | 3 +- ...sedeprecationdetails.correctiveactions.md} | 4 +- ...basedeprecationdetails.deprecationtype.md} | 4 +- ...asedeprecationdetails.documentationurl.md} | 4 +- ...re-server.basedeprecationdetails.level.md} | 4 +- ...ugin-core-server.basedeprecationdetails.md | 26 +++++++++ ...-server.basedeprecationdetails.message.md} | 4 +- ....basedeprecationdetails.requirerestart.md} | 4 +- ...re-server.basedeprecationdetails.title.md} | 4 +- ...ver.configdeprecationdetails.configpath.md | 11 ++++ ...onfigdeprecationdetails.deprecationtype.md | 11 ++++ ...in-core-server.configdeprecationdetails.md | 20 +++++++ ...-plugin-core-server.deprecationsdetails.md | 17 +----- ...aturedeprecationdetails.deprecationtype.md | 11 ++++ ...n-core-server.featuredeprecationdetails.md | 19 ++++++ .../core/server/kibana-plugin-core-server.md | 5 +- src/core/public/public.api.md | 5 +- src/core/server/server.api.md | 58 ++++++++++++------- 18 files changed, 159 insertions(+), 55 deletions(-) rename docs/development/core/server/{kibana-plugin-core-server.deprecationsdetails.correctiveactions.md => kibana-plugin-core-server.basedeprecationdetails.correctiveactions.md} (66%) rename docs/development/core/server/{kibana-plugin-core-server.deprecationsdetails.deprecationtype.md => kibana-plugin-core-server.basedeprecationdetails.deprecationtype.md} (70%) rename docs/development/core/server/{kibana-plugin-core-server.deprecationsdetails.documentationurl.md => kibana-plugin-core-server.basedeprecationdetails.documentationurl.md} (53%) rename docs/development/core/server/{kibana-plugin-core-server.deprecationsdetails.level.md => kibana-plugin-core-server.basedeprecationdetails.level.md} (66%) create mode 100644 docs/development/core/server/kibana-plugin-core-server.basedeprecationdetails.md rename docs/development/core/server/{kibana-plugin-core-server.deprecationsdetails.message.md => kibana-plugin-core-server.basedeprecationdetails.message.md} (60%) rename docs/development/core/server/{kibana-plugin-core-server.deprecationsdetails.requirerestart.md => kibana-plugin-core-server.basedeprecationdetails.requirerestart.md} (54%) rename docs/development/core/server/{kibana-plugin-core-server.deprecationsdetails.title.md => kibana-plugin-core-server.basedeprecationdetails.title.md} (59%) create mode 100644 docs/development/core/server/kibana-plugin-core-server.configdeprecationdetails.configpath.md create mode 100644 docs/development/core/server/kibana-plugin-core-server.configdeprecationdetails.deprecationtype.md create mode 100644 docs/development/core/server/kibana-plugin-core-server.configdeprecationdetails.md create mode 100644 docs/development/core/server/kibana-plugin-core-server.featuredeprecationdetails.deprecationtype.md create mode 100644 docs/development/core/server/kibana-plugin-core-server.featuredeprecationdetails.md diff --git a/docs/development/core/public/kibana-plugin-core-public.doclinksstart.md b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.md index 51101c8804680..d90972d327041 100644 --- a/docs/development/core/public/kibana-plugin-core-public.doclinksstart.md +++ b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.md @@ -17,4 +17,5 @@ export interface DocLinksStart | --- | --- | --- | | [DOC\_LINK\_VERSION](./kibana-plugin-core-public.doclinksstart.doc_link_version.md) | string | | | [ELASTIC\_WEBSITE\_URL](./kibana-plugin-core-public.doclinksstart.elastic_website_url.md) | string | | -| [links](./kibana-plugin-core-public.doclinksstart.links.md) | {
readonly settings: string;
readonly apm: {
readonly kibanaSettings: string;
readonly supportedServiceMaps: string;
readonly customLinks: string;
readonly droppedTransactionSpans: string;
readonly upgrading: string;
readonly metaData: string;
};
readonly canvas: {
readonly guide: string;
};
readonly dashboard: {
readonly guide: string;
readonly drilldowns: string;
readonly drilldownsTriggerPicker: string;
readonly urlDrilldownTemplateSyntax: string;
readonly urlDrilldownVariables: string;
};
readonly discover: Record<string, string>;
readonly filebeat: {
readonly base: string;
readonly installation: string;
readonly configuration: string;
readonly elasticsearchOutput: string;
readonly elasticsearchModule: string;
readonly startup: string;
readonly exportedFields: string;
readonly suricataModule: string;
readonly zeekModule: string;
};
readonly auditbeat: {
readonly base: string;
readonly auditdModule: string;
readonly systemModule: string;
};
readonly metricbeat: {
readonly base: string;
readonly configure: string;
readonly httpEndpoint: string;
readonly install: string;
readonly start: string;
};
readonly enterpriseSearch: {
readonly base: string;
readonly appSearchBase: string;
readonly workplaceSearchBase: string;
};
readonly heartbeat: {
readonly base: string;
};
readonly libbeat: {
readonly getStarted: string;
};
readonly logstash: {
readonly base: string;
};
readonly functionbeat: {
readonly base: string;
};
readonly winlogbeat: {
readonly base: string;
};
readonly aggs: {
readonly composite: string;
readonly composite_missing_bucket: string;
readonly date_histogram: string;
readonly date_range: string;
readonly date_format_pattern: string;
readonly filter: string;
readonly filters: string;
readonly geohash_grid: string;
readonly histogram: string;
readonly ip_range: string;
readonly range: string;
readonly significant_terms: string;
readonly terms: string;
readonly avg: string;
readonly avg_bucket: string;
readonly max_bucket: string;
readonly min_bucket: string;
readonly sum_bucket: string;
readonly cardinality: string;
readonly count: string;
readonly cumulative_sum: string;
readonly derivative: string;
readonly geo_bounds: string;
readonly geo_centroid: string;
readonly max: string;
readonly median: string;
readonly min: string;
readonly moving_avg: string;
readonly percentile_ranks: string;
readonly serial_diff: string;
readonly std_dev: string;
readonly sum: string;
readonly top_hits: string;
};
readonly runtimeFields: {
readonly overview: string;
readonly mapping: string;
};
readonly scriptedFields: {
readonly scriptFields: string;
readonly scriptAggs: string;
readonly painless: string;
readonly painlessApi: string;
readonly painlessLangSpec: string;
readonly painlessSyntax: string;
readonly painlessWalkthrough: string;
readonly luceneExpressions: string;
};
readonly search: {
readonly sessions: string;
readonly sessionLimits: string;
};
readonly indexPatterns: {
readonly introduction: string;
readonly fieldFormattersNumber: string;
readonly fieldFormattersString: string;
readonly runtimeFields: string;
};
readonly addData: string;
readonly kibana: string;
readonly upgradeAssistant: string;
readonly rollupJobs: string;
readonly elasticsearch: Record<string, string>;
readonly siem: {
readonly privileges: string;
readonly guide: string;
readonly gettingStarted: string;
readonly ml: string;
readonly ruleChangeLog: string;
readonly detectionsReq: string;
readonly networkMap: string;
};
readonly securitySolution: {
readonly trustedApps: string;
};
readonly query: {
readonly eql: string;
readonly kueryQuerySyntax: string;
readonly luceneQuerySyntax: string;
readonly percolate: string;
readonly queryDsl: string;
readonly autocompleteChanges: string;
};
readonly date: {
readonly dateMath: string;
readonly dateMathIndexNames: string;
};
readonly management: Record<string, string>;
readonly ml: Record<string, string>;
readonly transforms: Record<string, string>;
readonly visualize: Record<string, string>;
readonly apis: Readonly<{
bulkIndexAlias: string;
byteSizeUnits: string;
createAutoFollowPattern: string;
createFollower: string;
createIndex: string;
createSnapshotLifecyclePolicy: string;
createRoleMapping: string;
createRoleMappingTemplates: string;
createRollupJobsRequest: string;
createApiKey: string;
createPipeline: string;
createTransformRequest: string;
cronExpressions: string;
executeWatchActionModes: string;
indexExists: string;
openIndex: string;
putComponentTemplate: string;
painlessExecute: string;
painlessExecuteAPIContexts: string;
putComponentTemplateMetadata: string;
putSnapshotLifecyclePolicy: string;
putIndexTemplateV1: string;
putWatch: string;
simulatePipeline: string;
timeUnits: string;
updateTransform: string;
}>;
readonly observability: Readonly<{
guide: string;
infrastructureThreshold: string;
logsThreshold: string;
metricsThreshold: string;
monitorStatus: string;
monitorUptime: string;
tlsCertificate: string;
uptimeDurationAnomaly: string;
}>;
readonly alerting: Record<string, string>;
readonly maps: Record<string, string>;
readonly monitoring: Record<string, string>;
readonly security: Readonly<{
apiKeyServiceSettings: string;
clusterPrivileges: string;
elasticsearchSettings: string;
elasticsearchEnableSecurity: string;
indicesPrivileges: string;
kibanaTLS: string;
kibanaPrivileges: string;
mappingRoles: string;
mappingRolesFieldRules: string;
runAsPrivilege: string;
}>;
readonly watcher: Record<string, string>;
readonly ccs: Record<string, string>;
readonly plugins: Record<string, string>;
readonly snapshotRestore: Record<string, string>;
readonly ingest: Record<string, string>;
readonly fleet: Readonly<{
guide: string;
fleetServer: string;
fleetServerAddFleetServer: string;
settings: string;
settingsFleetServerHostSettings: string;
troubleshooting: string;
elasticAgent: string;
datastreams: string;
datastreamsNamingScheme: string;
upgradeElasticAgent: string;
upgradeElasticAgent712lower: string;
}>;
readonly ecs: {
readonly guide: string;
};
readonly clients: {
readonly guide: string;
readonly goOverview: string;
readonly javaIndex: string;
readonly jsIntro: string;
readonly netGuide: string;
readonly perlGuide: string;
readonly phpGuide: string;
readonly pythonGuide: string;
readonly rubyOverview: string;
readonly rustGuide: string;
};
} | | \ No newline at end of file +| [links](./kibana-plugin-core-public.doclinksstart.links.md) | {
readonly settings: string;
readonly elasticStackGetStarted: string;
readonly apm: {
readonly kibanaSettings: string;
readonly supportedServiceMaps: string;
readonly customLinks: string;
readonly droppedTransactionSpans: string;
readonly upgrading: string;
readonly metaData: string;
};
readonly canvas: {
readonly guide: string;
};
readonly dashboard: {
readonly guide: string;
readonly drilldowns: string;
readonly drilldownsTriggerPicker: string;
readonly urlDrilldownTemplateSyntax: string;
readonly urlDrilldownVariables: string;
};
readonly discover: Record<string, string>;
readonly filebeat: {
readonly base: string;
readonly installation: string;
readonly configuration: string;
readonly elasticsearchOutput: string;
readonly elasticsearchModule: string;
readonly startup: string;
readonly exportedFields: string;
readonly suricataModule: string;
readonly zeekModule: string;
};
readonly auditbeat: {
readonly base: string;
readonly auditdModule: string;
readonly systemModule: string;
};
readonly metricbeat: {
readonly base: string;
readonly configure: string;
readonly httpEndpoint: string;
readonly install: string;
readonly start: string;
};
readonly enterpriseSearch: {
readonly base: string;
readonly appSearchBase: string;
readonly workplaceSearchBase: string;
};
readonly heartbeat: {
readonly base: string;
};
readonly libbeat: {
readonly getStarted: string;
};
readonly logstash: {
readonly base: string;
};
readonly functionbeat: {
readonly base: string;
};
readonly winlogbeat: {
readonly base: string;
};
readonly aggs: {
readonly composite: string;
readonly composite_missing_bucket: string;
readonly date_histogram: string;
readonly date_range: string;
readonly date_format_pattern: string;
readonly filter: string;
readonly filters: string;
readonly geohash_grid: string;
readonly histogram: string;
readonly ip_range: string;
readonly range: string;
readonly significant_terms: string;
readonly terms: string;
readonly avg: string;
readonly avg_bucket: string;
readonly max_bucket: string;
readonly min_bucket: string;
readonly sum_bucket: string;
readonly cardinality: string;
readonly count: string;
readonly cumulative_sum: string;
readonly derivative: string;
readonly geo_bounds: string;
readonly geo_centroid: string;
readonly max: string;
readonly median: string;
readonly min: string;
readonly moving_avg: string;
readonly percentile_ranks: string;
readonly serial_diff: string;
readonly std_dev: string;
readonly sum: string;
readonly top_hits: string;
};
readonly runtimeFields: {
readonly overview: string;
readonly mapping: string;
};
readonly scriptedFields: {
readonly scriptFields: string;
readonly scriptAggs: string;
readonly painless: string;
readonly painlessApi: string;
readonly painlessLangSpec: string;
readonly painlessSyntax: string;
readonly painlessWalkthrough: string;
readonly luceneExpressions: string;
};
readonly search: {
readonly sessions: string;
readonly sessionLimits: string;
};
readonly indexPatterns: {
readonly introduction: string;
readonly fieldFormattersNumber: string;
readonly fieldFormattersString: string;
readonly runtimeFields: string;
};
readonly addData: string;
readonly kibana: string;
readonly upgradeAssistant: string;
readonly rollupJobs: string;
readonly elasticsearch: Record<string, string>;
readonly siem: {
readonly privileges: string;
readonly guide: string;
readonly gettingStarted: string;
readonly ml: string;
readonly ruleChangeLog: string;
readonly detectionsReq: string;
readonly networkMap: string;
readonly troubleshootGaps: string;
};
readonly securitySolution: {
readonly trustedApps: string;
};
readonly query: {
readonly eql: string;
readonly kueryQuerySyntax: string;
readonly luceneQuerySyntax: string;
readonly percolate: string;
readonly queryDsl: string;
readonly autocompleteChanges: string;
};
readonly date: {
readonly dateMath: string;
readonly dateMathIndexNames: string;
};
readonly management: Record<string, string>;
readonly ml: Record<string, string>;
readonly transforms: Record<string, string>;
readonly visualize: Record<string, string>;
readonly apis: Readonly<{
bulkIndexAlias: string;
byteSizeUnits: string;
createAutoFollowPattern: string;
createFollower: string;
createIndex: string;
createSnapshotLifecyclePolicy: string;
createRoleMapping: string;
createRoleMappingTemplates: string;
createRollupJobsRequest: string;
createApiKey: string;
createPipeline: string;
createTransformRequest: string;
cronExpressions: string;
executeWatchActionModes: string;
indexExists: string;
openIndex: string;
putComponentTemplate: string;
painlessExecute: string;
painlessExecuteAPIContexts: string;
putComponentTemplateMetadata: string;
putSnapshotLifecyclePolicy: string;
putIndexTemplateV1: string;
putWatch: string;
simulatePipeline: string;
timeUnits: string;
updateTransform: string;
}>;
readonly observability: Readonly<{
guide: string;
infrastructureThreshold: string;
logsThreshold: string;
metricsThreshold: string;
monitorStatus: string;
monitorUptime: string;
tlsCertificate: string;
uptimeDurationAnomaly: string;
}>;
readonly alerting: Record<string, string>;
readonly maps: Record<string, string>;
readonly monitoring: Record<string, string>;
readonly security: Readonly<{
apiKeyServiceSettings: string;
clusterPrivileges: string;
elasticsearchSettings: string;
elasticsearchEnableSecurity: string;
indicesPrivileges: string;
kibanaTLS: string;
kibanaPrivileges: string;
mappingRoles: string;
mappingRolesFieldRules: string;
runAsPrivilege: string;
}>;
readonly spaces: Readonly<{
kibanaLegacyUrlAliases: string;
kibanaDisableLegacyUrlAliasesApi: string;
}>;
readonly watcher: Record<string, string>;
readonly ccs: Record<string, string>;
readonly plugins: Record<string, string>;
readonly snapshotRestore: Record<string, string>;
readonly ingest: Record<string, string>;
readonly fleet: Readonly<{
guide: string;
fleetServer: string;
fleetServerAddFleetServer: string;
settings: string;
settingsFleetServerHostSettings: string;
troubleshooting: string;
elasticAgent: string;
datastreams: string;
datastreamsNamingScheme: string;
upgradeElasticAgent: string;
upgradeElasticAgent712lower: string;
learnMoreBlog: string;
apiKeysLearnMore: string;
}>;
readonly ecs: {
readonly guide: string;
};
readonly clients: {
readonly guide: string;
readonly goOverview: string;
readonly javaIndex: string;
readonly jsIntro: string;
readonly netGuide: string;
readonly perlGuide: string;
readonly phpGuide: string;
readonly pythonGuide: string;
readonly rubyOverview: string;
readonly rustGuide: string;
};
} | | + diff --git a/docs/development/core/server/kibana-plugin-core-server.deprecationsdetails.correctiveactions.md b/docs/development/core/server/kibana-plugin-core-server.basedeprecationdetails.correctiveactions.md similarity index 66% rename from docs/development/core/server/kibana-plugin-core-server.deprecationsdetails.correctiveactions.md rename to docs/development/core/server/kibana-plugin-core-server.basedeprecationdetails.correctiveactions.md index d7d10651033bf..273945166735b 100644 --- a/docs/development/core/server/kibana-plugin-core-server.deprecationsdetails.correctiveactions.md +++ b/docs/development/core/server/kibana-plugin-core-server.basedeprecationdetails.correctiveactions.md @@ -1,8 +1,8 @@ -[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [DeprecationsDetails](./kibana-plugin-core-server.deprecationsdetails.md) > [correctiveActions](./kibana-plugin-core-server.deprecationsdetails.correctiveactions.md) +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [BaseDeprecationDetails](./kibana-plugin-core-server.basedeprecationdetails.md) > [correctiveActions](./kibana-plugin-core-server.basedeprecationdetails.correctiveactions.md) -## DeprecationsDetails.correctiveActions property +## BaseDeprecationDetails.correctiveActions property corrective action needed to fix this deprecation. diff --git a/docs/development/core/server/kibana-plugin-core-server.deprecationsdetails.deprecationtype.md b/docs/development/core/server/kibana-plugin-core-server.basedeprecationdetails.deprecationtype.md similarity index 70% rename from docs/development/core/server/kibana-plugin-core-server.deprecationsdetails.deprecationtype.md rename to docs/development/core/server/kibana-plugin-core-server.basedeprecationdetails.deprecationtype.md index 3a76bc60ee630..072dfd17418f9 100644 --- a/docs/development/core/server/kibana-plugin-core-server.deprecationsdetails.deprecationtype.md +++ b/docs/development/core/server/kibana-plugin-core-server.basedeprecationdetails.deprecationtype.md @@ -1,8 +1,8 @@ -[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [DeprecationsDetails](./kibana-plugin-core-server.deprecationsdetails.md) > [deprecationType](./kibana-plugin-core-server.deprecationsdetails.deprecationtype.md) +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [BaseDeprecationDetails](./kibana-plugin-core-server.basedeprecationdetails.md) > [deprecationType](./kibana-plugin-core-server.basedeprecationdetails.deprecationtype.md) -## DeprecationsDetails.deprecationType property +## BaseDeprecationDetails.deprecationType property (optional) Used to identify between different deprecation types. Example use case: in Upgrade Assistant, we may want to allow the user to sort by deprecation type or show each type in a separate tab. diff --git a/docs/development/core/server/kibana-plugin-core-server.deprecationsdetails.documentationurl.md b/docs/development/core/server/kibana-plugin-core-server.basedeprecationdetails.documentationurl.md similarity index 53% rename from docs/development/core/server/kibana-plugin-core-server.deprecationsdetails.documentationurl.md rename to docs/development/core/server/kibana-plugin-core-server.basedeprecationdetails.documentationurl.md index 457cf7b61dac8..c8f0762acdce6 100644 --- a/docs/development/core/server/kibana-plugin-core-server.deprecationsdetails.documentationurl.md +++ b/docs/development/core/server/kibana-plugin-core-server.basedeprecationdetails.documentationurl.md @@ -1,8 +1,8 @@ -[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [DeprecationsDetails](./kibana-plugin-core-server.deprecationsdetails.md) > [documentationUrl](./kibana-plugin-core-server.deprecationsdetails.documentationurl.md) +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [BaseDeprecationDetails](./kibana-plugin-core-server.basedeprecationdetails.md) > [documentationUrl](./kibana-plugin-core-server.basedeprecationdetails.documentationurl.md) -## DeprecationsDetails.documentationUrl property +## BaseDeprecationDetails.documentationUrl property (optional) link to the documentation for more details on the deprecation. diff --git a/docs/development/core/server/kibana-plugin-core-server.deprecationsdetails.level.md b/docs/development/core/server/kibana-plugin-core-server.basedeprecationdetails.level.md similarity index 66% rename from docs/development/core/server/kibana-plugin-core-server.deprecationsdetails.level.md rename to docs/development/core/server/kibana-plugin-core-server.basedeprecationdetails.level.md index 64ad22e2c87fb..ad755805d00b9 100644 --- a/docs/development/core/server/kibana-plugin-core-server.deprecationsdetails.level.md +++ b/docs/development/core/server/kibana-plugin-core-server.basedeprecationdetails.level.md @@ -1,8 +1,8 @@ -[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [DeprecationsDetails](./kibana-plugin-core-server.deprecationsdetails.md) > [level](./kibana-plugin-core-server.deprecationsdetails.level.md) +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [BaseDeprecationDetails](./kibana-plugin-core-server.basedeprecationdetails.md) > [level](./kibana-plugin-core-server.basedeprecationdetails.level.md) -## DeprecationsDetails.level property +## BaseDeprecationDetails.level property levels: - warning: will not break deployment upon upgrade - critical: needs to be addressed before upgrade. - fetch\_error: Deprecations service failed to grab the deprecation details for the domain. diff --git a/docs/development/core/server/kibana-plugin-core-server.basedeprecationdetails.md b/docs/development/core/server/kibana-plugin-core-server.basedeprecationdetails.md new file mode 100644 index 0000000000000..3e47865062352 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.basedeprecationdetails.md @@ -0,0 +1,26 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [BaseDeprecationDetails](./kibana-plugin-core-server.basedeprecationdetails.md) + +## BaseDeprecationDetails interface + +Base properties shared by all types of deprecations + +Signature: + +```typescript +export interface BaseDeprecationDetails +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [correctiveActions](./kibana-plugin-core-server.basedeprecationdetails.correctiveactions.md) | {
api?: {
path: string;
method: 'POST' | 'PUT';
body?: {
[key: string]: any;
};
omitContextFromBody?: boolean;
};
manualSteps: string[];
} | corrective action needed to fix this deprecation. | +| [deprecationType](./kibana-plugin-core-server.basedeprecationdetails.deprecationtype.md) | 'config' | 'feature' | (optional) Used to identify between different deprecation types. Example use case: in Upgrade Assistant, we may want to allow the user to sort by deprecation type or show each type in a separate tab.Feel free to add new types if necessary. Predefined types are necessary to reduce having similar definitions with different keywords across kibana deprecations. | +| [documentationUrl](./kibana-plugin-core-server.basedeprecationdetails.documentationurl.md) | string | (optional) link to the documentation for more details on the deprecation. | +| [level](./kibana-plugin-core-server.basedeprecationdetails.level.md) | 'warning' | 'critical' | 'fetch_error' | levels: - warning: will not break deployment upon upgrade - critical: needs to be addressed before upgrade. - fetch\_error: Deprecations service failed to grab the deprecation details for the domain. | +| [message](./kibana-plugin-core-server.basedeprecationdetails.message.md) | string | The description message to be displayed for the deprecation. Check the README for writing deprecations in src/core/server/deprecations/README.mdx | +| [requireRestart](./kibana-plugin-core-server.basedeprecationdetails.requirerestart.md) | boolean | (optional) specify the fix for this deprecation requires a full kibana restart. | +| [title](./kibana-plugin-core-server.basedeprecationdetails.title.md) | string | The title of the deprecation. Check the README for writing deprecations in src/core/server/deprecations/README.mdx | + diff --git a/docs/development/core/server/kibana-plugin-core-server.deprecationsdetails.message.md b/docs/development/core/server/kibana-plugin-core-server.basedeprecationdetails.message.md similarity index 60% rename from docs/development/core/server/kibana-plugin-core-server.deprecationsdetails.message.md rename to docs/development/core/server/kibana-plugin-core-server.basedeprecationdetails.message.md index 906ce8118f95b..5802bc316cc08 100644 --- a/docs/development/core/server/kibana-plugin-core-server.deprecationsdetails.message.md +++ b/docs/development/core/server/kibana-plugin-core-server.basedeprecationdetails.message.md @@ -1,8 +1,8 @@ -[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [DeprecationsDetails](./kibana-plugin-core-server.deprecationsdetails.md) > [message](./kibana-plugin-core-server.deprecationsdetails.message.md) +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [BaseDeprecationDetails](./kibana-plugin-core-server.basedeprecationdetails.md) > [message](./kibana-plugin-core-server.basedeprecationdetails.message.md) -## DeprecationsDetails.message property +## BaseDeprecationDetails.message property The description message to be displayed for the deprecation. Check the README for writing deprecations in `src/core/server/deprecations/README.mdx` diff --git a/docs/development/core/server/kibana-plugin-core-server.deprecationsdetails.requirerestart.md b/docs/development/core/server/kibana-plugin-core-server.basedeprecationdetails.requirerestart.md similarity index 54% rename from docs/development/core/server/kibana-plugin-core-server.deprecationsdetails.requirerestart.md rename to docs/development/core/server/kibana-plugin-core-server.basedeprecationdetails.requirerestart.md index 85bddd9436e73..3f589600d0458 100644 --- a/docs/development/core/server/kibana-plugin-core-server.deprecationsdetails.requirerestart.md +++ b/docs/development/core/server/kibana-plugin-core-server.basedeprecationdetails.requirerestart.md @@ -1,8 +1,8 @@ -[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [DeprecationsDetails](./kibana-plugin-core-server.deprecationsdetails.md) > [requireRestart](./kibana-plugin-core-server.deprecationsdetails.requirerestart.md) +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [BaseDeprecationDetails](./kibana-plugin-core-server.basedeprecationdetails.md) > [requireRestart](./kibana-plugin-core-server.basedeprecationdetails.requirerestart.md) -## DeprecationsDetails.requireRestart property +## BaseDeprecationDetails.requireRestart property (optional) specify the fix for this deprecation requires a full kibana restart. diff --git a/docs/development/core/server/kibana-plugin-core-server.deprecationsdetails.title.md b/docs/development/core/server/kibana-plugin-core-server.basedeprecationdetails.title.md similarity index 59% rename from docs/development/core/server/kibana-plugin-core-server.deprecationsdetails.title.md rename to docs/development/core/server/kibana-plugin-core-server.basedeprecationdetails.title.md index e8907688f6e5e..b6788a4faa7c5 100644 --- a/docs/development/core/server/kibana-plugin-core-server.deprecationsdetails.title.md +++ b/docs/development/core/server/kibana-plugin-core-server.basedeprecationdetails.title.md @@ -1,8 +1,8 @@ -[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [DeprecationsDetails](./kibana-plugin-core-server.deprecationsdetails.md) > [title](./kibana-plugin-core-server.deprecationsdetails.title.md) +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [BaseDeprecationDetails](./kibana-plugin-core-server.basedeprecationdetails.md) > [title](./kibana-plugin-core-server.basedeprecationdetails.title.md) -## DeprecationsDetails.title property +## BaseDeprecationDetails.title property The title of the deprecation. Check the README for writing deprecations in `src/core/server/deprecations/README.mdx` diff --git a/docs/development/core/server/kibana-plugin-core-server.configdeprecationdetails.configpath.md b/docs/development/core/server/kibana-plugin-core-server.configdeprecationdetails.configpath.md new file mode 100644 index 0000000000000..7af6c16d86e4a --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.configdeprecationdetails.configpath.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ConfigDeprecationDetails](./kibana-plugin-core-server.configdeprecationdetails.md) > [configPath](./kibana-plugin-core-server.configdeprecationdetails.configpath.md) + +## ConfigDeprecationDetails.configPath property + +Signature: + +```typescript +configPath: string; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.configdeprecationdetails.deprecationtype.md b/docs/development/core/server/kibana-plugin-core-server.configdeprecationdetails.deprecationtype.md new file mode 100644 index 0000000000000..fb3737062f986 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.configdeprecationdetails.deprecationtype.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ConfigDeprecationDetails](./kibana-plugin-core-server.configdeprecationdetails.md) > [deprecationType](./kibana-plugin-core-server.configdeprecationdetails.deprecationtype.md) + +## ConfigDeprecationDetails.deprecationType property + +Signature: + +```typescript +deprecationType: 'config'; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.configdeprecationdetails.md b/docs/development/core/server/kibana-plugin-core-server.configdeprecationdetails.md new file mode 100644 index 0000000000000..d1ccbb0b6164a --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.configdeprecationdetails.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ConfigDeprecationDetails](./kibana-plugin-core-server.configdeprecationdetails.md) + +## ConfigDeprecationDetails interface + + +Signature: + +```typescript +export interface ConfigDeprecationDetails extends BaseDeprecationDetails +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [configPath](./kibana-plugin-core-server.configdeprecationdetails.configpath.md) | string | | +| [deprecationType](./kibana-plugin-core-server.configdeprecationdetails.deprecationtype.md) | 'config' | | + diff --git a/docs/development/core/server/kibana-plugin-core-server.deprecationsdetails.md b/docs/development/core/server/kibana-plugin-core-server.deprecationsdetails.md index 2ff9f4b792f5d..d8ced1da62416 100644 --- a/docs/development/core/server/kibana-plugin-core-server.deprecationsdetails.md +++ b/docs/development/core/server/kibana-plugin-core-server.deprecationsdetails.md @@ -2,24 +2,11 @@ [Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [DeprecationsDetails](./kibana-plugin-core-server.deprecationsdetails.md) -## DeprecationsDetails interface +## DeprecationsDetails type Signature: ```typescript -export interface DeprecationsDetails +export declare type DeprecationsDetails = ConfigDeprecationDetails | FeatureDeprecationDetails; ``` - -## Properties - -| Property | Type | Description | -| --- | --- | --- | -| [correctiveActions](./kibana-plugin-core-server.deprecationsdetails.correctiveactions.md) | {
api?: {
path: string;
method: 'POST' | 'PUT';
body?: {
[key: string]: any;
};
omitContextFromBody?: boolean;
};
manualSteps: string[];
} | corrective action needed to fix this deprecation. | -| [deprecationType](./kibana-plugin-core-server.deprecationsdetails.deprecationtype.md) | 'config' | 'feature' | (optional) Used to identify between different deprecation types. Example use case: in Upgrade Assistant, we may want to allow the user to sort by deprecation type or show each type in a separate tab.Feel free to add new types if necessary. Predefined types are necessary to reduce having similar definitions with different keywords across kibana deprecations. | -| [documentationUrl](./kibana-plugin-core-server.deprecationsdetails.documentationurl.md) | string | (optional) link to the documentation for more details on the deprecation. | -| [level](./kibana-plugin-core-server.deprecationsdetails.level.md) | 'warning' | 'critical' | 'fetch_error' | levels: - warning: will not break deployment upon upgrade - critical: needs to be addressed before upgrade. - fetch\_error: Deprecations service failed to grab the deprecation details for the domain. | -| [message](./kibana-plugin-core-server.deprecationsdetails.message.md) | string | The description message to be displayed for the deprecation. Check the README for writing deprecations in src/core/server/deprecations/README.mdx | -| [requireRestart](./kibana-plugin-core-server.deprecationsdetails.requirerestart.md) | boolean | (optional) specify the fix for this deprecation requires a full kibana restart. | -| [title](./kibana-plugin-core-server.deprecationsdetails.title.md) | string | The title of the deprecation. Check the README for writing deprecations in src/core/server/deprecations/README.mdx | - diff --git a/docs/development/core/server/kibana-plugin-core-server.featuredeprecationdetails.deprecationtype.md b/docs/development/core/server/kibana-plugin-core-server.featuredeprecationdetails.deprecationtype.md new file mode 100644 index 0000000000000..b530874d3678b --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.featuredeprecationdetails.deprecationtype.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [FeatureDeprecationDetails](./kibana-plugin-core-server.featuredeprecationdetails.md) > [deprecationType](./kibana-plugin-core-server.featuredeprecationdetails.deprecationtype.md) + +## FeatureDeprecationDetails.deprecationType property + +Signature: + +```typescript +deprecationType?: 'feature' | undefined; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.featuredeprecationdetails.md b/docs/development/core/server/kibana-plugin-core-server.featuredeprecationdetails.md new file mode 100644 index 0000000000000..bed3356e36129 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.featuredeprecationdetails.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [FeatureDeprecationDetails](./kibana-plugin-core-server.featuredeprecationdetails.md) + +## FeatureDeprecationDetails interface + + +Signature: + +```typescript +export interface FeatureDeprecationDetails extends BaseDeprecationDetails +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [deprecationType](./kibana-plugin-core-server.featuredeprecationdetails.deprecationtype.md) | 'feature' | undefined | | + diff --git a/docs/development/core/server/kibana-plugin-core-server.md b/docs/development/core/server/kibana-plugin-core-server.md index 76b48358363e0..3970cf005abe4 100644 --- a/docs/development/core/server/kibana-plugin-core-server.md +++ b/docs/development/core/server/kibana-plugin-core-server.md @@ -53,9 +53,11 @@ The plugin integrates with the core system via lifecycle events: `setup` | [AuthRedirectedParams](./kibana-plugin-core-server.authredirectedparams.md) | Result of auth redirection. | | [AuthResultParams](./kibana-plugin-core-server.authresultparams.md) | Result of successful authentication. | | [AuthToolkit](./kibana-plugin-core-server.authtoolkit.md) | A tool set defining an outcome of Auth interceptor for incoming request. | +| [BaseDeprecationDetails](./kibana-plugin-core-server.basedeprecationdetails.md) | Base properties shared by all types of deprecations | | [Capabilities](./kibana-plugin-core-server.capabilities.md) | The read-only set of capabilities available for the current UI session. Capabilities are simple key-value pairs of (string, boolean), where the string denotes the capability ID, and the boolean is a flag indicating if the capability is enabled or disabled. | | [CapabilitiesSetup](./kibana-plugin-core-server.capabilitiessetup.md) | APIs to manage the [Capabilities](./kibana-plugin-core-server.capabilities.md) that will be used by the application.Plugins relying on capabilities to toggle some of their features should register them during the setup phase using the registerProvider method.Plugins having the responsibility to restrict capabilities depending on a given context should register their capabilities switcher using the registerSwitcher method.Refers to the methods documentation for complete description and examples. | | [CapabilitiesStart](./kibana-plugin-core-server.capabilitiesstart.md) | APIs to access the application [Capabilities](./kibana-plugin-core-server.capabilities.md). | +| [ConfigDeprecationDetails](./kibana-plugin-core-server.configdeprecationdetails.md) | | | [ContextSetup](./kibana-plugin-core-server.contextsetup.md) | An object that handles registration of context providers and configuring handlers with context. | | [CorePreboot](./kibana-plugin-core-server.corepreboot.md) | Context passed to the setup method of preboot plugins. | | [CoreSetup](./kibana-plugin-core-server.coresetup.md) | Context passed to the setup method of standard plugins. | @@ -65,7 +67,6 @@ The plugin integrates with the core system via lifecycle events: `setup` | [CustomHttpResponseOptions](./kibana-plugin-core-server.customhttpresponseoptions.md) | HTTP response parameters for a response with adjustable status code. | | [DeleteDocumentResponse](./kibana-plugin-core-server.deletedocumentresponse.md) | | | [DeprecationsClient](./kibana-plugin-core-server.deprecationsclient.md) | Server-side client that provides access to fetch all Kibana deprecations | -| [DeprecationsDetails](./kibana-plugin-core-server.deprecationsdetails.md) | | | [DeprecationSettings](./kibana-plugin-core-server.deprecationsettings.md) | UiSettings deprecation field options. | | [DeprecationsServiceSetup](./kibana-plugin-core-server.deprecationsservicesetup.md) | The deprecations service provides a way for the Kibana platform to communicate deprecated features and configs with its users. These deprecations are only communicated if the deployment is using these features. Allowing for a user tailored experience for upgrading the stack version.The Deprecation service is consumed by the upgrade assistant to assist with the upgrade experience.If a deprecated feature can be resolved without manual user intervention. Using correctiveActions.api allows the Upgrade Assistant to use this api to correct the deprecation upon a user trigger. | | [DiscoveredPlugin](./kibana-plugin-core-server.discoveredplugin.md) | Small container object used to expose information about discovered plugins that may or may not have been started. | @@ -77,6 +78,7 @@ The plugin integrates with the core system via lifecycle events: `setup` | [ErrorHttpResponseOptions](./kibana-plugin-core-server.errorhttpresponseoptions.md) | HTTP response parameters | | [ExecutionContextSetup](./kibana-plugin-core-server.executioncontextsetup.md) | | | [FakeRequest](./kibana-plugin-core-server.fakerequest.md) | Fake request object created manually by Kibana plugins. | +| [FeatureDeprecationDetails](./kibana-plugin-core-server.featuredeprecationdetails.md) | | | [GetDeprecationsContext](./kibana-plugin-core-server.getdeprecationscontext.md) | | | [GetResponse](./kibana-plugin-core-server.getresponse.md) | | | [HttpAuth](./kibana-plugin-core-server.httpauth.md) | | @@ -246,6 +248,7 @@ The plugin integrates with the core system via lifecycle events: `setup` | [AuthResult](./kibana-plugin-core-server.authresult.md) | | | [CapabilitiesProvider](./kibana-plugin-core-server.capabilitiesprovider.md) | See [CapabilitiesSetup](./kibana-plugin-core-server.capabilitiessetup.md) | | [CapabilitiesSwitcher](./kibana-plugin-core-server.capabilitiesswitcher.md) | See [CapabilitiesSetup](./kibana-plugin-core-server.capabilitiessetup.md) | +| [DeprecationsDetails](./kibana-plugin-core-server.deprecationsdetails.md) | | | [DestructiveRouteMethod](./kibana-plugin-core-server.destructiveroutemethod.md) | Set of HTTP methods changing the state of the server. | | [ElasticsearchClient](./kibana-plugin-core-server.elasticsearchclient.md) | Client used to query the elasticsearch cluster. | | [ElasticsearchClientConfig](./kibana-plugin-core-server.elasticsearchclientconfig.md) | Configuration options to be used to create a [cluster client](./kibana-plugin-core-server.iclusterclient.md) using the [createClient API](./kibana-plugin-core-server.elasticsearchservicestart.createclient.md) | diff --git a/src/core/public/public.api.md b/src/core/public/public.api.md index 50c9bcf925969..4c7f8aab5b767 100644 --- a/src/core/public/public.api.md +++ b/src/core/public/public.api.md @@ -732,10 +732,9 @@ export interface DocLinksStart { // Warning: (ae-forgotten-export) The symbol "DeprecationsDetails" needs to be exported by the entry point index.d.ts // // @internal (undocumented) -export interface DomainDeprecationDetails extends DeprecationsDetails { - // (undocumented) +export type DomainDeprecationDetails = DeprecationsDetails & { domainId: string; -} +}; export { EnvironmentMode } diff --git a/src/core/server/server.api.md b/src/core/server/server.api.md index fb16e889a19c7..9e50a3008293b 100644 --- a/src/core/server/server.api.md +++ b/src/core/server/server.api.md @@ -33,6 +33,7 @@ import { LoggerFactory } from '@kbn/logging'; import { LogLevel } from '@kbn/logging'; import { LogMeta } from '@kbn/logging'; import { LogRecord } from '@kbn/logging'; +import { MaybePromise } from '@kbn/utility-types'; import { ObjectType } from '@kbn/config-schema'; import { Observable } from 'rxjs'; import { PackageInfo } from '@kbn/config'; @@ -155,6 +156,27 @@ export interface AuthToolkit { } & ResponseHeaders) => AuthResult; } +// @public +export interface BaseDeprecationDetails { + correctiveActions: { + api?: { + path: string; + method: 'POST' | 'PUT'; + body?: { + [key: string]: any; + }; + omitContextFromBody?: boolean; + }; + manualSteps: string[]; + }; + deprecationType?: 'config' | 'feature'; + documentationUrl?: string; + level: 'warning' | 'critical' | 'fetch_error'; + message: string; + requireRestart?: boolean; + title: string; +} + // @public export class BasePath { // @internal @@ -249,6 +271,14 @@ export { ConfigDeprecation } export { ConfigDeprecationContext } +// @public (undocumented) +export interface ConfigDeprecationDetails extends BaseDeprecationDetails { + // (undocumented) + configPath: string; + // (undocumented) + deprecationType: 'config'; +} + export { ConfigDeprecationFactory } export { ConfigDeprecationProvider } @@ -802,25 +832,7 @@ export interface DeprecationsClient { } // @public (undocumented) -export interface DeprecationsDetails { - correctiveActions: { - api?: { - path: string; - method: 'POST' | 'PUT'; - body?: { - [key: string]: any; - }; - omitContextFromBody?: boolean; - }; - manualSteps: string[]; - }; - deprecationType?: 'config' | 'feature'; - documentationUrl?: string; - level: 'warning' | 'critical' | 'fetch_error'; - message: string; - requireRestart?: boolean; - title: string; -} +export type DeprecationsDetails = ConfigDeprecationDetails | FeatureDeprecationDetails; // @public export interface DeprecationSettings { @@ -971,6 +983,12 @@ export interface FakeRequest { headers: Headers; } +// @public (undocumented) +export interface FeatureDeprecationDetails extends BaseDeprecationDetails { + // (undocumented) + deprecationType?: 'feature' | undefined; +} + // @public export type GetAuthHeaders = (request: KibanaRequest) => AuthHeaders | undefined; @@ -1695,8 +1713,6 @@ export type RedirectResponseOptions = HttpResponseOptions & { // @public (undocumented) export interface RegisterDeprecationsConfig { - // Warning: (ae-forgotten-export) The symbol "MaybePromise" needs to be exported by the entry point index.d.ts - // // (undocumented) getDeprecations: (context: GetDeprecationsContext) => MaybePromise; } From 69e2a7be5e115e3cbe8882272294f25fc5f57912 Mon Sep 17 00:00:00 2001 From: pgayvallet Date: Thu, 14 Oct 2021 10:40:28 +0200 Subject: [PATCH 10/12] fix telemetry unit tests --- src/plugins/telemetry/server/config/deprecations.test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/telemetry/server/config/deprecations.test.ts b/src/plugins/telemetry/server/config/deprecations.test.ts index 7807cd21916d5..567ef69e8991c 100644 --- a/src/plugins/telemetry/server/config/deprecations.test.ts +++ b/src/plugins/telemetry/server/config/deprecations.test.ts @@ -158,6 +158,7 @@ describe('deprecateEndpointConfigs', () => { expect(mockAddDeprecation.mock.calls[0]).toMatchInlineSnapshot(` Array [ Object { + "configPath": "telemetry.url", "correctiveActions": Object { "manualSteps": Array [ "Remove \\"telemetry.url\\" from the Kibana configuration.", @@ -180,6 +181,7 @@ describe('deprecateEndpointConfigs', () => { expect(mockAddDeprecation.mock.calls[0]).toMatchInlineSnapshot(` Array [ Object { + "configPath": "telemetry.optInStatusUrl", "correctiveActions": Object { "manualSteps": Array [ "Remove \\"telemetry.optInStatusUrl\\" from the Kibana configuration.", From e9b1df8cea95d9b2a646a8167f50eb8d9be64a68 Mon Sep 17 00:00:00 2001 From: pgayvallet Date: Fri, 15 Oct 2021 09:16:13 +0200 Subject: [PATCH 11/12] address review comments --- .../server/deprecations/deprecation_config.ts | 1 + .../deprecations/deprecations_factory.test.ts | 38 +++++++++++++++++++ .../server/config_deprecations.test.ts | 12 ++++-- .../security/server/config_deprecations.ts | 8 +++- 4 files changed, 54 insertions(+), 5 deletions(-) diff --git a/src/core/server/deprecations/deprecation_config.ts b/src/core/server/deprecations/deprecation_config.ts index 9328e73dbbd7b..fb5ff7e5957f5 100644 --- a/src/core/server/deprecations/deprecation_config.ts +++ b/src/core/server/deprecations/deprecation_config.ts @@ -10,6 +10,7 @@ import { schema, TypeOf } from '@kbn/config-schema'; import { ServiceConfigDescriptor } from '../internal_types'; const configSchema = schema.object({ + // `deprecation.skip_deprecated_settings` is consistent with the equivalent ES feature and config property skip_deprecated_settings: schema.arrayOf(schema.string(), { defaultValue: [] }), }); diff --git a/src/core/server/deprecations/deprecations_factory.test.ts b/src/core/server/deprecations/deprecations_factory.test.ts index d68a83b8b19d4..9a67c6dc36dd2 100644 --- a/src/core/server/deprecations/deprecations_factory.test.ts +++ b/src/core/server/deprecations/deprecations_factory.test.ts @@ -266,6 +266,44 @@ describe('DeprecationsFactory', () => { }), ]); }); + + it('does not throw when configured with paths not matching any deprecation', async () => { + const deprecationsFactory = new DeprecationsFactory({ + logger, + config: { + ignoredConfigDeprecations: ['unknown.bar'], + }, + }); + const mockPluginDeprecationsInfo: DeprecationsDetails[] = [ + { + configPath: 'mockPlugin.foo', + title: 'mockPlugin.foo is deprecated', + message: 'mockPlugin.foo is deprecated and will be removed in a future Kibana version', + level: 'critical', + deprecationType: 'config', + correctiveActions: { + manualSteps: ['come on', 'do something'], + }, + }, + { + configPath: 'mockPlugin.bar', + title: 'mockPlugin.bar is deprecated', + message: 'mockPlugin.bar is deprecated and will be removed in a future Kibana version', + level: 'critical', + deprecationType: 'config', + correctiveActions: { + manualSteps: ['come on', 'do something'], + }, + }, + ]; + + const mockPluginRegistry = deprecationsFactory.getRegistry('mockPlugin'); + mockPluginRegistry.registerDeprecations({ + getDeprecations: jest.fn().mockResolvedValue(mockPluginDeprecationsInfo), + }); + + await expect(deprecationsFactory.getAllDeprecations(mockDependencies)).resolves.toBeDefined(); + }); }); describe('getDeprecations', () => { diff --git a/x-pack/plugins/security/server/config_deprecations.test.ts b/x-pack/plugins/security/server/config_deprecations.test.ts index d9db18cdb96af..808c0aeb85b12 100644 --- a/x-pack/plugins/security/server/config_deprecations.test.ts +++ b/x-pack/plugins/security/server/config_deprecations.test.ts @@ -17,6 +17,7 @@ const deprecationContext = configDeprecationsMock.createContext(); const applyConfigDeprecations = (settings: Record = {}) => { const deprecations = securityConfigDeprecationProvider(configDeprecationFactory); const deprecationMessages: string[] = []; + const configPaths: string[] = []; const { config: migrated } = applyDeprecations( settings, deprecations.map((deprecation) => ({ @@ -25,10 +26,13 @@ const applyConfigDeprecations = (settings: Record = {}) => { context: deprecationContext, })), () => - ({ message }) => - deprecationMessages.push(message) + ({ message, configPath }) => { + deprecationMessages.push(message); + configPaths.push(configPath); + } ); return { + configPaths, messages: deprecationMessages, migrated, }; @@ -305,12 +309,14 @@ describe('Config Deprecations', () => { }, }, }; - const { messages } = applyConfigDeprecations(cloneDeep(config)); + const { messages, configPaths } = applyConfigDeprecations(cloneDeep(config)); expect(messages).toMatchInlineSnapshot(` Array [ "\\"xpack.security.authc.providers.saml..maxRedirectURLSize\\" is no longer used.", ] `); + + expect(configPaths).toEqual(['xpack.security.authc.providers.saml.saml1.maxRedirectURLSize']); }); it(`warns when 'xpack.security.authc.providers' is an array of strings`, () => { diff --git a/x-pack/plugins/security/server/config_deprecations.ts b/x-pack/plugins/security/server/config_deprecations.ts index f118a2aea8662..46fbbcec5188e 100644 --- a/x-pack/plugins/security/server/config_deprecations.ts +++ b/x-pack/plugins/security/server/config_deprecations.ts @@ -122,9 +122,13 @@ export const securityConfigDeprecationProvider: ConfigDeprecationProvider = ({ string, any >; - if (Object.values(samlProviders).find((provider) => !!provider.maxRedirectURLSize)) { + + const foundProvider = Object.entries(samlProviders).find( + ([_, provider]) => !!provider.maxRedirectURLSize + ); + if (foundProvider) { addDeprecation({ - configPath: 'xpack.security.authc.providers.saml.provider.maxRedirectURLSize', + configPath: `xpack.security.authc.providers.saml.${foundProvider[0]}.maxRedirectURLSize`, title: i18n.translate('xpack.security.deprecations.maxRedirectURLSizeTitle', { defaultMessage: '"xpack.security.authc.providers.saml..maxRedirectURLSize" is deprecated', From d39788dbf5eb8ceef12cf6c35d2ae852db11278e Mon Sep 17 00:00:00 2001 From: pgayvallet Date: Fri, 15 Oct 2021 10:07:43 +0200 Subject: [PATCH 12/12] add missing deprecation titles --- src/core/server/config/deprecation/core_deprecations.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/server/config/deprecation/core_deprecations.ts b/src/core/server/config/deprecation/core_deprecations.ts index 6e72ff99036e2..2c30ab490db65 100644 --- a/src/core/server/config/deprecation/core_deprecations.ts +++ b/src/core/server/config/deprecation/core_deprecations.ts @@ -12,6 +12,7 @@ const rewriteBasePathDeprecation: ConfigDeprecation = (settings, fromPath, addDe if (settings.server?.basePath && !settings.server?.rewriteBasePath) { addDeprecation({ configPath: 'server.basePath', + title: 'Setting "server.rewriteBasePath" should be set when using "server.basePath"', message: 'You should set server.basePath along with server.rewriteBasePath. Starting in 7.0, Kibana ' + 'will expect that all requests start with server.basePath rather than expecting you to rewrite ' + @@ -33,6 +34,7 @@ const rewriteCorsSettings: ConfigDeprecation = (settings, fromPath, addDeprecati if (typeof corsSettings === 'boolean') { addDeprecation({ configPath: 'server.cors', + title: 'Setting "server.cors" is deprecated', message: '"server.cors" is deprecated and has been replaced by "server.cors.enabled"', level: 'warning', correctiveActions: {