Log deprecation warnings for plugins which won't be disable-able in 8.0 (#112602)

This commit is contained in:
Luke Elmers 2021-09-22 13:58:57 -06:00 committed by GitHub
parent 9d7290d9ad
commit 878b1eeae9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
61 changed files with 509 additions and 98 deletions

View file

@ -134,6 +134,7 @@ shortcuts, click *Help*.
[[console-settings]]
=== Disable Console
deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."]
If you dont want to use *Console*, you can disable it by setting `console.enabled`
to `false` in your `kibana.yml` configuration file. Changing this setting
causes the server to regenerate assets on the next startup,

View file

@ -32,6 +32,7 @@ Be sure to back up the encryption key value somewhere safe, as your alerting rul
==== Action settings
`xpack.actions.enabled`::
deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."]
Feature toggle that enables Actions in {kib}.
If `false`, all features dependent on Actions are disabled, including the *Observability* and *Security* apps. Default: `true`.

View file

@ -41,7 +41,8 @@ Changing these settings may disable features of the APM App.
[cols="2*<"]
|===
| `xpack.apm.enabled`
| Set to `false` to disable the APM app. Defaults to `true`.
| deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."]
Set to `false` to disable the APM app. Defaults to `true`.
| `xpack.apm.maxServiceEnvironments`
| Maximum number of unique service environments recognized by the UI. Defaults to `100`.

View file

@ -13,6 +13,7 @@ They are enabled by default.
==== Grok Debugger settings
`xpack.grokdebugger.enabled` {ess-icon}::
deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."]
Set to `true` to enable the <<xpack-grokdebugger,Grok Debugger>>. Defaults to `true`.
@ -21,6 +22,7 @@ Set to `true` to enable the <<xpack-grokdebugger,Grok Debugger>>. Defaults to `t
==== {searchprofiler} settings
`xpack.searchprofiler.enabled`::
deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."]
Set to `true` to enable the <<xpack-profiler,{searchprofiler}>>. Defaults to `true`.
[float]
@ -28,4 +30,5 @@ Set to `true` to enable the <<xpack-profiler,{searchprofiler}>>. Defaults to `tr
==== Painless Lab settings
`xpack.painless_lab.enabled`::
deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."]
When set to `true`, enables the <<painlesslab, Painless Lab>>. Defaults to `true`.

View file

@ -21,7 +21,8 @@ See the {fleet-guide}/index.html[{fleet}] docs for more information.
[cols="2*<"]
|===
| `xpack.fleet.enabled` {ess-icon}
| Set to `true` (default) to enable {fleet}.
| deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."]
Set to `true` (default) to enable {fleet}.
| `xpack.fleet.agents.enabled` {ess-icon}
| Set to `true` (default) to enable {fleet}.
|===

View file

@ -1,7 +1,8 @@
[cols="2*<"]
|===
| `xpack.infra.enabled`
| Set to `false` to disable the Logs and Metrics app plugin {kib}. Defaults to `true`.
| deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."]
Set to `false` to disable the Logs and Metrics app plugin {kib}. Defaults to `true`.
| `xpack.infra.sources.default.logAlias`
| Index pattern for matching indices that contain log data. Defaults to `filebeat-*,kibana_sample_data_logs*`. To match multiple wildcard patterns, use a comma to separate the names, with no space after the comma. For example, `logstash-app1-*,default-logs-*`.

View file

@ -8,4 +8,5 @@
You do not need to configure any settings to use the {graph-features}.
`xpack.graph.enabled` {ess-icon}::
deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."]
Set to `false` to disable the {graph-features}.

View file

@ -14,7 +14,8 @@ enabled by default.
[cols="2*<"]
|===
| `xpack.ml.enabled` {ess-icon}
| Set to `true` (default) to enable {kib} {ml-features}. +
| deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."]
Set to `true` (default) to enable {kib} {ml-features}. +
+
If set to `false` in `kibana.yml`, the {ml} icon is hidden in this {kib}
instance. If `xpack.ml.enabled` is set to `true` in `elasticsearch.yml`, however,

View file

@ -32,7 +32,8 @@ For more information, see
[cols="2*<"]
|===
| `monitoring.enabled`
| Set to `true` (default) to enable the {monitor-features} in {kib}. Unlike the
| deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."]
Set to `true` (default) to enable the {monitor-features} in {kib}. Unlike the
<<monitoring-ui-enabled, `monitoring.ui.enabled`>> setting, when this setting is `false`, the
monitoring back-end does not run and {kib} stats are not sent to the monitoring
cluster.

View file

@ -15,7 +15,8 @@ You do not need to configure any additional settings to use the
[cols="2*<"]
|===
| `xpack.security.enabled`
| By default, {kib} automatically detects whether to enable the
| deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."]
By default, {kib} automatically detects whether to enable the
{security-features} based on the license and whether {es} {security-features}
are enabled. +
+

View file

@ -15,8 +15,9 @@ roles when Security is enabled.
[cols="2*<"]
|===
| `xpack.spaces.enabled`
| Set to `true` (default) to enable Spaces in {kib}.
This setting is deprecated. Starting in 8.0, it will not be possible to disable this plugin.
| deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."]
Set to `true` (default) to enable Spaces in {kib}.
This setting is deprecated. Starting in 8.0, it will not be possible to disable this plugin.
| `xpack.spaces.maxSpaces`
| The maximum amount of Spaces that can be used with this instance of {kib}. Some operations

View file

@ -9,7 +9,8 @@ Configure the URL drilldown settings in your `kibana.yml` configuration file.
[cols="2*<"]
|===
| [[url-drilldown-enabled]] `url_drilldown.enabled`
| When `true`, enables URL drilldowns on your {kib} instance.
| deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."]
When `true`, enables URL drilldowns on your {kib} instance.
| [[external-URL-policy]] `externalUrl.policy`
| Configures the external URL policies. URL drilldowns respect the global *External URL* service, which you can use to deny or allow external URLs.

View file

@ -125,7 +125,7 @@ Some example translations are shown here:
**Environment Variable**:: **Kibana Setting**
`SERVER_NAME`:: `server.name`
`SERVER_BASEPATH`:: `server.basePath`
`MONITORING_ENABLED`:: `monitoring.enabled`
`ELASTICSEARCH_HOSTS`:: `elasticsearch.hosts`
In general, any setting listed in <<settings>> can be configured with this technique.

View file

@ -21,7 +21,8 @@ configuration using `${MY_ENV_VAR}` syntax.
|===
| `console.enabled:`
| Toggling this causes the server to regenerate assets on the next startup,
| deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."]
Toggling this causes the server to regenerate assets on the next startup,
which may cause a delay before pages start being served.
Set to `false` to disable Console. *Default: `true`*
@ -706,12 +707,13 @@ sources and images. When false, Vega can only get data from {es}. *Default: `fal
| Enables you to view the underlying documents in a data series from a dashboard panel. *Default: `false`*
| `xpack.license_management.enabled`
| Set this value to false to
disable the License Management UI. *Default: `true`*
| deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."]
Set this value to false to disable the License Management UI.
*Default: `true`*
| `xpack.rollup.enabled:`
| Set this value to false to disable the
Rollup UI. *Default: true*
| deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."]
Set this value to false to disable the Rollup UI. *Default: true*
| `i18n.locale` {ess-icon}
| Set this value to change the {kib} interface language.

View file

@ -149,6 +149,8 @@ NOTE: Removing a plugin will result in an "optimize" run which will delay the ne
[[disable-plugin]]
== Disable plugins
deprecated:[7.16.0,"In 8.0 and later, this setting will only be supported for a subset of plugins that have opted in to the behavior."]
Use the following command to disable a plugin:
[source,shell]
@ -158,7 +160,7 @@ Use the following command to disable a plugin:
NOTE: Disabling or enabling a plugin will result in an "optimize" run which will delay the start of {kib}.
<1> You can find a plugin's plugin ID as the value of the `name` property in the plugin's `package.json` file.
<1> You can find a plugin's plugin ID as the value of the `name` property in the plugin's `kibana.json` file.
[float]
[[configure-plugin-manager]]

View file

@ -364,6 +364,37 @@ test('read "enabled" even if its schema is not present', async () => {
expect(isEnabled).toBe(true);
});
test('logs deprecation if schema is not present and "enabled" is used', async () => {
const initialConfig = {
foo: {
enabled: true,
},
};
const rawConfigProvider = rawConfigServiceMock.create({ rawConfig: initialConfig });
const configService = new ConfigService(rawConfigProvider, defaultEnv, logger);
await configService.isEnabledAtPath('foo');
expect(configService.getHandledDeprecatedConfigs()).toMatchInlineSnapshot(`
Array [
Array [
"foo",
Array [
Object {
"correctiveActions": Object {
"manualSteps": Array [
"Remove \\"foo.enabled\\" from the Kibana config file, CLI flag, or environment variable (in Docker only) before upgrading to 8.0.0.",
],
},
"message": "Configuring \\"foo.enabled\\" is deprecated and will be removed in 8.0.0.",
"title": "Setting \\"foo.enabled\\" is deprecated",
},
],
],
]
`);
});
test('allows plugins to specify "enabled" flag via validation schema', async () => {
const initialConfig = {};

View file

@ -177,6 +177,23 @@ export class ConfigService {
// if plugin hasn't got a config schema, we try to read "enabled" directly
const isEnabled = validatedConfig?.enabled ?? config.get(enabledPath);
// if we implicitly added an `enabled` config to a plugin without a schema,
// we log a deprecation warning, as this will not be supported in 8.0
if (validatedConfig?.enabled === undefined && isEnabled !== undefined) {
const deprecationPath = pathToString(enabledPath);
const deprecatedConfigDetails: DeprecatedConfigDetails = {
title: `Setting "${deprecationPath}" is deprecated`,
message: `Configuring "${deprecationPath}" is deprecated and will be removed in 8.0.0.`,
correctiveActions: {
manualSteps: [
`Remove "${deprecationPath}" from the Kibana config file, CLI flag, or environment variable (in Docker only) before upgrading to 8.0.0.`,
],
},
};
this.deprecationLog.warn(deprecatedConfigDetails.message);
this.markDeprecatedConfigAsHandled(namespace, deprecatedConfigDetails);
}
// not declared. consider that plugin is enabled by default
if (isEnabled === undefined) {
return true;
@ -220,9 +237,7 @@ export class ConfigService {
if (!context.silent) {
deprecationMessages.push(context.message);
}
const handledDeprecatedConfig = this.handledDeprecatedConfigs.get(domainId) || [];
handledDeprecatedConfig.push(context);
this.handledDeprecatedConfigs.set(domainId, handledDeprecatedConfig);
this.markDeprecatedConfigAsHandled(domainId, context);
};
applyDeprecations(rawConfig, deprecations, createAddDeprecation);
@ -260,6 +275,12 @@ export class ConfigService {
this.log.debug(`Marking config path as handled: ${path}`);
this.handledPaths.add(path);
}
private markDeprecatedConfigAsHandled(domainId: string, config: DeprecatedConfigDetails) {
const handledDeprecatedConfig = this.handledDeprecatedConfigs.get(domainId) || [];
handledDeprecatedConfig.push(config);
this.handledDeprecatedConfigs.set(domainId, handledDeprecatedConfig);
}
}
const createPluginEnabledPath = (configPath: string | string[]) => {

View file

@ -10,7 +10,8 @@ import { DeprecatedConfigDetails } from './types';
import { configDeprecationFactory } from './deprecation_factory';
describe('DeprecationFactory', () => {
const { rename, unused, renameFromRoot, unusedFromRoot } = configDeprecationFactory;
const { deprecate, deprecateFromRoot, rename, renameFromRoot, unused, unusedFromRoot } =
configDeprecationFactory;
const addDeprecation = jest.fn<void, [DeprecatedConfigDetails]>();
@ -18,6 +19,139 @@ describe('DeprecationFactory', () => {
addDeprecation.mockClear();
});
describe('deprecate', () => {
it('logs a warning when property is present', () => {
const rawConfig = {
myplugin: {
deprecated: 'deprecated',
valid: 'valid',
},
someOtherPlugin: {
property: 'value',
},
};
const commands = deprecate('deprecated', '8.0.0')(rawConfig, 'myplugin', addDeprecation);
expect(commands).toBeUndefined();
expect(addDeprecation.mock.calls).toMatchInlineSnapshot(`
Array [
Array [
Object {
"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.",
],
},
"message": "Configuring \\"myplugin.deprecated\\" is deprecated and will be removed in 8.0.0.",
"title": "Setting \\"myplugin.deprecated\\" is deprecated",
},
],
]
`);
});
it('handles deeply nested keys', () => {
const rawConfig = {
myplugin: {
section: {
deprecated: 'deprecated',
},
valid: 'valid',
},
someOtherPlugin: {
property: 'value',
},
};
const commands = deprecate('section.deprecated', '8.0.0')(
rawConfig,
'myplugin',
addDeprecation
);
expect(commands).toBeUndefined();
expect(addDeprecation.mock.calls).toMatchInlineSnapshot(`
Array [
Array [
Object {
"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.",
],
},
"message": "Configuring \\"myplugin.section.deprecated\\" is deprecated and will be removed in 8.0.0.",
"title": "Setting \\"myplugin.section.deprecated\\" is deprecated",
},
],
]
`);
});
it('does not log if unused property is not present', () => {
const rawConfig = {
myplugin: {
valid: 'valid',
},
someOtherPlugin: {
property: 'value',
},
};
const commands = deprecate('deprecated', '8.0.0')(rawConfig, 'myplugin', addDeprecation);
expect(commands).toBeUndefined();
expect(addDeprecation).toBeCalledTimes(0);
});
});
describe('deprecateFromRoot', () => {
it('logs a warning when property is present', () => {
const rawConfig = {
myplugin: {
deprecated: 'deprecated',
valid: 'valid',
},
someOtherPlugin: {
property: 'value',
},
};
const commands = deprecateFromRoot('myplugin.deprecated', '8.0.0')(
rawConfig,
'does-not-matter',
addDeprecation
);
expect(commands).toBeUndefined();
expect(addDeprecation.mock.calls).toMatchInlineSnapshot(`
Array [
Array [
Object {
"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.",
],
},
"message": "Configuring \\"myplugin.deprecated\\" is deprecated and will be removed in 8.0.0.",
"title": "Setting \\"myplugin.deprecated\\" is deprecated",
},
],
]
`);
});
it('does not log if unused property is not present', () => {
const rawConfig = {
myplugin: {
valid: 'valid',
},
someOtherPlugin: {
property: 'value',
},
};
const commands = deprecateFromRoot('myplugin.deprecated', '8.0.0')(
rawConfig,
'does-not-matter',
addDeprecation
);
expect(commands).toBeUndefined();
expect(addDeprecation).toBeCalledTimes(0);
});
});
describe('rename', () => {
it('moves the property to rename and logs a warning if old property exist and new one does not', () => {
const rawConfig = {
@ -132,7 +266,7 @@ describe('DeprecationFactory', () => {
"Remove \\"myplugin.deprecated\\" from the config.",
],
},
"message": "Setting \\"$myplugin.deprecated\\" has been replaced by \\"$myplugin.renamed\\". However, both keys are present. Ignoring \\"$myplugin.deprecated\\"",
"message": "Setting \\"myplugin.deprecated\\" has been replaced by \\"myplugin.renamed\\". However, both keys are present. Ignoring \\"myplugin.deprecated\\"",
"title": "Setting \\"myplugin.deprecated\\" is deprecated",
},
],
@ -269,7 +403,7 @@ describe('DeprecationFactory', () => {
"Remove \\"myplugin.deprecated\\" from the config.",
],
},
"message": "Setting \\"$myplugin.deprecated\\" has been replaced by \\"$myplugin.renamed\\". However, both keys are present. Ignoring \\"$myplugin.deprecated\\"",
"message": "Setting \\"myplugin.deprecated\\" has been replaced by \\"myplugin.renamed\\". However, both keys are present. Ignoring \\"myplugin.deprecated\\"",
"title": "Setting \\"myplugin.deprecated\\" is deprecated",
},
],

View file

@ -24,6 +24,37 @@ const getDeprecationTitle = (deprecationPath: string) => {
});
};
const _deprecate = (
config: Record<string, any>,
rootPath: string,
addDeprecation: AddConfigDeprecation,
deprecatedKey: string,
removeBy: string,
details?: Partial<DeprecatedConfigDetails>
): void => {
const fullPath = getPath(rootPath, deprecatedKey);
if (get(config, fullPath) === undefined) {
return;
}
addDeprecation({
title: getDeprecationTitle(fullPath),
message: i18n.translate('kbnConfig.deprecations.deprecatedSettingMessage', {
defaultMessage: 'Configuring "{fullPath}" is deprecated and will be removed in {removeBy}.',
values: { fullPath, removeBy },
}),
correctiveActions: {
manualSteps: [
i18n.translate('kbnConfig.deprecations.deprecatedSetting.manualStepOneMessage', {
defaultMessage:
'Remove "{fullPath}" from the Kibana config file, CLI flag, or environment variable (in Docker only) before upgrading to {removeBy}.',
values: { fullPath, removeBy },
}),
],
},
...details,
});
};
const _rename = (
config: Record<string, any>,
rootPath: string,
@ -67,7 +98,7 @@ const _rename = (
title: getDeprecationTitle(fullOldPath),
message: i18n.translate('kbnConfig.deprecations.conflictSettingMessage', {
defaultMessage:
'Setting "${fullOldPath}" has been replaced by "${fullNewPath}". However, both keys are present. Ignoring "${fullOldPath}"',
'Setting "{fullOldPath}" has been replaced by "{fullNewPath}". However, both keys are present. Ignoring "{fullOldPath}"',
values: { fullOldPath, fullNewPath },
}),
correctiveActions: {
@ -125,6 +156,24 @@ const _unused = (
};
};
const deprecate =
(
unusedKey: string,
removeBy: string,
details?: Partial<DeprecatedConfigDetails>
): ConfigDeprecation =>
(config, rootPath, addDeprecation) =>
_deprecate(config, rootPath, addDeprecation, unusedKey, removeBy, details);
const deprecateFromRoot =
(
unusedKey: string,
removeBy: string,
details?: Partial<DeprecatedConfigDetails>
): ConfigDeprecation =>
(config, rootPath, addDeprecation) =>
_deprecate(config, '', addDeprecation, unusedKey, removeBy, details);
const rename =
(oldKey: string, newKey: string, details?: Partial<DeprecatedConfigDetails>): ConfigDeprecation =>
(config, rootPath, addDeprecation) =>
@ -154,6 +203,8 @@ const getPath = (rootPath: string, subPath: string) =>
* @internal
*/
export const configDeprecationFactory: ConfigDeprecationFactory = {
deprecate,
deprecateFromRoot,
rename,
renameFromRoot,
unused,

View file

@ -91,6 +91,7 @@ export interface ConfigDeprecationCommand {
* @example
* ```typescript
* const provider: ConfigDeprecationProvider = ({ rename, unused }) => [
* deprecate('deprecatedKey', '8.0.0'),
* rename('oldKey', 'newKey'),
* unused('deprecatedKey'),
* (config, path) => ({ unset: [{ key: 'path.to.key' }] })
@ -119,6 +120,43 @@ export type ConfigDeprecationProvider = (factory: ConfigDeprecationFactory) => C
*/
export interface ConfigDeprecationFactory {
/**
* Deprecate a configuration property from inside a plugin's configuration path.
* Will log a deprecation warning if the deprecatedKey was found.
*
* @example
* Log a deprecation warning indicating 'myplugin.deprecatedKey' should be removed by `8.0.0`
* ```typescript
* const provider: ConfigDeprecationProvider = ({ deprecate }) => [
* deprecate('deprecatedKey', '8.0.0'),
* ]
* ```
*/
deprecate(
deprecatedKey: string,
removeBy: string,
details?: Partial<DeprecatedConfigDetails>
): ConfigDeprecation;
/**
* Deprecate a configuration property from the root configuration.
* Will log a deprecation warning if the deprecatedKey was found.
*
* This should be only used when deprecating properties from different configuration's path.
* To deprecate properties from inside a plugin's configuration, use 'deprecate' instead.
*
* @example
* Log a deprecation warning indicating 'myplugin.deprecatedKey' should be removed by `8.0.0`
* ```typescript
* const provider: ConfigDeprecationProvider = ({ deprecate }) => [
* deprecateFromRoot('deprecatedKey', '8.0.0'),
* ]
* ```
*/
deprecateFromRoot(
deprecatedKey: string,
removeBy: string,
details?: Partial<DeprecatedConfigDetails>
): ConfigDeprecation;
/**
* Rename a configuration property from inside a plugin's configuration path.
* Will log a deprecation warning if the oldKey was found and deprecation applied.

View file

@ -23,7 +23,7 @@ export async function setupLogging(
// thrown every time we start the server.
// In order to keep using the legacy logger until we remove it I'm just adding
// a new hard limit here.
process.stdout.setMaxListeners(40);
process.stdout.setMaxListeners(60);
return await server.register({
plugin: good,

View file

@ -10,7 +10,8 @@ import { schema, TypeOf } from '@kbn/config-schema';
import { ConfigDeprecationProvider, PluginInitializerContext } from '../../../core/server';
import { APMOSSPlugin } from './plugin';
const deprecations: ConfigDeprecationProvider = ({ unused }) => [
const deprecations: ConfigDeprecationProvider = ({ deprecate, unused }) => [
deprecate('enabled', '8.0.0'),
unused('fleetMode'),
unused('indexPattern'),
];

View file

@ -16,6 +16,6 @@ export { ConsoleSetup, ConsoleStart } from './types';
export const plugin = (ctx: PluginInitializerContext) => new ConsoleServerPlugin(ctx);
export const config: PluginConfigDescriptor<ConfigType> = {
deprecations: ({ unused }) => [unused('ssl')],
deprecations: ({ deprecate, unused, rename }) => [deprecate('enabled', '8.0.0'), unused('ssl')],
schema: configSchema,
};

View file

@ -0,0 +1,15 @@
/*
* 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';
export const configSchema = schema.object({
enabled: schema.boolean({ defaultValue: true }),
});
export type ConfigSchema = TypeOf<typeof configSchema>;

View file

@ -5,6 +5,13 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { PluginConfigDescriptor } from 'src/core/server';
import { configSchema, ConfigSchema } from '../config';
import { VisTypePieServerPlugin } from './plugin';
export const config: PluginConfigDescriptor<ConfigSchema> = {
schema: configSchema,
};
export const plugin = () => new VisTypePieServerPlugin();

View file

@ -9,7 +9,8 @@
"include": [
"common/**/*",
"public/**/*",
"server/**/*"
"server/**/*",
"*.ts"
],
"references": [
{ "path": "../../../core/tsconfig.json" },

View file

@ -0,0 +1,15 @@
/*
* 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';
export const configSchema = schema.object({
enabled: schema.boolean({ defaultValue: true }),
});
export type ConfigSchema = TypeOf<typeof configSchema>;

View file

@ -2,7 +2,7 @@
"id": "visTypeXy",
"version": "kibana",
"ui": true,
"server": false,
"server": true,
"requiredPlugins": ["charts", "data", "expressions", "visualizations", "usageCollection"],
"requiredBundles": ["kibanaUtils", "visDefaultEditor"],
"extraPublicDirs": ["common/index"],

View file

@ -0,0 +1,17 @@
/*
* 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 { PluginConfigDescriptor } from 'src/core/server';
import { configSchema, ConfigSchema } from '../config';
import { VisTypeXYServerPlugin } from './plugin';
export const config: PluginConfigDescriptor<ConfigSchema> = {
schema: configSchema,
};
export const plugin = () => new VisTypeXYServerPlugin();

View file

@ -0,0 +1,19 @@
/*
* 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 { Plugin } from 'src/core/server';
export class VisTypeXYServerPlugin implements Plugin {
public setup() {
return {};
}
public start() {
return {};
}
}

View file

@ -9,7 +9,8 @@
"include": [
"common/**/*",
"public/**/*",
"server/**/*"
"server/**/*",
"*.ts"
],
"references": [
{ "path": "../../../core/tsconfig.json" },

View file

@ -6,56 +6,62 @@
*/
import { schema, TypeOf } from '@kbn/config-schema';
import { PluginInitializerContext } from 'src/core/server';
import {
PluginInitializerContext,
PluginConfigDescriptor,
} from 'src/core/server';
import { APMOSSConfig } from 'src/plugins/apm_oss/server';
import { APMPlugin } from './plugin';
import { SearchAggregatedTransactionSetting } from '../common/aggregated_transactions';
const configSchema = schema.object({
enabled: schema.boolean({ defaultValue: true }),
serviceMapEnabled: schema.boolean({ defaultValue: true }),
serviceMapFingerprintBucketSize: schema.number({ defaultValue: 100 }),
serviceMapTraceIdBucketSize: schema.number({ defaultValue: 65 }),
serviceMapFingerprintGlobalBucketSize: schema.number({
defaultValue: 1000,
}),
serviceMapTraceIdGlobalBucketSize: schema.number({ defaultValue: 6 }),
serviceMapMaxTracesPerRequest: schema.number({ defaultValue: 50 }),
autocreateApmIndexPattern: schema.boolean({ defaultValue: true }),
ui: schema.object({
enabled: schema.boolean({ defaultValue: true }),
transactionGroupBucketSize: schema.number({ defaultValue: 1000 }),
maxTraceItems: schema.number({ defaultValue: 1000 }),
}),
searchAggregatedTransactions: schema.oneOf(
[
schema.literal(SearchAggregatedTransactionSetting.auto),
schema.literal(SearchAggregatedTransactionSetting.always),
schema.literal(SearchAggregatedTransactionSetting.never),
],
{ defaultValue: SearchAggregatedTransactionSetting.auto }
),
telemetryCollectionEnabled: schema.boolean({ defaultValue: true }),
metricsInterval: schema.number({ defaultValue: 30 }),
maxServiceEnvironments: schema.number({ defaultValue: 100 }),
maxServiceSelection: schema.number({ defaultValue: 50 }),
profilingEnabled: schema.boolean({ defaultValue: false }),
agent: schema.object({
migrations: schema.object({
enabled: schema.boolean({ defaultValue: false }),
}),
}),
});
// plugin config
export const config = {
export const config: PluginConfigDescriptor<APMXPackConfig> = {
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
exposeToBrowser: {
serviceMapEnabled: true,
ui: true,
profilingEnabled: true,
},
schema: schema.object({
enabled: schema.boolean({ defaultValue: true }),
serviceMapEnabled: schema.boolean({ defaultValue: true }),
serviceMapFingerprintBucketSize: schema.number({ defaultValue: 100 }),
serviceMapTraceIdBucketSize: schema.number({ defaultValue: 65 }),
serviceMapFingerprintGlobalBucketSize: schema.number({
defaultValue: 1000,
}),
serviceMapTraceIdGlobalBucketSize: schema.number({ defaultValue: 6 }),
serviceMapMaxTracesPerRequest: schema.number({ defaultValue: 50 }),
autocreateApmIndexPattern: schema.boolean({ defaultValue: true }),
ui: schema.object({
enabled: schema.boolean({ defaultValue: true }),
transactionGroupBucketSize: schema.number({ defaultValue: 1000 }),
maxTraceItems: schema.number({ defaultValue: 1000 }),
}),
searchAggregatedTransactions: schema.oneOf(
[
schema.literal(SearchAggregatedTransactionSetting.auto),
schema.literal(SearchAggregatedTransactionSetting.always),
schema.literal(SearchAggregatedTransactionSetting.never),
],
{ defaultValue: SearchAggregatedTransactionSetting.auto }
),
telemetryCollectionEnabled: schema.boolean({ defaultValue: true }),
metricsInterval: schema.number({ defaultValue: 30 }),
maxServiceEnvironments: schema.number({ defaultValue: 100 }),
maxServiceSelection: schema.number({ defaultValue: 50 }),
profilingEnabled: schema.boolean({ defaultValue: false }),
agent: schema.object({
migrations: schema.object({
enabled: schema.boolean({ defaultValue: false }),
}),
}),
}),
schema: configSchema,
};
export type APMXPackConfig = TypeOf<typeof config.schema>;
export type APMXPackConfig = TypeOf<typeof configSchema>;
export type APMConfig = ReturnType<typeof mergeConfigs>;
// plugin config and ui indices settings

View file

@ -15,7 +15,8 @@ export const config: PluginConfigDescriptor<ConfigType> = {
exposeToBrowser: {
markdownPlugins: true,
},
deprecations: ({ renameFromRoot }) => [
deprecations: ({ deprecate, renameFromRoot }) => [
deprecate('enabled', '8.0.0'),
renameFromRoot('xpack.case.enabled', 'xpack.cases.enabled'),
],
};

View file

@ -52,5 +52,6 @@ export const config: PluginConfigDescriptor<CloudConfigType> = {
organization_url: true,
full_story: true,
},
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
schema: configSchema,
};

View file

@ -17,4 +17,5 @@ export const config: PluginConfigDescriptor<CrossClusterReplicationConfig> = {
exposeToBrowser: {
ui: true,
},
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
};

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import type { PluginInitializerContext } from 'src/core/server';
import type { PluginConfigDescriptor, PluginInitializerContext } from 'src/core/server';
import { ConfigSchema } from './config';
import { EncryptedSavedObjectsPlugin } from './plugin';
@ -15,6 +15,9 @@ export { EncryptedSavedObjectsPluginSetup, EncryptedSavedObjectsPluginStart } fr
export { EncryptedSavedObjectsClient } from './saved_objects';
export type { IsMigrationNeededPredicate } from './create_migration';
export const config = { schema: ConfigSchema };
export const config: PluginConfigDescriptor = {
schema: ConfigSchema,
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
};
export const plugin = (initializerContext: PluginInitializerContext) =>
new EncryptedSavedObjectsPlugin(initializerContext);

View file

@ -37,4 +37,5 @@ export const config: PluginConfigDescriptor<ConfigType> = {
exposeToBrowser: {
host: true,
},
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
};

View file

@ -42,7 +42,8 @@ export const config: PluginConfigDescriptor = {
epm: true,
agents: true,
},
deprecations: ({ renameFromRoot, unused, unusedFromRoot }) => [
deprecations: ({ deprecate, renameFromRoot, unused, unusedFromRoot }) => [
deprecate('enabled', '8.0.0'),
// Fleet plugin was named ingestManager before
renameFromRoot('xpack.ingestManager.enabled', 'xpack.fleet.enabled'),
renameFromRoot('xpack.ingestManager.registryUrl', 'xpack.fleet.registryUrl'),

View file

@ -18,4 +18,5 @@ export const config: PluginConfigDescriptor<ConfigSchema> = {
savePolicy: true,
},
schema: configSchema,
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
};

View file

@ -17,4 +17,5 @@ export const config: PluginConfigDescriptor<IndexLifecycleManagementConfig> = {
exposeToBrowser: {
ui: true,
},
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
};

View file

@ -5,15 +5,16 @@
* 2.0.
*/
import { PluginInitializerContext } from 'src/core/server';
import { PluginInitializerContext, PluginConfigDescriptor } from 'src/core/server';
import { IndexMgmtServerPlugin } from './plugin';
import { configSchema } from './config';
export const plugin = (context: PluginInitializerContext) => new IndexMgmtServerPlugin(context);
export const config = {
export const config: PluginConfigDescriptor = {
schema: configSchema,
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
};
/** @public */

View file

@ -9,7 +9,12 @@ import { Server } from '@hapi/hapi';
import { schema, TypeOf } from '@kbn/config-schema';
import { i18n } from '@kbn/i18n';
import { Logger } from '@kbn/logging';
import { CoreSetup, PluginInitializerContext, Plugin } from 'src/core/server';
import {
CoreSetup,
PluginInitializerContext,
Plugin,
PluginConfigDescriptor,
} from 'src/core/server';
import { LOGS_FEATURE_ID, METRICS_FEATURE_ID } from '../common/constants';
import { InfraStaticSourceConfiguration } from '../common/source_configuration/source_configuration';
import { inventoryViewSavedObjectType } from '../common/saved_objects/inventory_view';
@ -36,7 +41,7 @@ import { createGetLogQueryFields } from './services/log_queries/get_log_query_fi
import { handleEsError } from '../../../../src/plugins/es_ui_shared/server';
import { RulesService } from './services/rules';
export const config = {
export const config: PluginConfigDescriptor = {
schema: schema.object({
enabled: schema.boolean({ defaultValue: true }),
inventory: schema.object({
@ -63,6 +68,7 @@ export const config = {
})
),
}),
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
};
export type InfraConfig = TypeOf<typeof config.schema>;

View file

@ -19,6 +19,7 @@ import { configSchema, ConfigSchema } from '../config';
export const config: PluginConfigDescriptor<ConfigSchema> = {
schema: configSchema,
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
};
export const plugin = (initializerContext: PluginInitializerContext) =>

View file

@ -17,4 +17,5 @@ export const config: PluginConfigDescriptor<LicenseManagementConfig> = {
exposeToBrowser: {
ui: true,
},
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
};

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { PluginInitializerContext } from '../../../../src/core/server';
import { PluginConfigDescriptor, PluginInitializerContext } from '../../../../src/core/server';
import { ConfigSchema } from './config';
import { ListPlugin } from './plugin';
@ -19,6 +19,9 @@ export {
export { ExceptionListClient } from './services/exception_lists/exception_list_client';
export type { ListPluginSetup, ListsApiRequestHandlerContext } from './types';
export const config = { schema: ConfigSchema };
export const config: PluginConfigDescriptor = {
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
schema: ConfigSchema,
};
export const plugin = (initializerContext: PluginInitializerContext): ListPlugin =>
new ListPlugin(initializerContext);

View file

@ -15,4 +15,5 @@ export const config: PluginConfigDescriptor = {
schema: schema.object({
enabled: schema.boolean({ defaultValue: true }),
}),
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
};

View file

@ -22,7 +22,8 @@ export const config: PluginConfigDescriptor<MapsXPackConfig> = {
preserveDrawingBuffer: true,
},
schema: configSchema,
deprecations: () => [
deprecations: ({ deprecate }) => [
deprecate('enabled', '8.0.0'),
(
completeConfig: Record<string, any>,
rootPath: string,

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { PluginInitializerContext } from '../../../../src/core/server';
import { PluginConfigDescriptor, PluginInitializerContext } from '../../../../src/core/server';
import { ConfigSchema } from './config';
import { MetricsEntitiesPlugin } from './plugin';
@ -13,7 +13,10 @@ import { MetricsEntitiesPlugin } from './plugin';
// This exports static code and TypeScript types,
// as well as, Kibana Platform `plugin()` initializer.
export const config = { schema: ConfigSchema };
export const config: PluginConfigDescriptor = {
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
schema: ConfigSchema,
};
export const plugin = (initializerContext: PluginInitializerContext): MetricsEntitiesPlugin => {
return new MetricsEntitiesPlugin(initializerContext);
};

View file

@ -10,12 +10,13 @@ import { deprecations as deprecationsModule } from './deprecations';
describe('monitoring plugin deprecations', function () {
let transformDeprecations;
const deprecate = jest.fn(() => jest.fn());
const rename = jest.fn(() => jest.fn());
const renameFromRoot = jest.fn(() => jest.fn());
const fromPath = 'monitoring';
beforeAll(function () {
const deprecations = deprecationsModule({ rename, renameFromRoot });
const deprecations = deprecationsModule({ deprecate, rename, renameFromRoot });
transformDeprecations = (settings, fromPath, addDeprecation = noop) => {
deprecations.forEach((deprecation) => deprecation(settings, fromPath, addDeprecation));
};

View file

@ -18,10 +18,12 @@ import { CLUSTER_ALERTS_ADDRESS_CONFIG_KEY } from '../common/constants';
* @return {Array} array of rename operations and callback function for rename logging
*/
export const deprecations = ({
deprecate,
rename,
renameFromRoot,
}: ConfigDeprecationFactory): ConfigDeprecation[] => {
return [
deprecate('enabled', '8.0.0'),
// This order matters. The "blanket rename" needs to happen at the end
renameFromRoot('xpack.monitoring.max_bucket_size', 'monitoring.ui.max_bucket_size'),
renameFromRoot('xpack.monitoring.min_interval_seconds', 'monitoring.ui.min_interval_seconds'),

View file

@ -9,7 +9,7 @@
/* eslint-disable @kbn/eslint/no_export_all */
import { schema, TypeOf } from '@kbn/config-schema';
import { PluginInitializerContext } from 'src/core/server';
import { PluginConfigDescriptor, PluginInitializerContext } from 'src/core/server';
import { ObservabilityPlugin, ObservabilityPluginSetup } from './plugin';
import { createOrUpdateIndex, Mappings } from './utils/create_or_update_index';
import { ScopedAnnotationsClient } from './lib/annotations/bootstrap_annotations';
@ -18,9 +18,9 @@ export { rangeQuery, kqlQuery } from './utils/queries';
export * from './types';
export const config = {
export const config: PluginConfigDescriptor = {
exposeToBrowser: {
unsafe: { alertingExperience: { enabled: true }, cases: { enabled: true } },
unsafe: true,
},
schema: schema.object({
enabled: schema.boolean({ defaultValue: true }),
@ -33,6 +33,7 @@ export const config = {
cases: schema.object({ enabled: schema.boolean({ defaultValue: false }) }),
}),
}),
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
};
export type ObservabilityConfig = TypeOf<typeof config.schema>;

View file

@ -5,11 +5,12 @@
* 2.0.
*/
import { PluginInitializerContext } from '../../../../src/core/server';
import { PluginConfigDescriptor, PluginInitializerContext } from '../../../../src/core/server';
import { OsqueryPlugin } from './plugin';
import { ConfigSchema } from './config';
import { ConfigSchema, ConfigType } from './config';
export const config = {
export const config: PluginConfigDescriptor<ConfigType> = {
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
schema: ConfigSchema,
exposeToBrowser: {
enabled: true,

View file

@ -18,6 +18,7 @@ export const configSchema = schema.object({
export type ConfigType = TypeOf<typeof configSchema>;
export const config: PluginConfigDescriptor<ConfigType> = {
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
schema: configSchema,
exposeToBrowser: {
ui: true,

View file

@ -13,5 +13,6 @@ export const plugin = (pluginInitializerContext: PluginInitializerContext) =>
new RollupPlugin(pluginInitializerContext);
export const config: PluginConfigDescriptor<RollupConfig> = {
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
schema: configSchema,
};

View file

@ -6,8 +6,10 @@
*/
import { schema, TypeOf } from '@kbn/config-schema';
import { PluginConfigDescriptor } from 'src/core/server';
export const config = {
export const config: PluginConfigDescriptor = {
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
schema: schema.object({
enabled: schema.boolean({ defaultValue: true }),
write: schema.object({

View file

@ -16,6 +16,7 @@ const configSchema = schema.object({
export type SavedObjectsTaggingConfigType = TypeOf<typeof configSchema>;
export const config: PluginConfigDescriptor<SavedObjectsTaggingConfigType> = {
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
schema: configSchema,
exposeToBrowser: {
cache_refresh_interval: true,

View file

@ -20,7 +20,8 @@ export const config: PluginConfigDescriptor<ConfigType> = {
enableExperimental: true,
},
schema: configSchema,
deprecations: ({ renameFromRoot }) => [
deprecations: ({ deprecate, renameFromRoot }) => [
deprecate('enabled', '8.0.0'),
renameFromRoot('xpack.siem.enabled', 'xpack.securitySolution.enabled'),
renameFromRoot(
'xpack.siem.maxRuleImportExportSize',

View file

@ -12,6 +12,7 @@ import { configSchema, SnapshotRestoreConfig } from './config';
export const plugin = (ctx: PluginInitializerContext) => new SnapshotRestoreServerPlugin(ctx);
export const config: PluginConfigDescriptor<SnapshotRestoreConfig> = {
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
schema: configSchema,
exposeToBrowser: {
slm_ui: true,

View file

@ -5,11 +5,12 @@
* 2.0.
*/
import { PluginInitializerContext } from '../../../../src/core/server';
import { PluginInitializerContext, PluginConfigDescriptor } from '../../../../src/core/server';
import { TimelinesPlugin } from './plugin';
import { ConfigSchema } from './config';
import { ConfigSchema, ConfigType } from './config';
export const config = {
export const config: PluginConfigDescriptor<ConfigType> = {
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
schema: ConfigSchema,
exposeToBrowser: {
enabled: true,

View file

@ -17,11 +17,7 @@ export class UpgradeAssistantUIPlugin
{
constructor(private ctx: PluginInitializerContext) {}
setup(coreSetup: CoreSetup<StartDependencies>, { management, cloud }: SetupDependencies) {
const { enabled, readonly } = this.ctx.config.get<Config>();
if (!enabled) {
return;
}
const { readonly } = this.ctx.config.get<Config>();
const appRegistrar = management.sections.section.stack;
const kibanaVersion = new SemVer(this.ctx.env.packageInfo.version);

View file

@ -14,9 +14,9 @@ export const plugin = (ctx: PluginInitializerContext) => {
};
export const config: PluginConfigDescriptor<Config> = {
deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
schema: configSchema,
exposeToBrowser: {
enabled: true,
readonly: true,
},
};