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

[ML][Fleet] Update Transform installation mechanism to support upgrade paths #142920

Merged
merged 25 commits into from
Dec 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4a0ab13
[ML] Fix template being overridden
qn895 Oct 6, 2022
93c87ac
Clean up
qn895 Nov 9, 2022
61f033e
Clean up
qn895 Nov 2, 2022
f450566
Modify alias logic
qn895 Nov 2, 2022
adcbd4c
Add logic for adding aliases, order of installing transforms, updatin…
qn895 Nov 8, 2022
8ca3a2e
Wrap up for testing
qn895 Nov 9, 2022
af4db32
Merge upstream/main into branch
qn895 Nov 9, 2022
36646d1
Remove @todos since they are addressed
qn895 Nov 9, 2022
8e2a6ff
[TO REVERT] Ignore 400 for ingest pipeline deletion
qn895 Nov 9, 2022
49d1f59
Merge remote-tracking branch 'upstream/main' into ml-fleet-fix-templa…
qn895 Nov 14, 2022
cf1e93b
Remove console
qn895 Nov 14, 2022
ab3444f
[TODO] Update tests
qn895 Nov 15, 2022
0abab6d
Merge remote-tracking branch 'upstream/main' into ml-fleet-fix-templa…
qn895 Dec 5, 2022
ecbb8c1
Fix types, tests
qn895 Dec 5, 2022
6984e15
Remove index as a fleet setting, add more tests
qn895 Dec 5, 2022
8fb4a73
Merge branch 'main' into ml-fleet-fix-templates-being-overriden
kibanamachine Dec 6, 2022
d758b5b
Ensures it supports version downgrades & tests for downgrades
qn895 Dec 6, 2022
d6a22d2
Merge remote-tracking branch 'upstream/main' into ml-fleet-fix-templa…
qn895 Dec 6, 2022
6ee4cce
Update epm-package snapshot for saved_objects migrations
qn895 Dec 7, 2022
306a2e1
Merge remote-tracking branch 'upstream/main' into ml-fleet-fix-templa…
qn895 Dec 7, 2022
f09f995
Merge upstream into branch
qn895 Dec 14, 2022
e1a0050
Change to debug.error
qn895 Dec 14, 2022
e56481c
Update to delete old transform, and old dest index if upgrading from …
qn895 Dec 20, 2022
76402ac
Merge remote-tracking branch 'upstream/main' into ml-fleet-fix-templa…
qn895 Dec 20, 2022
a99e62c
Merge branch 'main' into ml-fleet-fix-templates-being-overriden
kibanamachine Dec 21, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ describe('checking migration metadata changes on all registered SO types', () =>
"endpoint:user-artifact": "f94c250a52b30d0a2d32635f8b4c5bdabd1e25c0",
"endpoint:user-artifact-manifest": "8c14d49a385d5d1307d956aa743ec78de0b2be88",
"enterprise_search_telemetry": "fafcc8318528d34f721c42d1270787c52565bad5",
"epm-packages": "fe3716a54188b3c71327fa060dd6780a674d3994",
"epm-packages": "2915aee4302d4b00472ed05c21f59b7d498b5206",
"epm-packages-assets": "9fd3d6726ac77369249e9a973902c2cd615fc771",
"event_loop_delays_daily": "d2ed39cf669577d90921c176499908b4943fb7bd",
"exception-list": "fe8cc004fd2742177cdb9300f4a67689463faf9c",
Expand Down
7 changes: 6 additions & 1 deletion x-pack/plugins/fleet/common/types/models/epm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export enum KibanaSavedObjectType {
}

export enum ElasticsearchAssetType {
index = 'index',
componentTemplate = 'component_template',
ingestPipeline = 'ingest_pipeline',
indexTemplate = 'index_template',
Expand All @@ -109,6 +110,10 @@ export enum ElasticsearchAssetType {
dataStreamIlmPolicy = 'data_stream_ilm_policy',
mlModel = 'ml_model',
}
export type FleetElasticsearchAssetType = Exclude<
ElasticsearchAssetType,
ElasticsearchAssetType.index
>;

export type DataType = typeof dataTypes;
export type MonitoringType = typeof monitoringTypes;
Expand Down Expand Up @@ -313,7 +318,7 @@ export type ElasticsearchAssetParts = AssetParts & {

export type KibanaAssetTypeToParts = Record<KibanaAssetType, KibanaAssetParts[]>;
export type ElasticsearchAssetTypeToParts = Record<
ElasticsearchAssetType,
FleetElasticsearchAssetType,
ElasticsearchAssetParts[]
>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ export const AssetTitleMap: Record<DisplayedAssetType, string> = {
transform: i18n.translate('xpack.fleet.epm.assetTitles.transforms', {
defaultMessage: 'Transforms',
}),
index: i18n.translate('xpack.fleet.epm.assetTitles.indices', {
defaultMessage: 'Indices',
}),
index_pattern: i18n.translate('xpack.fleet.epm.assetTitles.indexPatterns', {
defaultMessage: 'Index patterns',
}),
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/fleet/server/saved_objects/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ const getSavedObjectTypes = (
properties: {
id: { type: 'keyword' },
type: { type: 'keyword' },
version: { type: 'keyword' },
},
},
installed_kibana: {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* 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 { updateIndexSettings } from './update_settings';
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* 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.
*/

import type { ElasticsearchClient } from '@kbn/core-elasticsearch-server';

import type { IndicesIndexSettings } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';

import { retryTransientEsErrors } from '../retry';

export async function updateIndexSettings(
esClient: ElasticsearchClient,
index: string,
settings: IndicesIndexSettings
): Promise<void> {
if (index) {
try {
await retryTransientEsErrors(() =>
esClient.indices.putSettings({
index,
body: settings,
})
);
} catch (err) {
throw new Error(`could not update index settings for ${index}`);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@
*/

export { getAsset } from '../../archive';

// Index alias that points to just one destination index from the latest package version
export const TRANSFORM_DEST_IDX_ALIAS_LATEST_SFX = '.latest';
// Index alias that points to all of the destination indices from all the package versions
export const TRANSFORM_DEST_IDX_ALIAS_ALL_SFX = '.all';
Loading