[7.x] Add deprecation.skip_deprecated_settings config setting (#114751) (#115164)

* Add `deprecation.skip_deprecated_settings` config setting (#114751)

* Add `deprecation.skip_deprecated_settings` config setting

* fix deprecation from service

* fix existing config deprecations

* fix kbn-config unit tests

* adapt deprecation types

* fix more deprecations

* add filtering and adapt unit tests

* add service unit tests

* update generated doc

* fix telemetry unit tests

* address review comments

* add missing deprecation titles
# Conflicts:
#	src/core/server/elasticsearch/elasticsearch_config.ts
#	x-pack/plugins/maps/server/index.ts
#	x-pack/plugins/spaces/server/config.ts

* add configPath for core deprecations

* add configPath for csp deprecation

* add configPath for kibana.defaultAppId deprecation

* add configPath for plugins deprecations

* fix test deprecation
This commit is contained in:
Pierre Gayvallet 2021-10-15 15:54:52 +02:00 committed by GitHub
parent e1d683054c
commit 26b5ef8e35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
61 changed files with 632 additions and 137 deletions

File diff suppressed because one or more lines are too long

View file

@ -1,8 +1,8 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [DeprecationsDetails](./kibana-plugin-core-server.deprecationsdetails.md) &gt; [correctiveActions](./kibana-plugin-core-server.deprecationsdetails.correctiveactions.md)
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [BaseDeprecationDetails](./kibana-plugin-core-server.basedeprecationdetails.md) &gt; [correctiveActions](./kibana-plugin-core-server.basedeprecationdetails.correctiveactions.md)
## DeprecationsDetails.correctiveActions property
## BaseDeprecationDetails.correctiveActions property
corrective action needed to fix this deprecation.

View file

@ -1,8 +1,8 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [DeprecationsDetails](./kibana-plugin-core-server.deprecationsdetails.md) &gt; [deprecationType](./kibana-plugin-core-server.deprecationsdetails.deprecationtype.md)
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [BaseDeprecationDetails](./kibana-plugin-core-server.basedeprecationdetails.md) &gt; [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.

View file

@ -1,8 +1,8 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [DeprecationsDetails](./kibana-plugin-core-server.deprecationsdetails.md) &gt; [documentationUrl](./kibana-plugin-core-server.deprecationsdetails.documentationurl.md)
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [BaseDeprecationDetails](./kibana-plugin-core-server.basedeprecationdetails.md) &gt; [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.

View file

@ -1,8 +1,8 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [DeprecationsDetails](./kibana-plugin-core-server.deprecationsdetails.md) &gt; [level](./kibana-plugin-core-server.deprecationsdetails.level.md)
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [BaseDeprecationDetails](./kibana-plugin-core-server.basedeprecationdetails.md) &gt; [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.

View file

@ -0,0 +1,26 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [BaseDeprecationDetails](./kibana-plugin-core-server.basedeprecationdetails.md)
## BaseDeprecationDetails interface
Base properties shared by all types of deprecations
<b>Signature:</b>
```typescript
export interface BaseDeprecationDetails
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [correctiveActions](./kibana-plugin-core-server.basedeprecationdetails.correctiveactions.md) | <code>{</code><br/><code> api?: {</code><br/><code> path: string;</code><br/><code> method: 'POST' &#124; 'PUT';</code><br/><code> body?: {</code><br/><code> [key: string]: any;</code><br/><code> };</code><br/><code> omitContextFromBody?: boolean;</code><br/><code> };</code><br/><code> manualSteps: string[];</code><br/><code> }</code> | corrective action needed to fix this deprecation. |
| [deprecationType](./kibana-plugin-core-server.basedeprecationdetails.deprecationtype.md) | <code>'config' &#124; 'feature'</code> | (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) | <code>string</code> | (optional) link to the documentation for more details on the deprecation. |
| [level](./kibana-plugin-core-server.basedeprecationdetails.level.md) | <code>'warning' &#124; 'critical' &#124; 'fetch_error'</code> | 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) | <code>string</code> | The description message to be displayed for the deprecation. Check the README for writing deprecations in <code>src/core/server/deprecations/README.mdx</code> |
| [requireRestart](./kibana-plugin-core-server.basedeprecationdetails.requirerestart.md) | <code>boolean</code> | (optional) specify the fix for this deprecation requires a full kibana restart. |
| [title](./kibana-plugin-core-server.basedeprecationdetails.title.md) | <code>string</code> | The title of the deprecation. Check the README for writing deprecations in <code>src/core/server/deprecations/README.mdx</code> |

View file

@ -1,8 +1,8 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [DeprecationsDetails](./kibana-plugin-core-server.deprecationsdetails.md) &gt; [message](./kibana-plugin-core-server.deprecationsdetails.message.md)
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [BaseDeprecationDetails](./kibana-plugin-core-server.basedeprecationdetails.md) &gt; [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`

View file

@ -1,8 +1,8 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [DeprecationsDetails](./kibana-plugin-core-server.deprecationsdetails.md) &gt; [requireRestart](./kibana-plugin-core-server.deprecationsdetails.requirerestart.md)
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [BaseDeprecationDetails](./kibana-plugin-core-server.basedeprecationdetails.md) &gt; [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.

View file

@ -1,8 +1,8 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [DeprecationsDetails](./kibana-plugin-core-server.deprecationsdetails.md) &gt; [title](./kibana-plugin-core-server.deprecationsdetails.title.md)
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [BaseDeprecationDetails](./kibana-plugin-core-server.basedeprecationdetails.md) &gt; [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`

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [ConfigDeprecationDetails](./kibana-plugin-core-server.configdeprecationdetails.md) &gt; [configPath](./kibana-plugin-core-server.configdeprecationdetails.configpath.md)
## ConfigDeprecationDetails.configPath property
<b>Signature:</b>
```typescript
configPath: string;
```

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [ConfigDeprecationDetails](./kibana-plugin-core-server.configdeprecationdetails.md) &gt; [deprecationType](./kibana-plugin-core-server.configdeprecationdetails.deprecationtype.md)
## ConfigDeprecationDetails.deprecationType property
<b>Signature:</b>
```typescript
deprecationType: 'config';
```

View file

@ -0,0 +1,20 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [ConfigDeprecationDetails](./kibana-plugin-core-server.configdeprecationdetails.md)
## ConfigDeprecationDetails interface
<b>Signature:</b>
```typescript
export interface ConfigDeprecationDetails extends BaseDeprecationDetails
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [configPath](./kibana-plugin-core-server.configdeprecationdetails.configpath.md) | <code>string</code> | |
| [deprecationType](./kibana-plugin-core-server.configdeprecationdetails.deprecationtype.md) | <code>'config'</code> | |

View file

@ -2,24 +2,11 @@
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [DeprecationsDetails](./kibana-plugin-core-server.deprecationsdetails.md)
## DeprecationsDetails interface
## DeprecationsDetails type
<b>Signature:</b>
```typescript
export interface DeprecationsDetails
export declare type DeprecationsDetails = ConfigDeprecationDetails | FeatureDeprecationDetails;
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [correctiveActions](./kibana-plugin-core-server.deprecationsdetails.correctiveactions.md) | <code>{</code><br/><code> api?: {</code><br/><code> path: string;</code><br/><code> method: 'POST' &#124; 'PUT';</code><br/><code> body?: {</code><br/><code> [key: string]: any;</code><br/><code> };</code><br/><code> omitContextFromBody?: boolean;</code><br/><code> };</code><br/><code> manualSteps: string[];</code><br/><code> }</code> | corrective action needed to fix this deprecation. |
| [deprecationType](./kibana-plugin-core-server.deprecationsdetails.deprecationtype.md) | <code>'config' &#124; 'feature'</code> | (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) | <code>string</code> | (optional) link to the documentation for more details on the deprecation. |
| [level](./kibana-plugin-core-server.deprecationsdetails.level.md) | <code>'warning' &#124; 'critical' &#124; 'fetch_error'</code> | 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) | <code>string</code> | The description message to be displayed for the deprecation. Check the README for writing deprecations in <code>src/core/server/deprecations/README.mdx</code> |
| [requireRestart](./kibana-plugin-core-server.deprecationsdetails.requirerestart.md) | <code>boolean</code> | (optional) specify the fix for this deprecation requires a full kibana restart. |
| [title](./kibana-plugin-core-server.deprecationsdetails.title.md) | <code>string</code> | The title of the deprecation. Check the README for writing deprecations in <code>src/core/server/deprecations/README.mdx</code> |

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [FeatureDeprecationDetails](./kibana-plugin-core-server.featuredeprecationdetails.md) &gt; [deprecationType](./kibana-plugin-core-server.featuredeprecationdetails.deprecationtype.md)
## FeatureDeprecationDetails.deprecationType property
<b>Signature:</b>
```typescript
deprecationType?: 'feature' | undefined;
```

View file

@ -0,0 +1,19 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [FeatureDeprecationDetails](./kibana-plugin-core-server.featuredeprecationdetails.md)
## FeatureDeprecationDetails interface
<b>Signature:</b>
```typescript
export interface FeatureDeprecationDetails extends BaseDeprecationDetails
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [deprecationType](./kibana-plugin-core-server.featuredeprecationdetails.deprecationtype.md) | <code>'feature' &#124; undefined</code> | |

View file

@ -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 <code>registerProvider</code> method.<!-- -->Plugins having the responsibility to restrict capabilities depending on a given context should register their capabilities switcher using the <code>registerSwitcher</code> 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 <code>setup</code> method of <code>preboot</code> plugins. |
| [CoreSetup](./kibana-plugin-core-server.coresetup.md) | Context passed to the <code>setup</code> method of <code>standard</code> 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) |

View file

@ -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",

View file

@ -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: {

View file

@ -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).",

View file

@ -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}".',

View file

@ -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. */
@ -30,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;

View file

@ -736,10 +736,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 }

View file

@ -12,6 +12,7 @@ import { ConfigDeprecationProvider, ConfigDeprecation } from '@kbn/config';
const kibanaPathConf: ConfigDeprecation = (settings, fromPath, addDeprecation) => {
if (process.env?.KIBANA_PATH_CONF) {
addDeprecation({
configPath: 'env.KIBANA_PATH_CONF',
message: `Environment variable "KIBANA_PATH_CONF" is deprecated. It has been replaced with "KBN_PATH_CONF" pointing to a config folder`,
correctiveActions: {
manualSteps: [
@ -25,6 +26,7 @@ const kibanaPathConf: ConfigDeprecation = (settings, fromPath, addDeprecation) =
const configPathDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecation) => {
if (process.env?.CONFIG_PATH) {
addDeprecation({
configPath: 'env.CONFIG_PATH',
message: `Environment variable "CONFIG_PATH" is deprecated. It has been replaced with "KBN_PATH_CONF" pointing to a config folder`,
correctiveActions: {
manualSteps: ['Use "KBN_PATH_CONF" instead of "CONFIG_PATH" to point to a config folder.'],
@ -36,6 +38,7 @@ const configPathDeprecation: ConfigDeprecation = (settings, fromPath, addDepreca
const dataPathDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecation) => {
if (process.env?.DATA_PATH) {
addDeprecation({
configPath: 'env.DATA_PATH',
message: `Environment variable "DATA_PATH" will be removed. It has been replaced with kibana.yml setting "path.data"`,
correctiveActions: {
manualSteps: [
@ -49,6 +52,8 @@ const dataPathDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecati
const rewriteBasePathDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecation) => {
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 ' +
@ -69,6 +74,8 @@ const rewriteCorsSettings: ConfigDeprecation = (settings, fromPath, addDeprecati
const corsSettings = settings.server?.cors;
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"',
correctiveActions: {
manualSteps: [
@ -105,6 +112,7 @@ const cspRulesDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecati
value: [...parsed].map(([policy, sourceList]) => {
if (sourceList.find((source) => source.includes(NONCE_STRING))) {
addDeprecation({
configPath: 'csp.rules',
message: `csp.rules no longer supports the {nonce} syntax. Replacing with 'self' in ${policy}`,
correctiveActions: {
manualSteps: [`Replace {nonce} syntax with 'self' in ${policy}`],
@ -123,6 +131,7 @@ const cspRulesDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecati
!sourceList.find((source) => source.includes(SELF_STRING))
) {
addDeprecation({
configPath: 'csp.rules',
message: `csp.rules must contain the 'self' source. Automatically adding to ${policy}.`,
correctiveActions: {
manualSteps: [`Add 'self' source to ${policy}.`],
@ -146,6 +155,7 @@ const mapManifestServiceUrlDeprecation: ConfigDeprecation = (
) => {
if (settings.map?.manifestServiceUrl) {
addDeprecation({
configPath: 'map.manifestServiceUrl',
message:
'You should no longer use the map.manifestServiceUrl setting in kibana.yml to configure the location ' +
'of the Elastic Maps Service settings. These settings have moved to the "map.emsTileApiUrl" and ' +
@ -164,6 +174,7 @@ const mapManifestServiceUrlDeprecation: ConfigDeprecation = (
const serverHostZeroDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecation) => {
if (settings.server?.host === '0') {
addDeprecation({
configPath: 'server.host',
message:
'Support for setting server.host to "0" in kibana.yml is deprecated and will be removed in Kibana version 8.0.0. ' +
'Instead use "0.0.0.0" to bind to all interfaces.',
@ -194,6 +205,7 @@ const opsLoggingEventDeprecation: ConfigDeprecation = (
) => {
if (settings.logging?.events?.ops) {
addDeprecation({
configPath: 'logging.events.ops',
documentationUrl: `https://github.com/elastic/kibana/blob/${branch}/src/core/server/logging/README.mdx#loggingevents`,
title: i18n.translate('core.deprecations.loggingEventsOps.deprecationTitle', {
defaultMessage: `Setting "logging.events.ops" is deprecated`,
@ -224,6 +236,7 @@ const requestLoggingEventDeprecation: ConfigDeprecation = (
) => {
if (settings.logging?.events?.request) {
addDeprecation({
configPath: 'logging.events.request',
documentationUrl: `https://github.com/elastic/kibana/blob/${branch}/src/core/server/logging/README.mdx#loggingevents`,
title: i18n.translate('core.deprecations.loggingEventsRequest.deprecationTitle', {
defaultMessage: `Setting "logging.events.request" is deprecated`,
@ -254,6 +267,7 @@ const responseLoggingEventDeprecation: ConfigDeprecation = (
) => {
if (settings.logging?.events?.response) {
addDeprecation({
configPath: 'logging.events.response',
documentationUrl: `https://github.com/elastic/kibana/blob/${branch}/src/core/server/logging/README.mdx#loggingevents`,
title: i18n.translate('core.deprecations.loggingEventsResponse.deprecationTitle', {
defaultMessage: `Setting "logging.events.response" is deprecated`,
@ -284,6 +298,7 @@ const timezoneLoggingDeprecation: ConfigDeprecation = (
) => {
if (settings.logging?.timezone) {
addDeprecation({
configPath: 'logging.timezone',
documentationUrl: `https://github.com/elastic/kibana/blob/${branch}/src/core/server/logging/README.mdx#loggingtimezone`,
title: i18n.translate('core.deprecations.loggingTimezone.deprecationTitle', {
defaultMessage: `Setting "logging.timezone" is deprecated`,
@ -314,6 +329,7 @@ const destLoggingDeprecation: ConfigDeprecation = (
) => {
if (settings.logging?.dest) {
addDeprecation({
configPath: 'logging.dest',
documentationUrl: `https://github.com/elastic/kibana/blob/${branch}/src/core/server/logging/README.mdx#loggingdest`,
title: i18n.translate('core.deprecations.loggingDest.deprecationTitle', {
defaultMessage: `Setting "logging.dest" is deprecated`,
@ -344,6 +360,7 @@ const quietLoggingDeprecation: ConfigDeprecation = (
) => {
if (settings.logging?.quiet) {
addDeprecation({
configPath: 'logging.quiet',
documentationUrl: `https://github.com/elastic/kibana/blob/${branch}/src/core/server/logging/README.mdx#loggingquiet`,
title: i18n.translate('core.deprecations.loggingQuiet.deprecationTitle', {
defaultMessage: `Setting "logging.quiet" is deprecated`,
@ -373,6 +390,7 @@ const silentLoggingDeprecation: ConfigDeprecation = (
) => {
if (settings.logging?.silent) {
addDeprecation({
configPath: 'logging.silent',
documentationUrl: `https://github.com/elastic/kibana/blob/${branch}/src/core/server/logging/README.mdx#loggingsilent`,
title: i18n.translate('core.deprecations.loggingSilent.deprecationTitle', {
defaultMessage: `Setting "logging.silent" is deprecated`,
@ -402,6 +420,7 @@ const verboseLoggingDeprecation: ConfigDeprecation = (
) => {
if (settings.logging?.verbose) {
addDeprecation({
configPath: 'logging.verbose',
documentationUrl: `https://github.com/elastic/kibana/blob/${branch}/src/core/server/logging/README.mdx#loggingverbose`,
title: i18n.translate('core.deprecations.loggingVerbose.deprecationTitle', {
defaultMessage: `Setting "logging.verbose" is deprecated`,
@ -435,6 +454,7 @@ const jsonLoggingDeprecation: ConfigDeprecation = (
// ` legacyLoggingConfigSchema` returns `true` for the TTY check on `process.stdout.isTTY`
if (settings.logging?.json && settings.env !== 'development') {
addDeprecation({
configPath: 'logging.json',
documentationUrl: `https://github.com/elastic/kibana/blob/${branch}/src/core/server/logging/README.mdx`,
title: i18n.translate('core.deprecations.loggingJson.deprecationTitle', {
defaultMessage: `Setting "logging.json" is deprecated`,
@ -466,6 +486,7 @@ const logRotateDeprecation: ConfigDeprecation = (
) => {
if (settings.logging?.rotate) {
addDeprecation({
configPath: 'logging.rotate',
documentationUrl: `https://github.com/elastic/kibana/blob/${branch}/src/core/server/logging/README.mdx#rolling-file-appender`,
title: i18n.translate('core.deprecations.loggingRotate.deprecationTitle', {
defaultMessage: `Setting "logging.rotate" is deprecated`,
@ -496,6 +517,7 @@ const logEventsLogDeprecation: ConfigDeprecation = (
) => {
if (settings.logging?.events?.log) {
addDeprecation({
configPath: 'logging.events.log',
documentationUrl: `https://github.com/elastic/kibana/blob/${branch}/src/core/server/logging/README.mdx#loggingevents`,
title: i18n.translate('core.deprecations.loggingEventsLog.deprecationTitle', {
defaultMessage: `Setting "logging.events.log" is deprecated`,
@ -525,6 +547,7 @@ const logEventsErrorDeprecation: ConfigDeprecation = (
) => {
if (settings.logging?.events?.error) {
addDeprecation({
configPath: 'logging.events.error',
documentationUrl: `https://github.com/elastic/kibana/blob/${branch}/src/core/server/logging/README.mdx#loggingevents`,
title: i18n.translate('core.deprecations.loggingEventsError.deprecationTitle', {
defaultMessage: `Setting "logging.events.error" is deprecated`,
@ -554,6 +577,7 @@ const logFilterDeprecation: ConfigDeprecation = (
) => {
if (settings.logging?.filter) {
addDeprecation({
configPath: 'logging.filter',
documentationUrl: `https://github.com/elastic/kibana/blob/${branch}/src/core/server/logging/README.mdx#loggingfilter`,
title: i18n.translate('core.deprecations.loggingFilter.deprecationTitle', {
defaultMessage: `Setting "logging.filter" is deprecated`,

View file

@ -137,6 +137,7 @@ export const config: ServiceConfigDescriptor<CspConfigType> = {
const cspConfig = rawConfig[fromPath];
if (cspConfig?.rules) {
addDeprecation({
configPath: 'csp.rules',
message:
'`csp.rules` is deprecated in favor of directive specific configuration. Please use `csp.connect_src`, ' +
'`csp.default_src`, `csp.font_src`, `csp.frame_ancestors`, `csp.frame_src`, `csp.img_src`, ' +

View file

@ -0,0 +1,22 @@
/*
* 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({
// `deprecation.skip_deprecated_settings` is consistent with the equivalent ES feature and config property
skip_deprecated_settings: schema.arrayOf(schema.string(), { defaultValue: [] }),
});
export type DeprecationConfigType = TypeOf<typeof configSchema>;
export const config: ServiceConfigDescriptor<DeprecationConfigType> = {
path: 'deprecation',
schema: configSchema,
};

View file

@ -7,20 +7,26 @@
*/
import type { GetDeprecationsContext } from './types';
import { DeprecationsFactory } from './deprecations_factory';
import { DeprecationsFactory, DeprecationsFactoryConfig } from './deprecations_factory';
import { loggerMock } from '../logging/logger.mock';
import { DeprecationsDetails } from './types';
describe('DeprecationsFactory', () => {
const logger = loggerMock.create();
let logger: ReturnType<typeof loggerMock.create>;
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 +34,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 +42,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 +67,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',
@ -97,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) => ({
@ -110,7 +116,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 +148,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();
@ -161,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',
@ -181,6 +187,123 @@ 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',
}),
]);
});
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', () => {
@ -190,7 +313,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 = [
{
@ -215,40 +338,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 });
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',
})
);
});
});
});

View file

@ -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<string, DeprecationsRegistry> = 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 => {
@ -41,7 +49,7 @@ export class DeprecationsFactory {
dependencies: GetDeprecationsContext
): Promise<DomainDeprecationDetails[]> => {
const infoBody = await this.getDeprecationsBody(domainId, dependencies);
return this.createDeprecationInfo(domainId, infoBody).flat();
return this.createDeprecationInfo(domainId, infoBody);
};
public getAllDeprecations = async (
@ -63,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 (
@ -113,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);
@ -121,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;
});
};

View file

@ -50,7 +50,7 @@ const createDeprecationsServiceMock = () => {
stop: jest.fn(),
};
mocked.setup.mockReturnValue(createInternalSetupContractMock());
mocked.setup.mockResolvedValue(createInternalSetupContractMock());
return mocked;
};

View file

@ -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,
}));

View file

@ -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<typeof mockCoreContext.create>;
let http: ReturnType<typeof httpServiceMock.createInternalSetupContract>;
let router: ReturnType<typeof httpServiceMock.createRouter>;
let deprecationsCoreSetupDeps: DeprecationsSetupDeps;
beforeEach(() => jest.clearAllMocks());
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 };
});
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);
@ -73,6 +100,7 @@ describe('DeprecationsService', () => {
'testDomain',
[
{
configPath: 'test',
message: 'testMessage',
documentationUrl: 'testDocUrl',
correctiveActions: {
@ -100,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.",
@ -124,6 +153,7 @@ describe('DeprecationsService', () => {
'testDomain',
[
{
configPath: 'test',
message: 'testMessage',
level: 'warning',
correctiveActions: {

View file

@ -6,11 +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 { CoreContext } from '../core_context';
import { IConfigService } from '../config';
import { CoreService } from '../../types';
import { InternalHttpServiceSetup } from '../http';
import { Logger } from '../logging';
@ -103,6 +106,7 @@ export interface DeprecationsServiceSetup {
export interface DeprecationsClient {
getAllDeprecations: () => Promise<DomainDeprecationDetails[]>;
}
export interface InternalDeprecationsServiceStart {
/**
* Creates a {@link DeprecationsClient} with provided SO client and ES client.
@ -129,22 +133,33 @@ export class DeprecationsService
implements CoreService<InternalDeprecationsServiceSetup, InternalDeprecationsServiceStart>
{
private readonly logger: Logger;
private readonly deprecationsFactory: DeprecationsFactory;
private readonly configService: IConfigService;
private deprecationsFactory?: DeprecationsFactory;
constructor(private readonly coreContext: Pick<CoreContext, 'logger' | 'configService'>) {
constructor(coreContext: Pick<CoreContext, 'logger' | 'configService'>) {
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<InternalDeprecationsServiceSetup> {
this.logger.debug('Setting up Deprecations service');
const deprecationsFactory = this.deprecationsFactory;
const config = await this.configService
.atPath<DeprecationConfigType>(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);
@ -156,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(),
};
@ -169,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,
}),
@ -178,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);
@ -186,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,

View file

@ -7,7 +7,10 @@
*/
export type {
BaseDeprecationDetails,
DeprecationsDetails,
ConfigDeprecationDetails,
FeatureDeprecationDetails,
GetDeprecationsContext,
RegisterDeprecationsConfig,
DeprecationsGetResponse,
@ -21,3 +24,4 @@ export type {
} from './deprecations_service';
export { DeprecationsService } from './deprecations_service';
export { config } from './deprecation_config';

View file

@ -6,22 +6,16 @@
* 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> = T | Promise<T>;
/**
* @internal
*/
export interface DomainDeprecationDetails extends DeprecationsDetails {
domainId: string;
}
/**
* 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`
@ -82,6 +76,33 @@ 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 type DomainDeprecationDetails = DeprecationsDetails & {
domainId: string;
};
/**
* @public
*/

View file

@ -145,6 +145,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".`],
@ -152,6 +153,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".`],
@ -160,6 +162,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: [
@ -169,6 +172,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: [
@ -178,6 +182,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" or use "logging.verbose: true".`,
correctiveActions: {
manualSteps: [

View file

@ -387,7 +387,10 @@ export { EventLoopDelaysMonitor } from './metrics';
export type { I18nServiceSetup } from './i18n';
export type {
BaseDeprecationDetails,
DeprecationsDetails,
ConfigDeprecationDetails,
FeatureDeprecationDetails,
RegisterDeprecationsConfig,
GetDeprecationsContext,
DeprecationsServiceSetup,

View file

@ -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`,
}),

View file

@ -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',

View file

@ -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';
@ -156,6 +157,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
@ -250,6 +272,14 @@ export { ConfigDeprecation }
export { ConfigDeprecationContext }
// @public (undocumented)
export interface ConfigDeprecationDetails extends BaseDeprecationDetails {
// (undocumented)
configPath: string;
// (undocumented)
deprecationType: 'config';
}
export { ConfigDeprecationFactory }
export { ConfigDeprecationProvider }
@ -782,25 +812,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 {
@ -951,6 +963,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;
@ -1676,8 +1694,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<DeprecationsDetails[]>;
}

View file

@ -51,7 +51,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';
@ -206,7 +206,7 @@ export class Server {
executionContext: executionContextSetup,
});
const deprecationsSetup = this.deprecations.setup({
const deprecationsSetup = await this.deprecations.setup({
http: httpSetup,
});
@ -388,6 +388,7 @@ export class Server {
statusConfig,
pidConfig,
i18nConfig,
deprecationConfig,
];
this.configService.addDeprecationProvider(rootConfigPath, coreDeprecationProvider);

View file

@ -27,6 +27,7 @@ export const config: PluginConfigDescriptor<ConfigSchema> = {
return;
}
addDeprecation({
configPath: 'kibana.defaultAppId',
message: `kibana.defaultAppId is deprecated and will be removed in 8.0. Please use the \`defaultRoute\` advanced setting instead`,
correctiveActions: {
manualSteps: [

View file

@ -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.",

View file

@ -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 },

View file

@ -22,6 +22,7 @@ type ConfigType = TypeOf<typeof configSchema>;
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 ' +

View file

@ -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:

View file

@ -69,6 +69,7 @@ export const config: PluginConfigDescriptor<ActionsConfig> = {
)
) {
addDeprecation({
configPath: 'xpack.actions.customHostSettings.ssl.rejectUnauthorized',
message:
`"xpack.actions.customHostSettings[<index>].ssl.rejectUnauthorized" is deprecated.` +
`Use "xpack.actions.customHostSettings[<index>].ssl.verificationMode" instead, ` +
@ -96,6 +97,7 @@ export const config: PluginConfigDescriptor<ActionsConfig> = {
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<ActionsConfig> = {
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",` +
@ -148,6 +151,7 @@ export const config: PluginConfigDescriptor<ActionsConfig> = {
const actions = get(settings, fromPath);
if (actions?.enabled === false || actions?.enabled === true) {
addDeprecation({
configPath: 'xpack.actions.enabled',
message: `"xpack.actions.enabled" is deprecated. The ability to disable this plugin will be removed in 8.0.0.`,
correctiveActions: {
manualSteps: [`Remove "xpack.actions.enabled" from your kibana configs.`],

View file

@ -62,6 +62,7 @@ export const config: PluginConfigDescriptor<AlertsConfigType> = {
const alerting = get(settings, fromPath);
if (alerting?.enabled === false || alerting?.enabled === true) {
addDeprecation({
configPath: 'xpack.alerting.enabled',
message: `"xpack.alerting.enabled" is deprecated. The ability to disable this plugin will be removed in 8.0.0.`,
correctiveActions: {
manualSteps: [`Remove "xpack.alerting.enabled" from your kibana configs.`],

View file

@ -44,6 +44,8 @@ export const config: PluginConfigDescriptor<BannersConfigType> = {
const pluginConfig = get(rootConfig, fromPath);
if (pluginConfig?.placement === 'header') {
addDeprecation({
configPath: 'xpack.banners.placement',
level: 'critical',
message: 'The `header` value for xpack.banners.placement has been replaced by `top`',
correctiveActions: {
manualSteps: [

View file

@ -33,6 +33,7 @@ export const config: PluginConfigDescriptor<IEventLogConfig> = {
settings?.xpack?.eventLog?.enabled === true
) {
addDeprecation({
configPath: 'xpack.eventLog.enabled',
message: `"xpack.eventLog.enabled" is deprecated. The ability to disable this plugin will be removed in 8.0.0.`,
correctiveActions: {
manualSteps: [`Remove "xpack.eventLog.enabled" from your kibana configs.`],

View file

@ -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: [

View file

@ -34,6 +34,7 @@ export const config: PluginConfigDescriptor<MapsXPackConfig> = {
return completeConfig;
}
addDeprecation({
configPath: 'xpack.maps.showMapVisualizationTypes',
message: i18n.translate('xpack.maps.deprecation.showMapVisualizationTypes.message', {
defaultMessage:
'xpack.maps.showMapVisualizationTypes is deprecated and is no longer used',
@ -59,6 +60,7 @@ export const config: PluginConfigDescriptor<MapsXPackConfig> = {
return completeConfig;
}
addDeprecation({
configPath: 'map.proxyElasticMapsServiceInMaps',
documentationUrl: `https://www.elastic.co/guide/en/kibana/${branch}/maps-connect-to-ems.html#elastic-maps-server`,
message: i18n.translate('xpack.maps.deprecation.proxyEMS.message', {
defaultMessage: 'map.proxyElasticMapsServiceInMaps is deprecated and is no longer used',
@ -86,6 +88,7 @@ export const config: PluginConfigDescriptor<MapsXPackConfig> = {
return completeConfig;
}
addDeprecation({
configPath: 'map.regionmap',
message: i18n.translate('xpack.maps.deprecation.regionmap.message', {
defaultMessage: 'map.regionmap is deprecated and is no longer used',
}),

View file

@ -55,6 +55,7 @@ export const deprecations = ({
const legacyKey = get(config, `xpack.monitoring.${CLUSTER_ALERTS_ADDRESS_CONFIG_KEY}`);
if (emailNotificationsEnabled && !updatedKey && !legacyKey) {
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: [
@ -70,6 +71,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".`],
@ -77,6 +79,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".`],
@ -91,6 +94,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: [
@ -100,6 +104,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: [

View file

@ -25,6 +25,7 @@ export const config: PluginConfigDescriptor<ReportingConfigType> = {
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 },
@ -51,6 +52,7 @@ export const config: PluginConfigDescriptor<ReportingConfigType> = {
if (reporting?.roles?.enabled !== false) {
addDeprecation({
configPath: `${fromPath}.roles.enabled`,
level: 'warning',
title: i18n.translate('xpack.reporting.deprecations.reportingRoles.title', {
defaultMessage: 'Setting "{fromPath}.roles" is deprecated',

View file

@ -17,6 +17,7 @@ const deprecationContext = configDeprecationsMock.createContext();
const applyConfigDeprecations = (settings: Record<string, any> = {}) => {
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<string, any> = {}) => {
context: deprecationContext,
})),
() =>
({ message }) =>
deprecationMessages.push(message)
({ message, configPath }) => {
deprecationMessages.push(message);
configPaths.push(configPath);
}
);
return {
configPaths,
messages: deprecationMessages,
migrated,
};
@ -356,12 +360,14 @@ describe('Config Deprecations', () => {
},
},
};
const { messages } = applyConfigDeprecations(cloneDeep(config));
const { messages, configPaths } = applyConfigDeprecations(cloneDeep(config));
expect(messages).toMatchInlineSnapshot(`
Array [
"\\"xpack.security.authc.providers.saml.<provider-name>.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`, () => {

View file

@ -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"',
@ -119,8 +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.${foundProvider[0]}.maxRedirectURLSize`,
title: i18n.translate('xpack.security.deprecations.maxRedirectURLSizeTitle', {
defaultMessage:
'"xpack.security.authc.providers.saml.<provider-name>.maxRedirectURLSize" is deprecated',
@ -143,6 +151,7 @@ export const securityConfigDeprecationProvider: ConfigDeprecationProvider = ({
(settings, fromPath, addDeprecation, { branch }) => {
if ('enabled' in (settings?.xpack?.security || {})) {
addDeprecation({
configPath: 'xpack.security.enabled',
title: i18n.translate('xpack.security.deprecations.enabledTitle', {
defaultMessage: 'Setting "xpack.security.enabled" is deprecated',
}),
@ -169,6 +178,7 @@ export const securityConfigDeprecationProvider: ConfigDeprecationProvider = ({
(settings, fromPath, addDeprecation, { branch }) => {
if (settings?.xpack?.security?.session?.idleTimeout === undefined) {
addDeprecation({
configPath: 'xpack.security.session.idleTimeout',
level: 'warning',
title: i18n.translate('xpack.security.deprecations.idleTimeoutTitle', {
defaultMessage: 'The "xpack.security.session.idleTimeout" default is changing',
@ -192,6 +202,7 @@ export const securityConfigDeprecationProvider: ConfigDeprecationProvider = ({
if (settings?.xpack?.security?.session?.lifespan === undefined) {
addDeprecation({
configPath: 'xpack.security.session.lifespan',
level: 'warning',
title: i18n.translate('xpack.security.deprecations.lifespanTitle', {
defaultMessage: 'The "xpack.security.session.lifespan" default is changing',

View file

@ -28,6 +28,7 @@ export function createConfig$(context: PluginInitializerContext) {
const disabledDeprecation: ConfigDeprecation = (config, fromPath, addDeprecation) => {
if ('enabled' in (config?.xpack?.spaces || {})) {
addDeprecation({
configPath: 'xpack.spaces.enabled',
title: i18n.translate('xpack.spaces.deprecations.enabledTitle', {
defaultMessage: 'Setting "xpack.spaces.enabled" is deprecated',
}),

View file

@ -18,6 +18,7 @@ export const config: PluginConfigDescriptor<Config> = {
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.`],

View file

@ -49,6 +49,7 @@ export const config: PluginConfigDescriptor<TaskManagerConfig> = {
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<TaskManagerConfig> = {
}
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: [
@ -75,6 +77,7 @@ export const config: PluginConfigDescriptor<TaskManagerConfig> = {
const taskManager = get(settings, fromPath);
if (taskManager?.enabled === false || taskManager?.enabled === true) {
addDeprecation({
configPath: 'xpack.task_manager.enabled',
message: `"xpack.task_manager.enabled" is deprecated. The ability to disable this plugin will be removed in 8.0.0.`,
correctiveActions: {
manualSteps: [`Remove "xpack.task_manager.enabled" from your kibana configs.`],

View file

@ -31,6 +31,7 @@ export const config: PluginConfigDescriptor<ConfigSchema> = {
const triggersActionsUi = get(settings, fromPath);
if (triggersActionsUi?.enabled === false || triggersActionsUi?.enabled === true) {
addDeprecation({
configPath: 'xpack.trigger_actions_ui.enabled',
message: `"xpack.trigger_actions_ui.enabled" is deprecated. The ability to disable this plugin will be removed in 8.0.0.`,
correctiveActions: {
manualSteps: [`Remove "xpack.trigger_actions_ui.enabled" from your kibana configs.`],

View file

@ -22,6 +22,7 @@ const kibanaDeprecations: DomainDeprecationDetails[] = [
title: 'Test deprecation title 1',
message: 'Test deprecation message 1',
deprecationType: 'config',
configPath: 'test',
},
{
correctiveActions: {

View file

@ -75,10 +75,10 @@ export interface DeprecationResolutionState {
resolveDeprecationError?: string;
}
export interface KibanaDeprecationDetails extends DomainDeprecationDetails {
export type KibanaDeprecationDetails = DomainDeprecationDetails & {
id: string;
filterType: DomainDeprecationDetails['deprecationType'] | 'uncategorized';
}
};
const getDeprecationCountByLevel = (deprecations: KibanaDeprecationDetails[]) => {
const criticalDeprecations: KibanaDeprecationDetails[] = [];

View file

@ -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',