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

Deprecate reporting.index setting #84005

Merged
merged 7 commits into from
Dec 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/settings/reporting-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,9 @@ For information about {kib} memory limits, see <<production, using {kib} in a pr
[cols="2*<"]
|===
| `xpack.reporting.index`
| Reporting uses a weekly index in {es} to store the reporting job and
| *deprecated* This setting is deprecated and will be removed in 8.0. Multitenancy by changing
`kibana.index` will not be supported starting in 8.0. See https://ela.st/kbn-remove-legacy-multitenancy[8.0 Breaking Changes]
for more details. Reporting uses a weekly index in {es} to store the reporting job and
the report content. The index is automatically created if it does not already
exist. Configure this to a unique value, beginning with `.reporting-`, for every
{kib} instance that has a unique <<kibana-index, `kibana.index`>> setting. Defaults to `.reporting`.
Expand Down
42 changes: 42 additions & 0 deletions x-pack/plugins/reporting/server/config/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { config } from './index';
import { applyDeprecations, configDeprecationFactory } from '@kbn/config';

const CONFIG_PATH = 'xpack.reporting';

const applyReportingDeprecations = (settings: Record<string, any> = {}) => {
const deprecations = config.deprecations!(configDeprecationFactory);
const deprecationMessages: string[] = [];
const _config: any = {};
_config[CONFIG_PATH] = settings;
const migrated = applyDeprecations(
_config,
deprecations.map((deprecation) => ({
deprecation,
path: CONFIG_PATH,
})),
(msg) => deprecationMessages.push(msg)
);
return {
messages: deprecationMessages,
migrated,
};
};

describe('deprecations', () => {
['.foo', '.reporting'].forEach((index) => {
it('logs a warning if index is set', () => {
const { messages } = applyReportingDeprecations({ index });
expect(messages).toMatchInlineSnapshot(`
Array [
"\\"xpack.reporting.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",
]
`);
});
});
});
10 changes: 10 additions & 0 deletions x-pack/plugins/reporting/server/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { get } from 'lodash';
import { PluginConfigDescriptor } from 'kibana/server';
import { ConfigSchema, ReportingConfigType } from './schema';
export { buildConfig } from './config';
Expand All @@ -20,5 +21,14 @@ export const config: PluginConfigDescriptor<ReportingConfigType> = {
unused('poll.jobCompletionNotifier.intervalErrorMultiplier'),
unused('poll.jobsRefresh.intervalErrorMultiplier'),
unused('kibanaApp'),
(settings, fromPath, log) => {
const reporting = get(settings, fromPath);
if (reporting?.index) {
log(
`"${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`
);
}
return settings;
},
],
};