Skip to content

Commit

Permalink
[8.17] [UA] Support Deprecated Data Streams Migrations (elastic#202204)…
Browse files Browse the repository at this point in the history
… (elastic#202601)

# Backport

This will backport the following commits from `main` to `8.17`:
- [[UA] Support Deprecated Data Streams Migrations
(elastic#202204)](elastic#202204)

<!--- Backport version: 8.9.8 -->

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

<!--BACKPORT [{"author":{"name":"Ahmad
Bamieh","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-12-02T21:53:24Z","message":"[UA]
Support Deprecated Data Streams Migrations (elastic#202204)\n\n##
Summary\r\n\r\n- [x] Fix UA currently failing to return upgrade
status\r\n- [x] Support surfacing `data_streams` migrations in UA under
the ES tab\r\n- [x] Refactor code for better readablity\r\n- [x] Add
more test cases across the board for all the es migrations\r\nstatus
feature in UA\r\n- [x] Add a `featureSet.migrateDataStreams` to enable
surfacing data\r\nstreams migrations\r\n- [x] Surface data streams in UA
UI\r\n- [x] Take screenshots for a product review discussions\r\n- [x]
Unskip api_integration test cases\r\n\r\n### Imporant Notes\r\n\r\nES
deprecations are hidden behind the `featureSet` flag and will only
be\r\nshown in `8.last` for users.\r\nThis gives us time to review the
copy and implement the corrective\r\naction for reindexing data streams
which is still pending implementaiton\r\nfrom ES side.\r\n\r\nFor now we
will merge this to unblock upgrades in `8.17` and support\r\nsurfacing
data_streams deprecations and add tests.\r\n\r\nFollow up work for
`8.18`\r\n- Add integration Tests\r\n- Update copy of flyout and
documentation link\r\n- Reindexing data streams corrective
action\r\n\r\ncloses
https://github.com/elastic/kibana-team/issues/1293\r\n\r\n##
Screenshots\r\n\r\n#### Overview Page\r\n<img width=\"683\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/246d89ac-02cd-4813-ba38-e2e28df00c8d\">\r\n\r\n####
Elasticsearch deprecation issues Page\r\n\r\n<img width=\"1453\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/b5fd5f15-fa44-4acb-b7ff-4973593dcfbb\">\r\n\r\n\r\n####
Data streams deprecation details flyout\r\n<img width=\"778\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/af343f69-7e76-4c91-a6e3-cff29e26df59\">\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"a6b3743e00add07c315eacadda4d0dbb532042ac","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","auto-backport","backport:prev-minor","backport:version","v8.17.0","v8.18.0"],"number":202204,"url":"https://github.com/elastic/kibana/pull/202204","mergeCommit":{"message":"[UA]
Support Deprecated Data Streams Migrations (elastic#202204)\n\n##
Summary\r\n\r\n- [x] Fix UA currently failing to return upgrade
status\r\n- [x] Support surfacing `data_streams` migrations in UA under
the ES tab\r\n- [x] Refactor code for better readablity\r\n- [x] Add
more test cases across the board for all the es migrations\r\nstatus
feature in UA\r\n- [x] Add a `featureSet.migrateDataStreams` to enable
surfacing data\r\nstreams migrations\r\n- [x] Surface data streams in UA
UI\r\n- [x] Take screenshots for a product review discussions\r\n- [x]
Unskip api_integration test cases\r\n\r\n### Imporant Notes\r\n\r\nES
deprecations are hidden behind the `featureSet` flag and will only
be\r\nshown in `8.last` for users.\r\nThis gives us time to review the
copy and implement the corrective\r\naction for reindexing data streams
which is still pending implementaiton\r\nfrom ES side.\r\n\r\nFor now we
will merge this to unblock upgrades in `8.17` and support\r\nsurfacing
data_streams deprecations and add tests.\r\n\r\nFollow up work for
`8.18`\r\n- Add integration Tests\r\n- Update copy of flyout and
documentation link\r\n- Reindexing data streams corrective
action\r\n\r\ncloses
https://github.com/elastic/kibana-team/issues/1293\r\n\r\n##
Screenshots\r\n\r\n#### Overview Page\r\n<img width=\"683\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/246d89ac-02cd-4813-ba38-e2e28df00c8d\">\r\n\r\n####
Elasticsearch deprecation issues Page\r\n\r\n<img width=\"1453\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/b5fd5f15-fa44-4acb-b7ff-4973593dcfbb\">\r\n\r\n\r\n####
Data streams deprecation details flyout\r\n<img width=\"778\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/af343f69-7e76-4c91-a6e3-cff29e26df59\">\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"a6b3743e00add07c315eacadda4d0dbb532042ac"}},"sourceBranch":"main","suggestedTargetBranches":["8.17"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/202204","number":202204,"mergeCommit":{"message":"[UA]
Support Deprecated Data Streams Migrations (elastic#202204)\n\n##
Summary\r\n\r\n- [x] Fix UA currently failing to return upgrade
status\r\n- [x] Support surfacing `data_streams` migrations in UA under
the ES tab\r\n- [x] Refactor code for better readablity\r\n- [x] Add
more test cases across the board for all the es migrations\r\nstatus
feature in UA\r\n- [x] Add a `featureSet.migrateDataStreams` to enable
surfacing data\r\nstreams migrations\r\n- [x] Surface data streams in UA
UI\r\n- [x] Take screenshots for a product review discussions\r\n- [x]
Unskip api_integration test cases\r\n\r\n### Imporant Notes\r\n\r\nES
deprecations are hidden behind the `featureSet` flag and will only
be\r\nshown in `8.last` for users.\r\nThis gives us time to review the
copy and implement the corrective\r\naction for reindexing data streams
which is still pending implementaiton\r\nfrom ES side.\r\n\r\nFor now we
will merge this to unblock upgrades in `8.17` and support\r\nsurfacing
data_streams deprecations and add tests.\r\n\r\nFollow up work for
`8.18`\r\n- Add integration Tests\r\n- Update copy of flyout and
documentation link\r\n- Reindexing data streams corrective
action\r\n\r\ncloses
https://github.com/elastic/kibana-team/issues/1293\r\n\r\n##
Screenshots\r\n\r\n#### Overview Page\r\n<img width=\"683\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/246d89ac-02cd-4813-ba38-e2e28df00c8d\">\r\n\r\n####
Elasticsearch deprecation issues Page\r\n\r\n<img width=\"1453\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/b5fd5f15-fa44-4acb-b7ff-4973593dcfbb\">\r\n\r\n\r\n####
Data streams deprecation details flyout\r\n<img width=\"778\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/af343f69-7e76-4c91-a6e3-cff29e26df59\">\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"a6b3743e00add07c315eacadda4d0dbb532042ac"}},{"branch":"8.17","label":"v8.17.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.18.0","labelRegex":"^v8.18.0$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/202593","number":202593,"state":"OPEN"}]}]
BACKPORT-->

---------

Co-authored-by: kibanamachine <[email protected]>
  • Loading branch information
Bamieh and kibanamachine authored Dec 3, 2024
1 parent d073848 commit 0acb039
Show file tree
Hide file tree
Showing 19 changed files with 743 additions and 502 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ export default function ({ getService }: PluginFunctionalProviderContext) {
'xpack.upgrade_assistant.featureSet.migrateSystemIndices (boolean?)',
'xpack.upgrade_assistant.featureSet.mlSnapshots (boolean?)',
'xpack.upgrade_assistant.featureSet.reindexCorrectiveActions (boolean?)',
'xpack.upgrade_assistant.featureSet.migrateDataStreams (boolean?)',
'xpack.upgrade_assistant.ui.enabled (boolean?)',
'xpack.observability.unsafe.alertDetails.metrics.enabled (boolean?)',
'xpack.observability.unsafe.alertDetails.logs.enabled (boolean?)',
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/upgrade_assistant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Some features of the UA are only needed when upgrading to a new major version. T
* ML Snapshots (`featureSet.mlSnapshots`): Machine learning Upgrade mode can be toggled from outside Kibana, the purpose of this feature guard is to hide all ML related deprecations from the end user until the next major upgrade.
When we want to enable ML model snapshot deprecation warnings again we need to change the constant `MachineLearningField.MIN_CHECKED_SUPPORTED_SNAPSHOT_VERSION` to something higher than 7.0.0 in the Elasticsearch code.
* Migrating system indices (`featureSet.migrateSystemIndices`): Migrating system indices should only be enabled for major version upgrades. This config hides the second step from the UA UI for migrating system indices.
* Reindex Data Streams (`featureSet.migrateDataStreams`): Migrating deprecated Data streams should only be enabled for major version upgrades. The purpose of this feature guard is to hide all data streams related deprecations from the end user until the next major upgrade.
* Reindex corrective actions (`featureSet.reindexCorrectiveActions`): Deprecations with reindexing corrective actions are only enabled for major version upgrades. Currently, the reindex actions include some logic that is specific to the [8.0 upgrade](https://github.com/elastic/kibana/blob/main/x-pack/plugins/upgrade_assistant/server/lib/reindexing/index_settings.ts). End users could get into a bad situation if this is enabled before this logic is fixed.

## Deprecations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export const getAppContextMock = (kibanaVersion: SemVer) => ({
featureSet: {
mlSnapshots: true,
migrateSystemIndices: true,
migrateDataStreams: true,
reindexCorrectiveActions: true,
},
kibanaVersionInfo: {
Expand Down
3 changes: 2 additions & 1 deletion x-pack/plugins/upgrade_assistant/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ export interface HealthIndicatorAction {

export interface EnrichedDeprecationInfo
extends Omit<estypes.MigrationDeprecationsDeprecation, 'level'> {
type: keyof estypes.MigrationDeprecationsResponse | 'health_indicator';
type: keyof estypes.MigrationDeprecationsResponse | 'health_indicator' | 'data_streams';
isCritical: boolean;
status?: estypes.HealthReportIndicatorHealthStatus;
index?: string;
Expand Down Expand Up @@ -296,4 +296,5 @@ export interface FeatureSet {
migrateSystemIndices: boolean;
mlSnapshots: boolean;
reindexCorrectiveActions: boolean;
migrateDataStreams: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
*/

import { i18n } from '@kbn/i18n';
import { EnrichedDeprecationInfo } from '../../../common/types';

export const DEPRECATION_TYPE_MAP = {
export const DEPRECATION_TYPE_MAP: Record<EnrichedDeprecationInfo['type'], string> = {
cluster_settings: i18n.translate(
'xpack.upgradeAssistant.esDeprecations.clusterDeprecationTypeLabel',
{
Expand All @@ -32,6 +33,9 @@ export const DEPRECATION_TYPE_MAP = {
defaultMessage: 'Health Indicator',
}
),
data_streams: i18n.translate('xpack.upgradeAssistant.esDeprecations.dataStreamsTypeLabel', {
defaultMessage: 'Data Stream',
}),
};

export const PAGINATION_CONFIG = {
Expand Down
5 changes: 5 additions & 0 deletions x-pack/plugins/upgrade_assistant/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ const configSchema = schema.object({
* End users could get into a bad situation if this is enabled before this logic is fixed.
*/
reindexCorrectiveActions: schema.boolean({ defaultValue: false }),
/**
* Migrating deprecated data streams should only be enabled for major version upgrades.
* Currently this is manually set to `true` on every `x.last` version.
*/
migrateDataStreams: schema.boolean({ defaultValue: false }),
}),
/**
* This config allows to hide the UI without disabling the plugin.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* 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 getMockEsDeprecations = () => {
return {
cluster_settings: [],
node_settings: [],
ml_settings: [],
index_settings: {},
data_streams: {},
};
};

export const getMockMlSettingsDeprecations = () => {
return {
ml_settings: [
{
level: 'warning',
message: 'Datafeed [deprecation-datafeed] uses deprecated query options',
url: 'https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-7.0.html#breaking_70_search_changes',
details:
'[Deprecated field [use_dis_max] used, replaced by [Set [tie_breaker] to 1 instead]]',
// @ts-ignore
resolve_during_rolling_upgrade: false,
},
{
level: 'critical',
message:
'model snapshot [1] for job [deprecation_check_job] needs to be deleted or upgraded',
url: '',
details: 'details',
// @ts-ignore
_meta: { snapshot_id: '1', job_id: 'deprecation_check_job' },
// @ts-ignore
resolve_during_rolling_upgrade: false,
},
],
};
};

export const getMockDataStreamDeprecations = () => {
return {
data_streams: {
'my-v7-data-stream': [
{
level: 'critical',
message: 'Old data stream with a compatibility version < 8.0',
url: 'https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-9.0.html',
details:
'This data stream has backing indices that were created before Elasticsearch 8.0.0',
resolve_during_rolling_upgrade: false,
_meta: {
backing_indices: {
count: 52,
need_upgrading: {
count: 37,
searchable_snapshot: {
count: 23,
fully_mounted: {
count: 7,
},
partially_mounted: {
count: 16,
},
},
},
},
},
},
],
},
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,31 @@
"resolve_during_rolling_upgrade": false
}
]
},
"data_streams": {
"my-v7-data-stream" : [{
"level" : "critical",
"message" : "Old data stream with a compatibility version < 8.0",
"url" : "https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-9.0.html",
"details" : "This data stream has backing indices that were created before Elasticsearch 8.0.0",
"resolve_during_rolling_upgrade" : false,
"_meta": {
"backing_indices": {
"count": 52,
"need_upgrading": {
"count": 37,
"searchable_snapshot": {
"count": 23,
"fully_mounted": {
"count": 7
},
"partially_mounted": {
"count": 16
}
}
}
}
}
}]
}
}
Loading

0 comments on commit 0acb039

Please sign in to comment.