Skip to content

Commit

Permalink
[8.8] Refactor KibanaMigrator, improve readability, maintainability a…
Browse files Browse the repository at this point in the history
…nd UT (#155693) (#158953)

# Backport

This will backport the following commits from `main` to `8.8`:
- [Refactor KibanaMigrator, improve readability, maintainability and UT
(#155693)](#155693)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Gerard
Soldevila","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-06-01T12:47:40Z","message":"Refactor
KibanaMigrator, improve readability, maintainability and UT
(#155693)\n\nAddresses the following
feedback:\r\nhttps://github.com//pull/154151#discussion_r1158470566\r\n\r\nSimilar
to what has been done for ZDT, the goal of this PR is to extract\r\nthe
logic of the `runV2Migration()` from the `KibanaMigrator` into
a\r\nseparate file.\r\n\r\nThe PR also fixes some incomplete / incorrect
UTs and adds a few
missing\r\nones.","sha":"06c337f903a5b310f8a21a66065b186bbbc9642e","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","enhancement","technical
debt","release_note:skip","backport:skip","Feature:Migrations","Epic:KBNA-7838","v8.9.0"],"number":155693,"url":"https://github.com/elastic/kibana/pull/155693","mergeCommit":{"message":"Refactor
KibanaMigrator, improve readability, maintainability and UT
(#155693)\n\nAddresses the following
feedback:\r\nhttps://github.com//pull/154151#discussion_r1158470566\r\n\r\nSimilar
to what has been done for ZDT, the goal of this PR is to extract\r\nthe
logic of the `runV2Migration()` from the `KibanaMigrator` into
a\r\nseparate file.\r\n\r\nThe PR also fixes some incomplete / incorrect
UTs and adds a few
missing\r\nones.","sha":"06c337f903a5b310f8a21a66065b186bbbc9642e"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/155693","number":155693,"mergeCommit":{"message":"Refactor
KibanaMigrator, improve readability, maintainability and UT
(#155693)\n\nAddresses the following
feedback:\r\nhttps://github.com//pull/154151#discussion_r1158470566\r\n\r\nSimilar
to what has been done for ZDT, the goal of this PR is to extract\r\nthe
logic of the `runV2Migration()` from the `KibanaMigrator` into
a\r\nseparate file.\r\n\r\nThe PR also fixes some incomplete / incorrect
UTs and adds a few
missing\r\nones.","sha":"06c337f903a5b310f8a21a66065b186bbbc9642e"}}]}]
BACKPORT-->

---------

Co-authored-by: kibanamachine <[email protected]>
  • Loading branch information
gsoldevila and kibanamachine authored Jun 3, 2023
1 parent 3204330 commit a82751c
Show file tree
Hide file tree
Showing 20 changed files with 1,010 additions and 726 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const retryCallCluster = <T extends Promise<unknown>>(apiCaller: () => T)
* Retries the provided Elasticsearch API call when an error such as
* `AuthenticationException` `NoConnections`, `ConnectionFault`,
* `ServiceUnavailable` or `RequestTimeout` are encountered. The API call will
* be retried once a second, indefinitely, until a successful response or a
* be retried once every `delay` millis, indefinitely, until a successful response or a
* different error is received.
*
* @example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Side Public License, v 1.
*/

export { DEFAULT_INDEX_TYPES_MAP } from './src/constants';
export { LEGACY_URL_ALIAS_TYPE, type LegacyUrlAlias } from './src/legacy_alias';
export {
getProperty,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { IndexTypesMap } from './mappings';

/**
* This map holds the default breakdown of SO types per index (pre 8.8.0)
*/
export const DEFAULT_INDEX_TYPES_MAP: IndexTypesMap = {
'.kibana_task_manager': ['task'],
'.kibana': [
'action',
'action_task_params',
'alert',
'api_key_pending_invalidation',
'apm-indices',
'apm-server-schema',
'apm-service-group',
'apm-telemetry',
'app_search_telemetry',
'application_usage_daily',
'application_usage_totals',
'book',
'canvas-element',
'canvas-workpad',
'canvas-workpad-template',
'cases',
'cases-comments',
'cases-configure',
'cases-connector-mappings',
'cases-telemetry',
'cases-user-actions',
'config',
'config-global',
'connector_token',
'core-usage-stats',
'csp-rule-template',
'dashboard',
'endpoint:user-artifact-manifest',
'enterprise_search_telemetry',
'epm-packages',
'epm-packages-assets',
'event_loop_delays_daily',
'exception-list',
'exception-list-agnostic',
'file',
'file-upload-usage-collection-telemetry',
'fileShare',
'fleet-fleet-server-host',
'fleet-message-signing-keys',
'fleet-preconfiguration-deletion-record',
'fleet-proxy',
'graph-workspace',
'guided-onboarding-guide-state',
'guided-onboarding-plugin-state',
'index-pattern',
'infrastructure-monitoring-log-view',
'infrastructure-ui-source',
'ingest-agent-policies',
'ingest-download-sources',
'ingest-outputs',
'ingest-package-policies',
'ingest_manager_settings',
'inventory-view',
'kql-telemetry',
'legacy-url-alias',
'lens',
'lens-ui-telemetry',
'map',
'metrics-explorer-view',
'ml-job',
'ml-module',
'ml-trained-model',
'monitoring-telemetry',
'osquery-manager-usage-metric',
'osquery-pack',
'osquery-pack-asset',
'osquery-saved-query',
'query',
'rules-settings',
'sample-data-telemetry',
'search',
'search-session',
'search-telemetry',
'searchableList',
'security-rule',
'security-solution-signals-migration',
'siem-detection-engine-rule-actions',
'siem-ui-timeline',
'siem-ui-timeline-note',
'siem-ui-timeline-pinned-event',
'slo',
'space',
'spaces-usage-stats',
'synthetics-monitor',
'synthetics-param',
'synthetics-privates-locations',
'tag',
'telemetry',
'todo',
'ui-metric',
'upgrade-assistant-ml-upgrade-operation',
'upgrade-assistant-reindex-operation',
'uptime-dynamic-settings',
'uptime-synthetics-api-key',
'url',
'usage-counters',
'visualization',
'workplace_search_telemetry',
],
};
Loading

0 comments on commit a82751c

Please sign in to comment.