Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.x] Log deprecation warnings for plugins which won't be disable-able in 8.0 (#112602) #112728

Merged
merged 12 commits into from
Sep 22, 2021
Merged
1 change: 1 addition & 0 deletions docs/dev-tools/console/console.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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 don’t 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,
Expand Down
1 change: 1 addition & 0 deletions docs/settings/alert-action-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down
3 changes: 2 additions & 1 deletion docs/settings/apm-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,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`.
Expand Down
3 changes: 3 additions & 0 deletions docs/settings/dev-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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`.


Expand All @@ -21,11 +22,13 @@ 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]
[[painless_lab-settings]]
==== 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`.
3 changes: 2 additions & 1 deletion docs/settings/fleet-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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}.
|===
Expand Down
3 changes: 2 additions & 1 deletion docs/settings/general-infra-logs-ui-settings.asciidoc
Original file line number Diff line number Diff line change
@@ -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-*`.
Expand Down
1 change: 1 addition & 0 deletions docs/settings/graph-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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}.
3 changes: 2 additions & 1 deletion docs/settings/ml-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion docs/settings/monitoring-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion docs/settings/security-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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. +
+
Expand Down
5 changes: 3 additions & 2 deletions docs/settings/spaces-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion docs/settings/url-drilldown-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docs/setup/docker.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
12 changes: 7 additions & 5 deletions docs/setup/settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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`*

Expand Down Expand Up @@ -794,12 +795,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.
Expand Down
4 changes: 3 additions & 1 deletion docs/user/plugins.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]]
Expand Down
31 changes: 31 additions & 0 deletions packages/kbn-config/src/config_service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};

Expand Down
27 changes: 24 additions & 3 deletions packages/kbn-config/src/config_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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[]) => {
Expand Down
Loading