mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Fleet] Added default index pattern creation to stream-based installation (#199122)
**Related to: https://github.com/elastic/kibana/pull/195888** ## Summary Add default index pattern creation to the new stream-based package installation method to match the behavior of standard package installation. Switching to stream-based package installation resulted in the default index patterns not being created, even after installing the rules package. While this likely doesn’t affect production, as multiple integrations are usually installed in Kibana (creating the default index pattern in any case), this change has impacted some tests: https://github.com/elastic/kibana/pull/199030. So restoring the original behaviour
This commit is contained in:
parent
7c92a10b32
commit
22d3e62893
4 changed files with 28 additions and 22 deletions
|
@ -133,6 +133,20 @@ export async function installKibanaAssets(options: {
|
|||
return [];
|
||||
}
|
||||
|
||||
await createDefaultIndexPatterns(savedObjectsImporter);
|
||||
await makeManagedIndexPatternsGlobal(savedObjectsClient);
|
||||
|
||||
return await installKibanaSavedObjects({
|
||||
logger,
|
||||
savedObjectsImporter,
|
||||
kibanaAssets: assetsToInstall,
|
||||
assetsChunkSize: MAX_ASSETS_TO_INSTALL_IN_PARALLEL,
|
||||
});
|
||||
}
|
||||
|
||||
export async function createDefaultIndexPatterns(
|
||||
savedObjectsImporter: SavedObjectsImporterContract
|
||||
) {
|
||||
// Create index patterns separately with `overwrite: false` to prevent blowing away users' runtime fields.
|
||||
// These don't get retried on conflict, because we expect that they exist once an integration has been installed.
|
||||
const indexPatternSavedObjects = getIndexPatternSavedObjects() as ArchiveAsset[];
|
||||
|
@ -143,15 +157,6 @@ export async function installKibanaAssets(options: {
|
|||
refresh: false,
|
||||
managed: true,
|
||||
});
|
||||
|
||||
await makeManagedIndexPatternsGlobal(savedObjectsClient);
|
||||
|
||||
return await installKibanaSavedObjects({
|
||||
logger,
|
||||
savedObjectsImporter,
|
||||
kibanaAssets: assetsToInstall,
|
||||
assetsChunkSize: MAX_ASSETS_TO_INSTALL_IN_PARALLEL,
|
||||
});
|
||||
}
|
||||
|
||||
export async function installKibanaAssetsAndReferencesMultispace({
|
||||
|
|
|
@ -5,17 +5,20 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import type { SavedObject, SavedObjectsClientContract } from '@kbn/core/server';
|
||||
import type { SavedObjectsClientContract } from '@kbn/core/server';
|
||||
|
||||
import type { Installation, PackageInstallContext } from '../../../../../common/types';
|
||||
import type { PackageInstallContext } from '../../../../../common/types';
|
||||
import type { KibanaAssetReference, KibanaAssetType } from '../../../../types';
|
||||
import { getPathParts } from '../../archive';
|
||||
|
||||
import { saveKibanaAssetsRefs } from '../../packages/install';
|
||||
|
||||
import { makeManagedIndexPatternsGlobal } from '../index_pattern/install';
|
||||
|
||||
import type { ArchiveAsset } from './install';
|
||||
import {
|
||||
KibanaSavedObjectTypeMapping,
|
||||
createDefaultIndexPatterns,
|
||||
createSavedObjectKibanaAsset,
|
||||
isKibanaAssetType,
|
||||
toAssetReference,
|
||||
|
@ -27,7 +30,6 @@ interface InstallKibanaAssetsWithStreamingArgs {
|
|||
packageInstallContext: PackageInstallContext;
|
||||
spaceId: string;
|
||||
savedObjectsClient: SavedObjectsClientContract;
|
||||
installedPkg?: SavedObject<Installation> | undefined;
|
||||
}
|
||||
|
||||
const MAX_ASSETS_TO_INSTALL_IN_PARALLEL = 100;
|
||||
|
@ -37,11 +39,14 @@ export async function installKibanaAssetsWithStreaming({
|
|||
packageInstallContext,
|
||||
savedObjectsClient,
|
||||
pkgName,
|
||||
installedPkg,
|
||||
}: InstallKibanaAssetsWithStreamingArgs): Promise<KibanaAssetReference[]> {
|
||||
const { archiveIterator } = packageInstallContext;
|
||||
|
||||
const { savedObjectClientWithSpace } = getSpaceAwareSaveobjectsClients(spaceId);
|
||||
const { savedObjectClientWithSpace, savedObjectsImporter } =
|
||||
getSpaceAwareSaveobjectsClients(spaceId);
|
||||
|
||||
await createDefaultIndexPatterns(savedObjectsImporter);
|
||||
await makeManagedIndexPatternsGlobal(savedObjectsClient);
|
||||
|
||||
const assetRefs: KibanaAssetReference[] = [];
|
||||
let batch: ArchiveAsset[] = [];
|
||||
|
|
|
@ -40,7 +40,7 @@ export async function stepInstallKibanaAssets(context: InstallContext) {
|
|||
}
|
||||
|
||||
export async function stepInstallKibanaAssetsWithStreaming(context: InstallContext) {
|
||||
const { savedObjectsClient, installedPkg, packageInstallContext, spaceId } = context;
|
||||
const { savedObjectsClient, packageInstallContext, spaceId } = context;
|
||||
const { packageInfo } = packageInstallContext;
|
||||
const { name: pkgName } = packageInfo;
|
||||
|
||||
|
@ -51,7 +51,6 @@ export async function stepInstallKibanaAssetsWithStreaming(context: InstallConte
|
|||
savedObjectsClient,
|
||||
pkgName,
|
||||
packageInstallContext,
|
||||
installedPkg,
|
||||
spaceId,
|
||||
})
|
||||
);
|
||||
|
|
|
@ -40,8 +40,7 @@ import { closeTimeline, openTimelineById } from '../../../tasks/timeline';
|
|||
const siemDataViewTitle = 'Security Default Data View';
|
||||
const dataViews = ['logs-*', 'metrics-*', '.kibana-event-log-*'];
|
||||
|
||||
// Failing: See https://github.com/elastic/kibana/issues/198943
|
||||
describe.skip('Timeline scope', { tags: ['@ess', '@serverless', '@skipInServerless'] }, () => {
|
||||
describe('Timeline scope', { tags: ['@ess', '@serverless', '@skipInServerless'] }, () => {
|
||||
before(() => {
|
||||
waitForRulesBootstrap();
|
||||
});
|
||||
|
@ -64,8 +63,7 @@ describe.skip('Timeline scope', { tags: ['@ess', '@serverless', '@skipInServerle
|
|||
});
|
||||
|
||||
describe('Modified badge', () => {
|
||||
// failing on main multiple times https://github.com/elastic/kibana/issues/198944#issuecomment-2457665138 and https://github.com/elastic/kibana/issues/198943#issuecomment-2457665072
|
||||
it.skip('Selecting new data view does not add a modified badge', () => {
|
||||
it('Selecting new data view does not add a modified badge', () => {
|
||||
openTimelineUsingToggle();
|
||||
cy.get(SOURCERER.badgeModified).should(`not.exist`);
|
||||
openSourcerer('timeline');
|
||||
|
@ -135,8 +133,7 @@ describe.skip('Timeline scope', { tags: ['@ess', '@serverless', '@skipInServerle
|
|||
});
|
||||
|
||||
const defaultPatterns = [`auditbeat-*`, `${DEFAULT_ALERTS_INDEX}-default`];
|
||||
// failing on main multiple times https://github.com/elastic/kibana/issues/198944#issuecomment-2457665138 and https://github.com/elastic/kibana/issues/198943#issuecomment-2457665072
|
||||
it.skip('alerts checkbox behaves as expected', () => {
|
||||
it('alerts checkbox behaves as expected', () => {
|
||||
isDataViewSelection(siemDataViewTitle);
|
||||
defaultPatterns.forEach((pattern) => isSourcererSelection(pattern));
|
||||
openDataViewSelection();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue