Remove ability to configure index (#114558)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Chris Roberson 2021-10-25 19:10:03 -04:00 committed by GitHub
parent 436c74a9ce
commit 6d6cb5c836
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 14 additions and 51 deletions

View file

@ -76,7 +76,6 @@ If many other users will be interacting with your remote cluster, you'll want to
[source,bash]
----
kibana.index: '.{YourGitHubHandle}-kibana'
xpack.task_manager.index: '.{YourGitHubHandle}-task-manager-kibana'
----
==== Running remote clusters

View file

@ -22,9 +22,6 @@ Task Manager runs background tasks by polling for work on an interval. You can
| `xpack.task_manager.request_capacity`
| How many requests can Task Manager buffer before it rejects new requests. Defaults to 1000.
| `xpack.task_manager.index`
| The name of the index used to store task information. Defaults to `.kibana_task_manager`.
| `xpack.task_manager.max_workers`
| The maximum number of tasks that this Kibana instance will run simultaneously. Defaults to 10.
Starting in 8.0, it will not be possible to set the value greater than 100.

View file

@ -12,7 +12,7 @@ This has three major benefits:
[IMPORTANT]
==============================================
Task definitions for alerts and actions are stored in the index specified by <<task-manager-settings, `xpack.task_manager.index`>>. The default is `.kibana_task_manager`.
Task definitions for alerts and actions are stored in the index called `.kibana_task_manager`.
You must have at least one replica of this index for production deployments.

View file

@ -365,7 +365,6 @@ kibana_vars=(
xpack.securitySolution.prebuiltRulesFromFileSystem
xpack.securitySolution.prebuiltRulesFromSavedObjects
xpack.spaces.maxSpaces
xpack.task_manager.index
xpack.task_manager.max_attempts
xpack.task_manager.max_poll_inactivity_cycles
xpack.task_manager.max_workers

View file

@ -16,7 +16,6 @@ describe('config validation', () => {
"enabled": false,
"request_capacity": 10,
},
"index": ".kibana_task_manager",
"max_attempts": 3,
"max_poll_inactivity_cycles": 10,
"max_workers": 10,
@ -44,17 +43,6 @@ describe('config validation', () => {
`);
});
test('the ElastiSearch Tasks index cannot be used for task manager', () => {
const config: Record<string, unknown> = {
index: '.tasks',
};
expect(() => {
configSchema.validate(config);
}).toThrowErrorMatchingInlineSnapshot(
`"[index]: \\".tasks\\" is an invalid Kibana Task Manager index, as it is already in use by the ElasticSearch Tasks Manager"`
);
});
test('the required freshness of the monitored stats config must always be less-than-equal to the poll interval', () => {
const config: Record<string, unknown> = {
monitored_stats_required_freshness: 100,
@ -74,7 +62,6 @@ describe('config validation', () => {
"enabled": false,
"request_capacity": 10,
},
"index": ".kibana_task_manager",
"max_attempts": 3,
"max_poll_inactivity_cycles": 10,
"max_workers": 10,
@ -119,7 +106,6 @@ describe('config validation', () => {
"enabled": false,
"request_capacity": 10,
},
"index": ".kibana_task_manager",
"max_attempts": 3,
"max_poll_inactivity_cycles": 10,
"max_workers": 10,

View file

@ -64,15 +64,6 @@ export const configSchema = schema.object(
defaultValue: 1000,
min: 1,
}),
/* The name of the index used to store task information. */
index: schema.string({
defaultValue: '.kibana_task_manager',
validate: (val) => {
if (val.toLowerCase() === '.tasks') {
return `"${val}" is an invalid Kibana Task Manager index, as it is already in use by the ElasticSearch Tasks Manager`;
}
},
}),
/* The maximum number of tasks that this Kibana instance will run simultaneously. */
max_workers: schema.number({
defaultValue: DEFAULT_MAX_WORKERS,

View file

@ -0,0 +1,7 @@
/*
* 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; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
export const TASK_MANAGER_INDEX = '.kibana_task_manager';

View file

@ -43,7 +43,6 @@ describe('EphemeralTaskLifecycle', () => {
executionContext,
config: {
max_workers: 10,
index: 'foo',
max_attempts: 9,
poll_interval: 6000000,
version_conflict_threshold: 80,

View file

@ -37,17 +37,6 @@ const applyTaskManagerDeprecations = (settings: Record<string, unknown> = {}) =>
};
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",
]
`);
});
});
it('logs a warning if max_workers is over limit', () => {
const { messages } = applyTaskManagerDeprecations({ max_workers: 1000 });
expect(messages).toMatchInlineSnapshot(`

View file

@ -30,7 +30,6 @@ describe('managed configuration', () => {
const context = coreMock.createPluginInitializerContext<TaskManagerConfig>({
max_workers: 10,
index: 'foo',
max_attempts: 9,
poll_interval: 3000,
version_conflict_threshold: 80,

View file

@ -14,7 +14,6 @@ describe('Configuration Statistics Aggregator', () => {
test('merges the static config with the merged configs', async () => {
const configuration: TaskManagerConfig = {
max_workers: 10,
index: 'foo',
max_attempts: 9,
poll_interval: 6000000,
version_conflict_threshold: 80,

View file

@ -18,7 +18,6 @@ beforeEach(() => {
describe('createMonitoringStatsStream', () => {
const configuration: TaskManagerConfig = {
max_workers: 10,
index: 'foo',
max_attempts: 9,
poll_interval: 6000000,
version_conflict_threshold: 80,

View file

@ -17,7 +17,6 @@ describe('TaskManagerPlugin', () => {
test('throws if no valid UUID is available', async () => {
const pluginInitializerContext = coreMock.createPluginInitializerContext<TaskManagerConfig>({
max_workers: 10,
index: 'foo',
max_attempts: 9,
poll_interval: 3000,
version_conflict_threshold: 80,
@ -59,7 +58,6 @@ describe('TaskManagerPlugin', () => {
test('throws if setup methods are called after start', async () => {
const pluginInitializerContext = coreMock.createPluginInitializerContext<TaskManagerConfig>({
max_workers: 10,
index: 'foo',
max_attempts: 9,
poll_interval: 3000,
version_conflict_threshold: 80,
@ -130,7 +128,6 @@ describe('TaskManagerPlugin', () => {
test('it logs a warning when the unsafe `exclude_task_types` config is used', async () => {
const pluginInitializerContext = coreMock.createPluginInitializerContext<TaskManagerConfig>({
max_workers: 10,
index: 'foo',
max_attempts: 9,
poll_interval: 3000,
version_conflict_threshold: 80,

View file

@ -31,6 +31,7 @@ import { createMonitoringStats, MonitoringStats } from './monitoring';
import { EphemeralTaskLifecycle } from './ephemeral_task_lifecycle';
import { EphemeralTask } from './task';
import { registerTaskManagerUsageCollector } from './usage';
import { TASK_MANAGER_INDEX } from './constants';
export interface TaskManagerSetupContract {
/**
@ -135,7 +136,7 @@ export class TaskManagerPlugin
}
return {
index: this.config.index,
index: TASK_MANAGER_INDEX,
addMiddleware: (middleware: Middleware) => {
this.assertStillInSetup('add Middleware');
this.middleware = addMiddlewareToChain(this.middleware, middleware);
@ -159,7 +160,7 @@ export class TaskManagerPlugin
serializer,
savedObjectsRepository,
esClient: elasticsearch.createClient('taskManager').asInternalUser,
index: this.config!.index,
index: TASK_MANAGER_INDEX,
definitions: this.definitions,
taskManagerId: `kibana:${this.taskManagerId!}`,
});

View file

@ -11,6 +11,7 @@ import mappings from './mappings.json';
import { getMigrations } from './migrations';
import { TaskManagerConfig } from '../config.js';
import { getOldestIdleActionTask } from '../queries/oldest_idle_action_task';
import { TASK_MANAGER_INDEX } from '../constants';
export function setupSavedObjects(
savedObjects: SavedObjectsServiceSetup,
@ -23,11 +24,11 @@ export function setupSavedObjects(
convertToAliasScript: `ctx._id = ctx._source.type + ':' + ctx._id; ctx._source.remove("kibana")`,
mappings: mappings.task as SavedObjectsTypeMappingDefinition,
migrations: getMigrations(),
indexPattern: config.index,
indexPattern: TASK_MANAGER_INDEX,
excludeOnUpgrade: async ({ readonlyEsClient }) => {
const oldestNeededActionParams = await getOldestIdleActionTask(
readonlyEsClient,
config.index
TASK_MANAGER_INDEX
);
// Delete all action tasks that have failed and are no longer needed