Skip to content

Commit

Permalink
Merge branch 'master' into archive-migration/xpack-packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Sep 1, 2021
2 parents 766ead1 + 77890b1 commit bed5257
Show file tree
Hide file tree
Showing 91 changed files with 1,651 additions and 388 deletions.
2 changes: 1 addition & 1 deletion .ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# NOTE: This Dockerfile is ONLY used to run certain tasks in CI. It is not used to run Kibana or as a distributable.
# If you're looking for the Kibana Docker image distributable, please see: src/dev/build/tasks/os_packages/docker_generator/templates/dockerfile.template.ts

ARG NODE_VERSION=14.17.5
ARG NODE_VERSION=14.17.6

FROM node:${NODE_VERSION} AS base

Expand Down
1 change: 1 addition & 0 deletions .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"paths": {
"alerts": "packages/kbn-alerts/src",
"autocomplete": "packages/kbn-securitysolution-autocomplete/src",
"kbnConfig": "packages/kbn-config/src",
"console": "src/plugins/console",
"core": "src/core",
"discover": "src/plugins/discover",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface DeprecationsDetails
| [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. |
| [message](./kibana-plugin-core-server.deprecationsdetails.message.md) | <code>string</code> | |
| [message](./kibana-plugin-core-server.deprecationsdetails.message.md) | <code>string</code> | The description message to be displayed for the deprecation. Check the README for writing deprecations in <code>src/core/server/deprecations/README.mdx</code> |
| [requireRestart](./kibana-plugin-core-server.deprecationsdetails.requirerestart.md) | <code>boolean</code> | |
| [title](./kibana-plugin-core-server.deprecationsdetails.title.md) | <code>string</code> | The title of the deprecation. Check the README for writing deprecations in <code>src/core/server/deprecations/README.mdx</code> |

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

## DeprecationsDetails.message property

The description message to be displayed for the deprecation. Check the README for writing deprecations in `src/core/server/deprecations/README.mdx`

<b>Signature:</b>

```typescript
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [DeprecationsDetails](./kibana-plugin-core-server.deprecationsdetails.md) &gt; [title](./kibana-plugin-core-server.deprecationsdetails.title.md)

## DeprecationsDetails.title property

The title of the deprecation. Check the README for writing deprecations in `src/core/server/deprecations/README.mdx`

<b>Signature:</b>

```typescript
title: string;
```
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface DeprecationsServiceSetup

```ts
import { DeprecationsDetails, GetDeprecationsContext, CoreSetup } from 'src/core/server';
import { i18n } from '@kbn/i18n';

async function getDeprecations({ esClient, savedObjectsClient }: GetDeprecationsContext): Promise<DeprecationsDetails[]> {
const deprecations: DeprecationsDetails[] = [];
Expand All @@ -29,52 +30,44 @@ async function getDeprecations({ esClient, savedObjectsClient }: GetDeprecations
if (count > 0) {
// Example of a manual correctiveAction
deprecations.push({
message: `You have ${count} Timelion worksheets. The Timelion app will be removed in 8.0. To continue using your Timelion worksheets, migrate them to a dashboard.`,
title: i18n.translate('xpack.timelion.deprecations.worksheetsTitle', {
defaultMessage: 'Found Timelion worksheets.'
}),
message: i18n.translate('xpack.timelion.deprecations.worksheetsMessage', {
defaultMessage: 'You have {count} Timelion worksheets. The Timelion app will be removed in 8.0. To continue using your Timelion worksheets, migrate them to a dashboard.',
values: { count },
}),
documentationUrl:
'https://www.elastic.co/guide/en/kibana/current/create-panels-with-timelion.html',
level: 'warning',
correctiveActions: {
manualSteps: [
'Navigate to the Kibana Dashboard and click "Create dashboard".',
'Select Timelion from the "New Visualization" window.',
'Open a new tab, open the Timelion app, select the chart you want to copy, then copy the chart expression.',
'Go to Timelion, paste the chart expression in the Timelion expression field, then click Update.',
'In the toolbar, click Save.',
'On the Save visualization window, enter the visualization Title, then click Save and return.',
i18n.translate('xpack.timelion.deprecations.worksheets.manualStepOneMessage', {
defaultMessage: 'Navigate to the Kibana Dashboard and click "Create dashboard".',
}),
i18n.translate('xpack.timelion.deprecations.worksheets.manualStepTwoMessage', {
defaultMessage: 'Select Timelion from the "New Visualization" window.',
}),
],
api: {
path: '/internal/security/users/test_dashboard_user',
method: 'POST',
body: {
username: 'test_dashboard_user',
roles: [
"machine_learning_user",
"enrich_user",
"kibana_admin"
],
full_name: "Alison Goryachev",
email: "alisongoryachev@gmail.com",
metadata: {},
enabled: true
}
},
},
});
}

// Example of an api correctiveAction
deprecations.push({
"message": "User 'test_dashboard_user' is using a deprecated role: 'kibana_user'",
"documentationUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-user.html",
"level": "critical",
"correctiveActions": {
"api": {
"path": "/internal/security/users/test_dashboard_user",
"method": "POST",
"body": {
"username": "test_dashboard_user",
"roles": [
"machine_learning_user",
"enrich_user",
"kibana_admin"
],
"full_name": "Alison Goryachev",
"email": "alisongoryachev@gmail.com",
"metadata": {},
"enabled": true
}
},
"manualSteps": [
"Using Kibana user management, change all users using the kibana_user role to the kibana_admin role.",
"Using Kibana role-mapping management, change all role-mappings which assing the kibana_user role to the kibana_admin role."
]
},
});

return deprecations;
}

Expand Down
5 changes: 4 additions & 1 deletion docs/setup/settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,10 @@ override this parameter to use their own Tile Map Service. For example:
`"https://tiles.elastic.co/v2/default/{z}/{x}/{y}.png?elastic_tile_service_tos=agree&my_app_name=kibana"`

| `migrations.batchSize:`
| Defines the number of documents migrated at a time. The higher the value, the faster the Saved Objects migration process performs at the cost of higher memory consumption. If the migration fails due to a `circuit_breaking_exception`, set a smaller `batchSize` value. *Default: `1000`*
| Defines the number of documents migrated at a time. The higher the value, the faster the Saved Objects migration process performs at the cost of higher memory consumption. If upgrade migrations results in {kib} crashing with an out of memory exception or fails due to an Elasticsearch `circuit_breaking_exception`, use a smaller `batchSize` value to reduce the memory pressure. *Default: `1000`*

| `migrations.maxBatchSizeBytes:`
| Defines the maximum payload size for indexing batches of upgraded saved objects to avoid migrations failing due to a 413 Request Entity Too Large response from Elasticsearch. This value should be lower than or equal to your Elasticsearch cluster's `http.max_content_length` configuration option. *Default: `100mb`*

| `migrations.enableV2:`
| experimental[]. Enables the new Saved Objects migration algorithm. For information about the migration algorithm, refer to <<upgrade-migrations>>. When `migrations v2` is stable, the setting will be removed in an upcoming release without any further notice. Setting the value to `false` causes {kib} to use the legacy migration algorithm, which shipped in 7.11 and earlier versions. *Default: `true`*
Expand Down
2 changes: 2 additions & 0 deletions packages/kbn-config/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ RUNTIME_DEPS = [
"//packages/kbn-logging",
"//packages/kbn-std",
"//packages/kbn-utility-types",
"//packages/kbn-i18n",
"@npm//js-yaml",
"@npm//load-json-file",
"@npm//lodash",
Expand All @@ -48,6 +49,7 @@ TYPES_DEPS = [
"//packages/kbn-logging",
"//packages/kbn-std",
"//packages/kbn-utility-types",
"//packages/kbn-i18n",
"@npm//load-json-file",
"@npm//rxjs",
"@npm//@types/jest",
Expand Down
33 changes: 21 additions & 12 deletions packages/kbn-config/src/deprecation/deprecation_factory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ describe('DeprecationFactory', () => {
"Replace \\"myplugin.deprecated\\" with \\"myplugin.renamed\\" in the Kibana config file, CLI flag, or environment variable (in Docker only).",
],
},
"message": "\\"myplugin.deprecated\\" is deprecated and has been replaced by \\"myplugin.renamed\\"",
"message": "Setting \\"myplugin.deprecated\\" has been replaced by \\"myplugin.renamed\\"",
"title": "Setting \\"myplugin.deprecated\\" is deprecated",
},
],
]
Expand Down Expand Up @@ -103,7 +104,8 @@ describe('DeprecationFactory', () => {
"Replace \\"myplugin.oldsection.deprecated\\" with \\"myplugin.newsection.renamed\\" in the Kibana config file, CLI flag, or environment variable (in Docker only).",
],
},
"message": "\\"myplugin.oldsection.deprecated\\" is deprecated and has been replaced by \\"myplugin.newsection.renamed\\"",
"message": "Setting \\"myplugin.oldsection.deprecated\\" has been replaced by \\"myplugin.newsection.renamed\\"",
"title": "Setting \\"myplugin.oldsection.deprecated\\" is deprecated",
},
],
]
Expand All @@ -130,7 +132,8 @@ describe('DeprecationFactory', () => {
"Remove \\"myplugin.deprecated\\" from the config.",
],
},
"message": "\\"myplugin.deprecated\\" is deprecated and has been replaced by \\"myplugin.renamed\\". However both key 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",
},
],
]
Expand Down Expand Up @@ -172,7 +175,8 @@ describe('DeprecationFactory', () => {
"Replace \\"myplugin.deprecated\\" with \\"myplugin.renamed\\" in the Kibana config file, CLI flag, or environment variable (in Docker only).",
],
},
"message": "\\"myplugin.deprecated\\" is deprecated and has been replaced by \\"myplugin.renamed\\"",
"message": "Setting \\"myplugin.deprecated\\" has been replaced by \\"myplugin.renamed\\"",
"title": "Setting \\"myplugin.deprecated\\" is deprecated",
},
],
]
Expand Down Expand Up @@ -212,7 +216,8 @@ describe('DeprecationFactory', () => {
"Replace \\"oldplugin.deprecated\\" with \\"newplugin.renamed\\" in the Kibana config file, CLI flag, or environment variable (in Docker only).",
],
},
"message": "\\"oldplugin.deprecated\\" is deprecated and has been replaced by \\"newplugin.renamed\\"",
"message": "Setting \\"oldplugin.deprecated\\" has been replaced by \\"newplugin.renamed\\"",
"title": "Setting \\"oldplugin.deprecated\\" is deprecated",
},
],
]
Expand Down Expand Up @@ -264,7 +269,8 @@ describe('DeprecationFactory', () => {
"Remove \\"myplugin.deprecated\\" from the config.",
],
},
"message": "\\"myplugin.deprecated\\" is deprecated and has been replaced by \\"myplugin.renamed\\". However both key 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",
},
],
]
Expand Down Expand Up @@ -293,10 +299,11 @@ describe('DeprecationFactory', () => {
Object {
"correctiveActions": Object {
"manualSteps": Array [
"Remove \\"myplugin.deprecated\\" from the Kibana config file, CLI flag, or environment variable (in Docker only)",
"Remove \\"myplugin.deprecated\\" from the Kibana config file, CLI flag, or environment variable (in Docker only).",
],
},
"message": "myplugin.deprecated is deprecated and is no longer used",
"message": "You no longer need to configure \\"myplugin.deprecated\\".",
"title": "Setting \\"myplugin.deprecated\\" is deprecated",
},
],
]
Expand Down Expand Up @@ -325,10 +332,11 @@ describe('DeprecationFactory', () => {
Object {
"correctiveActions": Object {
"manualSteps": Array [
"Remove \\"myplugin.section.deprecated\\" from the Kibana config file, CLI flag, or environment variable (in Docker only)",
"Remove \\"myplugin.section.deprecated\\" from the Kibana config file, CLI flag, or environment variable (in Docker only).",
],
},
"message": "myplugin.section.deprecated is deprecated and is no longer used",
"message": "You no longer need to configure \\"myplugin.section.deprecated\\".",
"title": "Setting \\"myplugin.section.deprecated\\" is deprecated",
},
],
]
Expand Down Expand Up @@ -375,10 +383,11 @@ describe('DeprecationFactory', () => {
Object {
"correctiveActions": Object {
"manualSteps": Array [
"Remove \\"myplugin.deprecated\\" from the Kibana config file, CLI flag, or environment variable (in Docker only)",
"Remove \\"myplugin.deprecated\\" from the Kibana config file, CLI flag, or environment variable (in Docker only).",
],
},
"message": "myplugin.deprecated is deprecated and is no longer used",
"message": "You no longer need to configure \\"myplugin.deprecated\\".",
"title": "Setting \\"myplugin.deprecated\\" is deprecated",
},
],
]
Expand Down
51 changes: 44 additions & 7 deletions packages/kbn-config/src/deprecation/deprecation_factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
*/

import { get } from 'lodash';
import { i18n } from '@kbn/i18n';

import {
ConfigDeprecation,
AddConfigDeprecation,
Expand All @@ -15,6 +17,13 @@ import {
ConfigDeprecationCommand,
} from './types';

const getDeprecationTitle = (deprecationPath: string) => {
return i18n.translate('kbnConfig.deprecations.deprecatedSettingTitle', {
defaultMessage: 'Setting "{deprecationPath}" is deprecated',
values: { deprecationPath },
});
};

const _rename = (
config: Record<string, any>,
rootPath: string,
Expand All @@ -33,10 +42,18 @@ const _rename = (
const newValue = get(config, fullNewPath);
if (newValue === undefined) {
addDeprecation({
message: `"${fullOldPath}" is deprecated and has been replaced by "${fullNewPath}"`,
title: getDeprecationTitle(fullOldPath),
message: i18n.translate('kbnConfig.deprecations.replacedSettingMessage', {
defaultMessage: `Setting "{fullOldPath}" has been replaced by "{fullNewPath}"`,
values: { fullOldPath, fullNewPath },
}),
correctiveActions: {
manualSteps: [
`Replace "${fullOldPath}" with "${fullNewPath}" in the Kibana config file, CLI flag, or environment variable (in Docker only).`,
i18n.translate('kbnConfig.deprecations.replacedSetting.manualStepOneMessage', {
defaultMessage:
'Replace "{fullOldPath}" with "{fullNewPath}" in the Kibana config file, CLI flag, or environment variable (in Docker only).',
values: { fullOldPath, fullNewPath },
}),
],
},
...details,
Expand All @@ -47,11 +64,23 @@ const _rename = (
};
} else {
addDeprecation({
message: `"${fullOldPath}" is deprecated and has been replaced by "${fullNewPath}". However both key are present, ignoring "${fullOldPath}"`,
title: getDeprecationTitle(fullOldPath),
message: i18n.translate('kbnConfig.deprecations.conflictSettingMessage', {
defaultMessage:
'Setting "${fullOldPath}" has been replaced by "${fullNewPath}". However, both keys are present. Ignoring "${fullOldPath}"',
values: { fullOldPath, fullNewPath },
}),
correctiveActions: {
manualSteps: [
`Make sure "${fullNewPath}" contains the correct value in the config file, CLI flag, or environment variable (in Docker only).`,
`Remove "${fullOldPath}" from the config.`,
i18n.translate('kbnConfig.deprecations.conflictSetting.manualStepOneMessage', {
defaultMessage:
'Make sure "{fullNewPath}" contains the correct value in the config file, CLI flag, or environment variable (in Docker only).',
values: { fullNewPath },
}),
i18n.translate('kbnConfig.deprecations.conflictSetting.manualStepTwoMessage', {
defaultMessage: 'Remove "{fullOldPath}" from the config.',
values: { fullOldPath },
}),
],
},
...details,
Expand All @@ -75,10 +104,18 @@ const _unused = (
return;
}
addDeprecation({
message: `${fullPath} is deprecated and is no longer used`,
title: getDeprecationTitle(fullPath),
message: i18n.translate('kbnConfig.deprecations.unusedSettingMessage', {
defaultMessage: 'You no longer need to configure "{fullPath}".',
values: { fullPath },
}),
correctiveActions: {
manualSteps: [
`Remove "${fullPath}" from the Kibana config file, CLI flag, or environment variable (in Docker only)`,
i18n.translate('kbnConfig.deprecations.unusedSetting.manualStepOneMessage', {
defaultMessage:
'Remove "{fullPath}" from the Kibana config file, CLI flag, or environment variable (in Docker only).',
values: { fullPath },
}),
],
},
...details,
Expand Down
2 changes: 2 additions & 0 deletions packages/kbn-config/src/deprecation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export type AddConfigDeprecation = (details: DeprecatedConfigDetails) => void;
* @public
*/
export interface DeprecatedConfigDetails {
/* The title to be displayed for the deprecation. */
title?: string;
/* The message to be displayed for the deprecation. */
message: string;
/* (optional) set false to prevent the config service from logging the deprecation message. */
Expand Down
Loading

0 comments on commit bed5257

Please sign in to comment.