[Deprecations service] make correctiveActions.manualSteps required (#100997)

Co-authored-by: igoristic <igor.zaytsev.dev@gmail.com>
Co-authored-by: Larry Gregory <lgregorydev@gmail.com>
This commit is contained in:
Ahmad Bamieh 2021-06-02 15:52:14 +03:00 committed by GitHub
parent 1caaf47c20
commit dfd6ec9243
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 336 additions and 38 deletions

View file

@ -15,6 +15,6 @@ correctiveActions: {
[key: string]: any;
};
};
manualSteps?: string[];
manualSteps: string[];
};
```

View file

@ -14,7 +14,7 @@ export interface DeprecationsDetails
| 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> };</code><br/><code> manualSteps?: string[];</code><br/><code> }</code> | |
| [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> };</code><br/><code> manualSteps: string[];</code><br/><code> }</code> | |
| [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> | |
| [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. |

View file

@ -418,8 +418,14 @@ test('logs deprecation warning during validation', async () => {
const configService = new ConfigService(rawConfig, defaultEnv, logger);
mockApplyDeprecations.mockImplementationOnce((config, deprecations, createAddDeprecation) => {
const addDeprecation = createAddDeprecation!('');
addDeprecation({ message: 'some deprecation message' });
addDeprecation({ message: 'another deprecation message' });
addDeprecation({
message: 'some deprecation message',
correctiveActions: { manualSteps: ['do X'] },
});
addDeprecation({
message: 'another deprecation message',
correctiveActions: { manualSteps: ['do Y'] },
});
return { config, changedPaths: mockedChangedPaths };
});
@ -444,13 +450,24 @@ test('does not log warnings for silent deprecations during validation', async ()
mockApplyDeprecations
.mockImplementationOnce((config, deprecations, createAddDeprecation) => {
const addDeprecation = createAddDeprecation!('');
addDeprecation({ message: 'some deprecation message', silent: true });
addDeprecation({ message: 'another deprecation message' });
addDeprecation({
message: 'some deprecation message',
correctiveActions: { manualSteps: ['do X'] },
silent: true,
});
addDeprecation({
message: 'another deprecation message',
correctiveActions: { manualSteps: ['do Y'] },
});
return { config, changedPaths: mockedChangedPaths };
})
.mockImplementationOnce((config, deprecations, createAddDeprecation) => {
const addDeprecation = createAddDeprecation!('');
addDeprecation({ message: 'I am silent', silent: true });
addDeprecation({
message: 'I am silent',
silent: true,
correctiveActions: { manualSteps: ['do Z'] },
});
return { config, changedPaths: mockedChangedPaths };
});
@ -519,7 +536,11 @@ describe('getHandledDeprecatedConfigs', () => {
mockApplyDeprecations.mockImplementationOnce((config, deprecations, createAddDeprecation) => {
deprecations.forEach((deprecation) => {
const addDeprecation = createAddDeprecation!(deprecation.path);
addDeprecation({ message: `some deprecation message`, documentationUrl: 'some-url' });
addDeprecation({
message: `some deprecation message`,
documentationUrl: 'some-url',
correctiveActions: { manualSteps: ['do X'] },
});
});
return { config, changedPaths: mockedChangedPaths };
});
@ -532,6 +553,11 @@ describe('getHandledDeprecatedConfigs', () => {
"base",
Array [
Object {
"correctiveActions": Object {
"manualSteps": Array [
"do X",
],
},
"documentationUrl": "some-url",
"message": "some deprecation message",
},

View file

@ -25,8 +25,8 @@ export interface DeprecatedConfigDetails {
silent?: boolean;
/* (optional) link to the documentation for more details on the deprecation. */
documentationUrl?: string;
/* (optional) corrective action needed to fix this deprecation. */
correctiveActions?: {
/* corrective action needed to fix this deprecation. */
correctiveActions: {
/**
* Specify a list of manual steps our users need to follow
* to fix the deprecation before upgrade.

View file

@ -90,6 +90,7 @@ describe('DeprecationsClient', () => {
path: 'some-path',
method: 'POST',
},
manualSteps: ['manual-step'],
},
};
@ -104,7 +105,9 @@ describe('DeprecationsClient', () => {
domainId: 'testPluginId-1',
message: 'some-message',
level: 'warning',
correctiveActions: {},
correctiveActions: {
manualSteps: ['manual-step'],
},
};
const isResolvable = deprecationsClient.isDeprecationResolvable(mockDeprecationDetails);
@ -120,7 +123,9 @@ describe('DeprecationsClient', () => {
domainId: 'testPluginId-1',
message: 'some-message',
level: 'warning',
correctiveActions: {},
correctiveActions: {
manualSteps: ['manual-step'],
},
};
const result = await deprecationsClient.resolveDeprecation(mockDeprecationDetails);
@ -144,6 +149,7 @@ describe('DeprecationsClient', () => {
extra_param: 123,
},
},
manualSteps: ['manual-step'],
},
};
const result = await deprecationsClient.resolveDeprecation(mockDeprecationDetails);
@ -176,6 +182,7 @@ describe('DeprecationsClient', () => {
extra_param: 123,
},
},
manualSteps: ['manual-step'],
},
};
http.fetch.mockRejectedValue({ body: { message: mockResponse } });

View file

@ -24,7 +24,7 @@ describe('core deprecations', () => {
const { messages } = applyCoreDeprecations();
expect(messages).toMatchInlineSnapshot(`
Array [
"Environment variable CONFIG_PATH is deprecated. It has been replaced with KBN_PATH_CONF pointing to a config folder",
"Environment variable \\"CONFIG_PATH\\" is deprecated. It has been replaced with \\"KBN_PATH_CONF\\" pointing to a config folder",
]
`);
});
@ -405,7 +405,7 @@ describe('core deprecations', () => {
});
expect(messages).toMatchInlineSnapshot(`
Array [
"\\"logging.events.log\\" has been deprecated and will be removed in 8.0. Moving forward, log levels can be customized on a per-logger basis using the new logging configuration. ",
"\\"logging.events.log\\" has been deprecated and will be removed in 8.0. Moving forward, log levels can be customized on a per-logger basis using the new logging configuration.",
]
`);
});
@ -418,7 +418,7 @@ describe('core deprecations', () => {
});
expect(messages).toMatchInlineSnapshot(`
Array [
"\\"logging.events.error\\" has been deprecated and will be removed in 8.0. Moving forward, you can use \\"logging.root.level: error\\" in your logging configuration. ",
"\\"logging.events.error\\" has been deprecated and will be removed in 8.0. Moving forward, you can use \\"logging.root.level: error\\" in your logging configuration.",
]
`);
});

View file

@ -11,7 +11,10 @@ import { ConfigDeprecationProvider, ConfigDeprecation } from '@kbn/config';
const configPathDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecation) => {
if (process.env?.CONFIG_PATH) {
addDeprecation({
message: `Environment variable CONFIG_PATH is deprecated. It has been replaced with KBN_PATH_CONF pointing to a config folder`,
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.'],
},
});
}
};
@ -20,6 +23,11 @@ const dataPathDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecati
if (process.env?.DATA_PATH) {
addDeprecation({
message: `Environment variable "DATA_PATH" will be removed. It has been replaced with kibana.yml setting "path.data"`,
correctiveActions: {
manualSteps: [
`Set 'path.data' in the config file or CLI flag with the value of the environment variable "DATA_PATH".`,
],
},
});
}
};
@ -32,6 +40,12 @@ const rewriteBasePathDeprecation: ConfigDeprecation = (settings, fromPath, addDe
'will expect that all requests start with server.basePath rather than expecting you to rewrite ' +
'the requests in your reverse proxy. Set server.rewriteBasePath to false to preserve the ' +
'current behavior and silence this warning.',
correctiveActions: {
manualSteps: [
`Set 'server.rewriteBasePath' in the config file, CLI flag, or environment variable (in Docker only).`,
`Set to false to preserve the current behavior and silence this warning.`,
],
},
});
}
};
@ -41,6 +55,11 @@ const rewriteCorsSettings: ConfigDeprecation = (settings, fromPath, addDeprecati
if (typeof corsSettings === 'boolean') {
addDeprecation({
message: '"server.cors" is deprecated and has been replaced by "server.cors.enabled"',
correctiveActions: {
manualSteps: [
`Replace "server.cors: ${corsSettings}" with "server.cors.enabled: ${corsSettings}"`,
],
},
});
return {
@ -72,6 +91,9 @@ const cspRulesDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecati
if (sourceList.find((source) => source.includes(NONCE_STRING))) {
addDeprecation({
message: `csp.rules no longer supports the {nonce} syntax. Replacing with 'self' in ${policy}`,
correctiveActions: {
manualSteps: [`Replace {nonce} syntax with 'self' in ${policy}`],
},
});
sourceList = sourceList.filter((source) => !source.includes(NONCE_STRING));
@ -87,6 +109,9 @@ const cspRulesDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecati
) {
addDeprecation({
message: `csp.rules must contain the 'self' source. Automatically adding to ${policy}.`,
correctiveActions: {
manualSteps: [`Add 'self' source to ${policy}.`],
},
});
sourceList.push(SELF_STRING);
}
@ -111,6 +136,12 @@ const mapManifestServiceUrlDeprecation: ConfigDeprecation = (
'of the Elastic Maps Service settings. These settings have moved to the "map.emsTileApiUrl" and ' +
'"map.emsFileApiUrl" settings instead. These settings are for development use only and should not be ' +
'modified for use in production environments.',
correctiveActions: {
manualSteps: [
`Use "map.emsTileApiUrl" and "map.emsFileApiUrl" config instead of "map.manifestServiceUrl".`,
`These settings are for development use only and should not be modified for use in production environments.`,
],
},
});
}
};
@ -125,12 +156,28 @@ const opsLoggingEventDeprecation: ConfigDeprecation = (settings, fromPath, addDe
'in 8.0. To access ops data moving forward, please enable debug logs for the ' +
'"metrics.ops" context in your logging configuration. For more details, see ' +
'https://github.com/elastic/kibana/blob/master/src/core/server/logging/README.mdx',
correctiveActions: {
manualSteps: [
`Remove "logging.events.ops" from your kibana settings.`,
`Enable debug logs for the "metrics.ops" context in your logging configuration`,
],
},
});
}
};
const requestLoggingEventDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecation) => {
if (settings.logging?.events?.request || settings.logging?.events?.response) {
const removeConfigsSteps = [];
if (settings.logging?.events?.request) {
removeConfigsSteps.push(`Remove "logging.events.request" from your kibana configs.`);
}
if (settings.logging?.events?.response) {
removeConfigsSteps.push(`Remove "logging.events.response" from your kibana configs.`);
}
addDeprecation({
documentationUrl:
'https://github.com/elastic/kibana/blob/master/src/core/server/logging/README.mdx#loggingevents',
@ -139,6 +186,12 @@ const requestLoggingEventDeprecation: ConfigDeprecation = (settings, fromPath, a
'in 8.0. To access request and/or response data moving forward, please enable debug logs for the ' +
'"http.server.response" context in your logging configuration. For more details, see ' +
'https://github.com/elastic/kibana/blob/master/src/core/server/logging/README.mdx',
correctiveActions: {
manualSteps: [
...removeConfigsSteps,
`enable debug logs for the "http.server.response" context in your logging configuration.`,
],
},
});
}
};
@ -153,6 +206,12 @@ const timezoneLoggingDeprecation: ConfigDeprecation = (settings, fromPath, addDe
'in 8.0. To set the timezone moving forward, please add a timezone date modifier to the log pattern ' +
'in your logging configuration. For more details, see ' +
'https://github.com/elastic/kibana/blob/master/src/core/server/logging/README.mdx',
correctiveActions: {
manualSteps: [
`Remove "logging.timezone" from your kibana configs.`,
`To set the timezone add a timezone date modifier to the log pattern in your logging configuration.`,
],
},
});
}
};
@ -167,6 +226,12 @@ const destLoggingDeprecation: ConfigDeprecation = (settings, fromPath, addDeprec
'in 8.0. To set the destination moving forward, you can use the "console" appender ' +
'in your logging configuration or define a custom one. For more details, see ' +
'https://github.com/elastic/kibana/blob/master/src/core/server/logging/README.mdx',
correctiveActions: {
manualSteps: [
`Remove "logging.dest" from your kibana configs.`,
`To set the destination use the "console" appender in your logging configuration or define a custom one.`,
],
},
});
}
};
@ -179,6 +244,12 @@ const quietLoggingDeprecation: ConfigDeprecation = (settings, fromPath, addDepre
message:
'"logging.quiet" has been deprecated and will be removed ' +
'in 8.0. Moving forward, you can use "logging.root.level:error" in your logging configuration. ',
correctiveActions: {
manualSteps: [
`Remove "logging.quiet" from your kibana configs.`,
`Use "logging.root.level:error" in your logging configuration.`,
],
},
});
}
};
@ -191,6 +262,12 @@ const silentLoggingDeprecation: ConfigDeprecation = (settings, fromPath, addDepr
message:
'"logging.silent" has been deprecated and will be removed ' +
'in 8.0. Moving forward, you can use "logging.root.level:off" in your logging configuration. ',
correctiveActions: {
manualSteps: [
`Remove "logging.silent" from your kibana configs.`,
`Use "logging.root.level:off" in your logging configuration.`,
],
},
});
}
};
@ -203,6 +280,12 @@ const verboseLoggingDeprecation: ConfigDeprecation = (settings, fromPath, addDep
message:
'"logging.verbose" has been deprecated and will be removed ' +
'in 8.0. Moving forward, you can use "logging.root.level:all" in your logging configuration. ',
correctiveActions: {
manualSteps: [
`Remove "logging.verbose" from your kibana configs.`,
`Use "logging.root.level:all" in your logging configuration.`,
],
},
});
}
};
@ -223,6 +306,12 @@ const jsonLoggingDeprecation: ConfigDeprecation = (settings, fromPath, addDeprec
'There is currently no default layout for custom appenders and each one must be declared explicitly. ' +
'For more details, see ' +
'https://github.com/elastic/kibana/blob/master/src/core/server/logging/README.mdx',
correctiveActions: {
manualSteps: [
`Remove "logging.json" from your kibana configs.`,
`Configure the "appender.layout" property for every custom appender in your logging configuration.`,
],
},
});
}
};
@ -237,6 +326,12 @@ const logRotateDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecat
'Moving forward, you can enable log rotation using the "rolling-file" appender for a logger ' +
'in your logging configuration. For more details, see ' +
'https://github.com/elastic/kibana/blob/master/src/core/server/logging/README.mdx#rolling-file-appender',
correctiveActions: {
manualSteps: [
`Remove "logging.rotate" from your kibana configs.`,
`Enable log rotation using the "rolling-file" appender for a logger in your logging configuration.`,
],
},
});
}
};
@ -248,7 +343,13 @@ const logEventsLogDeprecation: ConfigDeprecation = (settings, fromPath, addDepre
'https://github.com/elastic/kibana/blob/master/src/core/server/logging/README.mdx#loggingevents',
message:
'"logging.events.log" has been deprecated and will be removed ' +
'in 8.0. Moving forward, log levels can be customized on a per-logger basis using the new logging configuration. ',
'in 8.0. Moving forward, log levels can be customized on a per-logger basis using the new logging configuration.',
correctiveActions: {
manualSteps: [
`Remove "logging.events.log" from your kibana configs.`,
`Customize log levels can be per-logger using the new logging configuration.`,
],
},
});
}
};
@ -260,7 +361,13 @@ const logEventsErrorDeprecation: ConfigDeprecation = (settings, fromPath, addDep
'https://github.com/elastic/kibana/blob/master/src/core/server/logging/README.mdx#loggingevents',
message:
'"logging.events.error" has been deprecated and will be removed ' +
'in 8.0. Moving forward, you can use "logging.root.level: error" in your logging configuration. ',
'in 8.0. Moving forward, you can use "logging.root.level: error" in your logging configuration.',
correctiveActions: {
manualSteps: [
`Remove "logging.events.error" from your kibana configs.`,
`Use "logging.root.level: error" in your logging configuration.`,
],
},
});
}
};
@ -271,6 +378,9 @@ const logFilterDeprecation: ConfigDeprecation = (settings, fromPath, addDeprecat
documentationUrl:
'https://github.com/elastic/kibana/blob/master/src/core/server/logging/README.mdx#loggingfilter',
message: '"logging.filter" has been deprecated and will be removed in 8.0.',
correctiveActions: {
manualSteps: [`Remove "logging.filter" from your kibana configs.`],
},
});
}
};

View file

@ -116,7 +116,7 @@ export interface DeprecationsSetupDeps {
export class DeprecationsService implements CoreService<InternalDeprecationsServiceSetup> {
private readonly logger: Logger;
constructor(private readonly coreContext: CoreContext) {
constructor(private readonly coreContext: Pick<CoreContext, 'logger' | 'configService'>) {
this.logger = coreContext.logger.get('deprecations-service');
}
@ -154,7 +154,7 @@ export class DeprecationsService implements CoreService<InternalDeprecationsServ
level: 'critical',
deprecationType: 'config',
message,
correctiveActions: correctiveActions ?? {},
correctiveActions,
documentationUrl,
};
});

View file

@ -55,11 +55,11 @@ export interface DeprecationsDetails {
};
};
/**
* (optional) If this deprecation cannot be automtically fixed
* via an API corrective action. Specify a list of manual steps
* users need to follow to fix the deprecation before upgrade.
* Specify a list of manual steps users need to follow to
* fix the deprecation before upgrade. Required even if an API
* corrective action is set in case the API fails.
*/
manualSteps?: string[];
manualSteps: string[];
};
}

View file

@ -152,23 +152,45 @@ const deprecations: ConfigDeprecationProvider = () => [
if (es.username === 'elastic') {
addDeprecation({
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".`],
},
});
} else if (es.username === 'kibana') {
addDeprecation({
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".`],
},
});
}
if (es.ssl?.key !== undefined && es.ssl?.certificate === undefined) {
addDeprecation({
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: [
`Set [${fromPath}.ssl.certificate] in your kibana configs to enable TLS client authentication to Elasticsearch.`,
],
},
});
} else if (es.ssl?.certificate !== undefined && es.ssl?.key === undefined) {
addDeprecation({
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: [
`Set [${fromPath}.ssl.key] in your kibana configs to enable TLS client authentication to Elasticsearch.`,
],
},
});
} else if (es.logQueries === true) {
addDeprecation({
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: [
`Remove Setting [${fromPath}.logQueries] from your kibana configs`,
`Set the log level to "debug" for the "elasticsearch.queries" context in "logging.loggers".`,
],
},
});
}
return;

View file

@ -18,6 +18,12 @@ const deprecations: ConfigDeprecationProvider = () => [
addDeprecation({
message: `"kibana.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`,
documentationUrl: 'https://ela.st/kbn-remove-legacy-multitenancy',
correctiveActions: {
manualSteps: [
`If you rely on this setting to achieve multitenancy you should use Spaces, cross-cluster replication, or cross-cluster search instead.`,
`To migrate to Spaces, we encourage using saved object management to export your saved objects from a tenant into the default tenant in a space.`,
],
},
});
}
return settings;

View file

@ -29,6 +29,9 @@ const migrationDeprecations: ConfigDeprecationProvider = () => [
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',
correctiveActions: {
manualSteps: [`Remove "migrations.enableV2" from your kibana configs.`],
},
});
}
return settings;

View file

@ -872,7 +872,7 @@ export interface DeprecationsDetails {
[key: string]: any;
};
};
manualSteps?: string[];
manualSteps: string[];
};
deprecationType?: 'config' | 'feature';
// (undocumented)

View file

@ -26,6 +26,11 @@ const configSecretDeprecation: ConfigDeprecation = (settings, fromPath, addDepre
message:
'Kibana plugin functional tests will no longer allow corePluginDeprecations.secret ' +
'config to be set to anything except 42.',
correctiveActions: {
manualSteps: [
`This is an intentional deprecation for testing with no intention for having it fixed!`,
],
},
});
}
return settings;

View file

@ -29,7 +29,9 @@ async function getDeprecations({
message: `SavedObject test-deprecations-plugin is still being used.`,
documentationUrl: 'another-test-url',
level: 'critical',
correctiveActions: {},
correctiveActions: {
manualSteps: ['Step a', 'Step b'],
},
});
}

View file

@ -45,7 +45,11 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide
level: 'critical',
message:
'Kibana plugin functional tests will no longer allow corePluginDeprecations.secret config to be set to anything except 42.',
correctiveActions: {},
correctiveActions: {
manualSteps: [
'This is an intentional deprecation for testing with no intention for having it fixed!',
],
},
documentationUrl: 'config-secret-doc-url',
deprecationType: 'config',
domainId: 'corePluginDeprecations',
@ -64,7 +68,9 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide
message: 'SavedObject test-deprecations-plugin is still being used.',
documentationUrl: 'another-test-url',
level: 'critical',
correctiveActions: {},
correctiveActions: {
manualSteps: ['Step a', 'Step b'],
},
domainId: 'corePluginDeprecations',
},
];
@ -151,6 +157,7 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide
mockFail: true,
},
},
manualSteps: ['Step a', 'Step b'],
},
domainId: 'corePluginDeprecations',
})
@ -178,6 +185,7 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide
mockFail: true,
},
},
manualSteps: ['Step a', 'Step b'],
},
domainId: 'corePluginDeprecations',
})
@ -213,6 +221,7 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide
path: '/api/core_deprecations_resolve/',
body: { keyId },
},
manualSteps: ['Step a', 'Step b'],
},
domainId: 'corePluginDeprecations',
})

View file

@ -69,7 +69,18 @@ export const config: PluginConfigDescriptor<ActionsConfig> = {
) {
addDeprecation({
message:
'`xpack.actions.customHostSettings[<index>].tls.rejectUnauthorized` is deprecated. Use `xpack.actions.customHostSettings[<index>].tls.verificationMode` instead, with the setting `verificationMode:full` eql to `rejectUnauthorized:true`, and `verificationMode:none` eql to `rejectUnauthorized:false`.',
`"xpack.actions.customHostSettings[<index>].tls.rejectUnauthorized" is deprecated.` +
`Use "xpack.actions.customHostSettings[<index>].tls.verificationMode" instead, ` +
`with the setting "verificationMode:full" eql to "rejectUnauthorized:true", ` +
`and "verificationMode:none" eql to "rejectUnauthorized:false".`,
correctiveActions: {
manualSteps: [
`Remove "xpack.actions.customHostSettings[<index>].tls.rejectUnauthorized" from your kibana configs.`,
`Use "xpack.actions.customHostSettings[<index>].tls.verificationMode" ` +
`with the setting "verificationMode:full" eql to "rejectUnauthorized:true", ` +
`and "verificationMode:none" eql to "rejectUnauthorized:false".`,
],
},
});
}
},
@ -77,7 +88,17 @@ export const config: PluginConfigDescriptor<ActionsConfig> = {
if (!!settings?.xpack?.actions?.rejectUnauthorized) {
addDeprecation({
message:
'`xpack.actions.rejectUnauthorized` is deprecated. Use `xpack.actions.verificationMode` instead, with the setting `verificationMode:full` eql to `rejectUnauthorized:true`, and `verificationMode:none` eql to `rejectUnauthorized:false`.',
`"xpack.actions.rejectUnauthorized" is deprecated. Use "xpack.actions.verificationMode" instead, ` +
`with the setting "verificationMode:full" eql to "rejectUnauthorized:true", ` +
`and "verificationMode:none" eql to "rejectUnauthorized:false".`,
correctiveActions: {
manualSteps: [
`Remove "xpack.actions.rejectUnauthorized" from your kibana configs.`,
`Use "xpack.actions.verificationMode" ` +
`with the setting "verificationMode:full" eql to "rejectUnauthorized:true", ` +
`and "verificationMode:none" eql to "rejectUnauthorized:false".`,
],
},
});
}
},
@ -85,7 +106,17 @@ export const config: PluginConfigDescriptor<ActionsConfig> = {
if (!!settings?.xpack?.actions?.proxyRejectUnauthorizedCertificates) {
addDeprecation({
message:
'`xpack.actions.proxyRejectUnauthorizedCertificates` is deprecated. Use `xpack.actions.proxyVerificationMode` instead, with the setting `proxyVerificationMode:full` eql to `rejectUnauthorized:true`, and `proxyVerificationMode:none` eql to `rejectUnauthorized:false`.',
`"xpack.actions.proxyRejectUnauthorizedCertificates" is deprecated. Use "xpack.actions.proxyVerificationMode" instead, ` +
`with the setting "proxyVerificationMode:full" eql to "rejectUnauthorized:true",` +
`and "proxyVerificationMode:none" eql to "rejectUnauthorized:false".`,
correctiveActions: {
manualSteps: [
`Remove "xpack.actions.proxyRejectUnauthorizedCertificates" from your kibana configs.`,
`Use "xpack.actions.proxyVerificationMode" ` +
`with the setting "proxyVerificationMode:full" eql to "rejectUnauthorized:true",` +
`and "proxyVerificationMode:none" eql to "rejectUnauthorized:false".`,
],
},
});
}
},

View file

@ -45,6 +45,12 @@ export const config: PluginConfigDescriptor<BannersConfigType> = {
if (pluginConfig?.placement === 'header') {
addDeprecation({
message: 'The `header` value for xpack.banners.placement has been replaced by `top`',
correctiveActions: {
manualSteps: [
`Remove "xpack.banners.placement: header" from your kibana configs.`,
`Add "xpack.banners.placement: to" to your kibana configs instead.`,
],
},
});
return {
set: [{ path: `${fromPath}.placement`, value: 'top' }],

View file

@ -48,7 +48,12 @@ export const deprecations = ({
const emailNotificationsEnabled = get(config, 'cluster_alerts.email_notifications.enabled');
if (emailNotificationsEnabled && !get(config, CLUSTER_ALERTS_ADDRESS_CONFIG_KEY)) {
addDeprecation({
message: `Config key [${fromPath}.${CLUSTER_ALERTS_ADDRESS_CONFIG_KEY}] will be required for email notifications to work in 7.0."`,
message: `Config key [${fromPath}.${CLUSTER_ALERTS_ADDRESS_CONFIG_KEY}] will be required for email notifications to work in 8.0."`,
correctiveActions: {
manualSteps: [
`Add [${fromPath}.${CLUSTER_ALERTS_ADDRESS_CONFIG_KEY}] to your kibana configs."`,
],
},
});
}
return config;
@ -59,10 +64,16 @@ export const deprecations = ({
if (es.username === 'elastic') {
addDeprecation({
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".`],
},
});
} else if (es.username === 'kibana') {
addDeprecation({
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".`],
},
});
}
}
@ -74,10 +85,20 @@ export const deprecations = ({
if (ssl.key !== undefined && ssl.certificate === undefined) {
addDeprecation({
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: [
`Set [${fromPath}.ssl.certificate] in your kibana configs to enable TLS client authentication to Elasticsearch.`,
],
},
});
} else if (ssl.certificate !== undefined && ssl.key === undefined) {
addDeprecation({
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: [
`Set [${fromPath}.ssl.key] in your kibana configs to enable TLS client authentication to Elasticsearch.`,
],
},
});
}
}

View file

@ -45,7 +45,7 @@ describe('deprecations', () => {
const { messages } = applyReportingDeprecations({ roles: { enabled: true } });
expect(messages).toMatchInlineSnapshot(`
Array [
"\\"xpack.reporting.roles\\" is deprecated. Granting reporting privilege through a \\"reporting_user\\" role will not be supported starting in 8.0. Please set 'xpack.reporting.roles.enabled' to 'false' and grant reporting privileges to users using Kibana application privileges **Management > Security > Roles**.",
"\\"xpack.reporting.roles\\" is deprecated. Granting reporting privilege through a \\"reporting_user\\" role will not be supported starting in 8.0. Please set \\"xpack.reporting.roles.enabled\\" to \\"false\\" and grant reporting privileges to users using Kibana application privileges **Management > Security > Roles**.",
]
`);
});

View file

@ -28,6 +28,12 @@ export const config: PluginConfigDescriptor<ReportingConfigType> = {
if (reporting?.index) {
addDeprecation({
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: {
manualSteps: [
`If you rely on this setting to achieve multitenancy you should use Spaces, cross-cluster replication, or cross-cluster search instead.`,
`To migrate to Spaces, we encourage using saved object management to export your saved objects from a tenant into the default tenant in a space.`,
],
},
});
}
@ -35,8 +41,15 @@ export const config: PluginConfigDescriptor<ReportingConfigType> = {
addDeprecation({
message:
`"${fromPath}.roles" is deprecated. Granting reporting privilege through a "reporting_user" role will not be supported ` +
`starting in 8.0. Please set 'xpack.reporting.roles.enabled' to 'false' and grant reporting privileges to users ` +
`starting in 8.0. Please set "xpack.reporting.roles.enabled" to "false" and grant reporting privileges to users ` +
`using Kibana application privileges **Management > Security > Roles**.`,
correctiveActions: {
manualSteps: [
`Set 'xpack.reporting.roles.enabled' to 'false' in your kibana configs.`,
`Grant reporting privileges to users using Kibana application privileges` +
`under **Management > Security > Roles**.`,
],
},
});
}
},

View file

@ -243,7 +243,7 @@ describe('Config Deprecations', () => {
expect(migrated).toEqual(config);
expect(messages).toMatchInlineSnapshot(`
Array [
"Defining \`xpack.security.authc.providers\` as an array of provider types is deprecated. Use extended \`object\` format instead.",
"Defining \\"xpack.security.authc.providers\\" as an array of provider types is deprecated. Use extended \\"object\\" format instead.",
]
`);
});
@ -262,7 +262,7 @@ describe('Config Deprecations', () => {
expect(migrated).toEqual(config);
expect(messages).toMatchInlineSnapshot(`
Array [
"Defining \`xpack.security.authc.providers\` as an array of provider types is deprecated. Use extended \`object\` format instead.",
"Defining \\"xpack.security.authc.providers\\" as an array of provider types is deprecated. Use extended \\"object\\" format instead.",
"Enabling both \`basic\` and \`token\` authentication providers in \`xpack.security.authc.providers\` is deprecated. Login page will only use \`token\` provider.",
]
`);

View file

@ -26,7 +26,13 @@ export const securityConfigDeprecationProvider: ConfigDeprecationProvider = ({
if (Array.isArray(settings?.xpack?.security?.authc?.providers)) {
addDeprecation({
message:
'Defining `xpack.security.authc.providers` as an array of provider types is deprecated. Use extended `object` format instead.',
`Defining "xpack.security.authc.providers" as an array of provider types is deprecated. ` +
`Use extended "object" format instead.`,
correctiveActions: {
manualSteps: [
`Use the extended object format for "xpack.security.authc.providers" in your Kibana configuration.`,
],
},
});
}
},
@ -46,6 +52,11 @@ export const securityConfigDeprecationProvider: ConfigDeprecationProvider = ({
addDeprecation({
message:
'Enabling both `basic` and `token` authentication providers in `xpack.security.authc.providers` is deprecated. Login page will only use `token` provider.',
correctiveActions: {
manualSteps: [
'Remove either the `basic` or `token` auth provider in "xpack.security.authc.providers" from your Kibana configuration.',
],
},
});
}
},
@ -58,6 +69,11 @@ export const securityConfigDeprecationProvider: ConfigDeprecationProvider = ({
addDeprecation({
message:
'`xpack.security.authc.providers.saml.<provider-name>.maxRedirectURLSize` is deprecated and is no longer used',
correctiveActions: {
manualSteps: [
`Remove "xpack.security.authc.providers.saml.<provider-name>.maxRedirectURLSize" from your Kibana configuration.`,
],
},
});
}
},
@ -67,6 +83,12 @@ export const securityConfigDeprecationProvider: ConfigDeprecationProvider = ({
message:
'Disabling the security plugin (`xpack.security.enabled`) will not be supported in the next major version (8.0). ' +
'To turn off security features, disable them in Elasticsearch instead.',
correctiveActions: {
manualSteps: [
`Remove "xpack.security.enabled" from your Kibana configuration.`,
`To turn off security features, disable them in Elasticsearch instead.`,
],
},
});
}
},

View file

@ -28,6 +28,9 @@ const disabledDeprecation: ConfigDeprecation = (config, fromPath, addDeprecation
if (config.xpack?.spaces?.enabled === false) {
addDeprecation({
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`],
},
});
}
};

View file

@ -38,11 +38,23 @@ export const config: PluginConfigDescriptor<TaskManagerConfig> = {
addDeprecation({
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: {
manualSteps: [
`If you rely on this setting to achieve multitenancy you should use Spaces, cross-cluster replication, or cross-cluster search instead.`,
`To migrate to Spaces, we encourage using saved object management to export your saved objects from a tenant into the default tenant in a space.`,
],
},
});
}
if (taskManager?.max_workers > MAX_WORKERS_LIMIT) {
addDeprecation({
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: [
`Maximum allowed value of "${fromPath}.max_workers" is ${MAX_WORKERS_LIMIT}.` +
`Replace "${fromPath}.max_workers: ${taskManager?.max_workers}" with (${MAX_WORKERS_LIMIT}).`,
],
},
});
}
},

View file

@ -45,7 +45,7 @@ describe('Overview page', () => {
const kibanaDeprecationsMockResponse: DomainDeprecationDetails[] = [
{
correctiveActions: {},
correctiveActions: { manualSteps: ['test-step'] },
domainId: 'xpack.spaces',
level: 'critical',
message: