mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
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
This commit is contained in:
parent
a935f6b723
commit
81ba068853
53 changed files with 595 additions and 135 deletions
File diff suppressed because one or more lines are too long
|
@ -1,8 +1,8 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[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.
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[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.
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[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.
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[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.
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[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
|
||||
|
||||
<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' | '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' | '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' | 'critical' | '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> |
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[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`
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[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.
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[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`
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[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
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
configPath: string;
|
||||
```
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[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
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
deprecationType: 'config';
|
||||
```
|
|
@ -0,0 +1,20 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [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> | |
|
||||
|
|
@ -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
|
||||
|
||||
|
||||
<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' | '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' | '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' | 'critical' | '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> |
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[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
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
deprecationType?: 'feature' | undefined;
|
||||
```
|
|
@ -0,0 +1,19 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [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' | undefined</code> | |
|
||||
|
|
@ -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) |
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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).",
|
||||
|
|
|
@ -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}".',
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 }
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@ import { ConfigDeprecationProvider, ConfigDeprecation } from '@kbn/config';
|
|||
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 ' +
|
||||
|
@ -31,6 +33,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"',
|
||||
level: 'warning',
|
||||
correctiveActions: {
|
||||
|
|
22
src/core/server/deprecations/deprecation_config.ts
Normal file
22
src/core/server/deprecations/deprecation_config.ts
Normal 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,
|
||||
};
|
|
@ -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',
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
};
|
||||
|
|
|
@ -50,7 +50,7 @@ const createDeprecationsServiceMock = () => {
|
|||
stop: jest.fn(),
|
||||
};
|
||||
|
||||
mocked.setup.mockReturnValue(createInternalSetupContractMock());
|
||||
mocked.setup.mockResolvedValue(createInternalSetupContractMock());
|
||||
return mocked;
|
||||
};
|
||||
|
||||
|
|
|
@ -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,
|
||||
}));
|
|
@ -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: {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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: [
|
||||
|
|
|
@ -387,7 +387,10 @@ export { EventLoopDelaysMonitor } from './metrics';
|
|||
|
||||
export type { I18nServiceSetup } from './i18n';
|
||||
export type {
|
||||
BaseDeprecationDetails,
|
||||
DeprecationsDetails,
|
||||
ConfigDeprecationDetails,
|
||||
FeatureDeprecationDetails,
|
||||
RegisterDeprecationsConfig,
|
||||
GetDeprecationsContext,
|
||||
DeprecationsServiceSetup,
|
||||
|
|
|
@ -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`,
|
||||
}),
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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<DeprecationsDetails[]>;
|
||||
}
|
||||
|
|
|
@ -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';
|
||||
|
@ -203,7 +203,7 @@ export class Server {
|
|||
executionContext: executionContextSetup,
|
||||
});
|
||||
|
||||
const deprecationsSetup = this.deprecations.setup({
|
||||
const deprecationsSetup = await this.deprecations.setup({
|
||||
http: httpSetup,
|
||||
});
|
||||
|
||||
|
@ -381,6 +381,7 @@ export class Server {
|
|||
statusConfig,
|
||||
pidConfig,
|
||||
i18nConfig,
|
||||
deprecationConfig,
|
||||
];
|
||||
|
||||
this.configService.addDeprecationProvider(rootConfigPath, coreDeprecationProvider);
|
||||
|
|
|
@ -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.",
|
||||
|
|
|
@ -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 },
|
||||
|
|
|
@ -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 ' +
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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",` +
|
||||
|
|
|
@ -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: [
|
||||
|
|
|
@ -33,6 +33,7 @@ export const config: PluginConfigDescriptor<MapsXPackConfig> = {
|
|||
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', {
|
||||
|
|
|
@ -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: [
|
||||
|
|
|
@ -25,6 +25,7 @@ export const config: PluginConfigDescriptor<ReportingConfigType> = {
|
|||
const reporting = get(settings, fromPath);
|
||||
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',
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
|
@ -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.<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`, () => {
|
||||
|
|
|
@ -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) => {
|
||||
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',
|
||||
}),
|
||||
|
|
|
@ -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`],
|
||||
|
|
|
@ -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.`],
|
||||
|
|
|
@ -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: [
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue