Deprecate xpack.task_manager.index
setting (#84155)
* Deprecate `xpack.task_manager.index` setting * Updating developer docs about configuring task manager settings
This commit is contained in:
parent
b3430e3f09
commit
58297fa131
|
@ -43,7 +43,7 @@ The task_manager can be configured via `taskManager` config options (e.g. `taskM
|
|||
- `max_attempts` - The maximum number of times a task will be attempted before being abandoned as failed
|
||||
- `poll_interval` - How often the background worker should check the task_manager index for more work
|
||||
- `max_poll_inactivity_cycles` - How many poll intervals is work allowed to block polling for before it's timed out. This does not include task execution, as task execution does not block the polling, but rather includes work needed to manage Task Manager's state.
|
||||
- `index` - The name of the index that the task_manager
|
||||
- `index` - **deprecated** The name of the index that the task_manager will use. This is deprecated, and will be removed starting in 8.0
|
||||
- `max_workers` - The maximum number of tasks a Kibana will run concurrently (defaults to 10)
|
||||
- `credentials` - Encrypted user credentials. All tasks will run in the security context of this user. See [this issue](https://github.com/elastic/dev/issues/1045) for a discussion on task scheduler security.
|
||||
- `override_num_workers`: An object of `taskType: number` that overrides the `num_workers` for tasks
|
||||
|
|
43
x-pack/plugins/task_manager/server/index.test.ts
Normal file
43
x-pack/plugins/task_manager/server/index.test.ts
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* 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.task_manager';
|
||||
|
||||
const applyTaskManagerDeprecations = (settings: Record<string, unknown> = {}) => {
|
||||
const deprecations = config.deprecations!(configDeprecationFactory);
|
||||
const deprecationMessages: string[] = [];
|
||||
const _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', '.kibana_task_manager'].forEach((index) => {
|
||||
it('logs a warning if index is set', () => {
|
||||
const { messages } = applyTaskManagerDeprecations({ index });
|
||||
expect(messages).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
"\\"xpack.task_manager.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",
|
||||
]
|
||||
`);
|
||||
});
|
||||
});
|
||||
});
|
|
@ -4,9 +4,10 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { PluginInitializerContext } from 'src/core/server';
|
||||
import { get } from 'lodash';
|
||||
import { PluginConfigDescriptor, PluginInitializerContext } from 'src/core/server';
|
||||
import { TaskManagerPlugin } from './plugin';
|
||||
import { configSchema } from './config';
|
||||
import { configSchema, TaskManagerConfig } from './config';
|
||||
|
||||
export const plugin = (initContext: PluginInitializerContext) => new TaskManagerPlugin(initContext);
|
||||
|
||||
|
@ -26,6 +27,17 @@ export {
|
|||
TaskManagerStartContract,
|
||||
} from './plugin';
|
||||
|
||||
export const config = {
|
||||
export const config: PluginConfigDescriptor<TaskManagerConfig> = {
|
||||
schema: configSchema,
|
||||
deprecations: () => [
|
||||
(settings, fromPath, log) => {
|
||||
const taskManager = get(settings, fromPath);
|
||||
if (taskManager?.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;
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue