diff --git a/docs/settings/ingest-manager-settings.asciidoc b/docs/settings/ingest-manager-settings.asciidoc index 604471edc4d59..30e11f726c26b 100644 --- a/docs/settings/ingest-manager-settings.asciidoc +++ b/docs/settings/ingest-manager-settings.asciidoc @@ -8,8 +8,7 @@ experimental[] You can configure `xpack.ingestManager` settings in your `kibana.yml`. -By default, {ingest-manager} is not enabled. You need to -enable it. To use {fleet}, you also need to configure {kib} and {es} hosts. +By default, {ingest-manager} is enabled. To use {fleet}, you also need to configure {kib} and {es} hosts. See the {ingest-guide}/index.html[Ingest Management] docs for more information. @@ -19,7 +18,7 @@ See the {ingest-guide}/index.html[Ingest Management] docs for more information. [cols="2*<"] |=== | `xpack.ingestManager.enabled` {ess-icon} - | Set to `true` to enable {ingest-manager}. + | Set to `true` (default) to enable {ingest-manager}. | `xpack.ingestManager.fleet.enabled` {ess-icon} | Set to `true` (default) to enable {fleet}. |=== diff --git a/x-pack/plugins/ingest_manager/README.md b/x-pack/plugins/ingest_manager/README.md index 1a19672331035..a523ddeb7c499 100644 --- a/x-pack/plugins/ingest_manager/README.md +++ b/x-pack/plugins/ingest_manager/README.md @@ -2,8 +2,8 @@ ## Plugin -- The plugin is disabled by default. See the TypeScript type for the [the available plugin configuration options](https://github.com/elastic/kibana/blob/master/x-pack/plugins/ingest_manager/common/types/index.ts#L9-L27) -- Setting `xpack.ingestManager.enabled=true` enables the plugin including the EPM and Fleet features. It also adds the `PACKAGE_CONFIG_API_ROUTES` and `AGENT_CONFIG_API_ROUTES` values in [`common/constants/routes.ts`](./common/constants/routes.ts) +- The plugin is enabled by default. See the TypeScript type for the [the available plugin configuration options](https://github.com/elastic/kibana/blob/master/x-pack/plugins/ingest_manager/common/types/index.ts#L9-L27) +- Adding `xpack.ingestManager.enabled=false` will disable the plugin including the EPM and Fleet features. It will also remove the `PACKAGE_CONFIG_API_ROUTES` and `AGENT_CONFIG_API_ROUTES` values in [`common/constants/routes.ts`](./common/constants/routes.ts) - Adding `--xpack.ingestManager.fleet.enabled=false` will disable the Fleet API & UI - [code for adding the routes](https://github.com/elastic/kibana/blob/1f27d349533b1c2865c10c45b2cf705d7416fb36/x-pack/plugins/ingest_manager/server/plugin.ts#L115-L133) - [Integration tests](server/integration_tests/router.test.ts) diff --git a/x-pack/plugins/ingest_manager/public/plugin.ts b/x-pack/plugins/ingest_manager/public/plugin.ts index 172ad2df210c3..670e75f7a241b 100644 --- a/x-pack/plugins/ingest_manager/public/plugin.ts +++ b/x-pack/plugins/ingest_manager/public/plugin.ts @@ -39,7 +39,7 @@ export interface IngestManagerSetup {} */ export interface IngestManagerStart { registerPackageConfigComponent: typeof registerPackageConfigComponent; - success: Promise; + isInitialized: () => Promise; } export interface IngestManagerSetupDeps { @@ -100,27 +100,32 @@ export class IngestManagerPlugin } public async start(core: CoreStart): Promise { - let successPromise: IngestManagerStart['success']; - try { - const permissionsResponse = await core.http.get( - appRoutesService.getCheckPermissionsPath() - ); - - if (permissionsResponse?.success) { - successPromise = core.http - .post(setupRouteService.getSetupPath()) - .then(({ isInitialized }) => - isInitialized ? Promise.resolve(true) : Promise.reject(new Error('Unknown setup error')) - ); - } else { - throw new Error(permissionsResponse?.error || 'Unknown permissions error'); - } - } catch (error) { - successPromise = Promise.reject(error); - } + let successPromise: ReturnType; return { - success: successPromise, + isInitialized: () => { + if (!successPromise) { + successPromise = Promise.resolve().then(async () => { + const permissionsResponse = await core.http.get( + appRoutesService.getCheckPermissionsPath() + ); + + if (permissionsResponse?.success) { + return core.http + .post(setupRouteService.getSetupPath()) + .then(({ isInitialized }) => + isInitialized + ? Promise.resolve(true) + : Promise.reject(new Error('Unknown setup error')) + ); + } else { + throw new Error(permissionsResponse?.error || 'Unknown permissions error'); + } + }); + } + + return successPromise; + }, registerPackageConfigComponent, }; } diff --git a/x-pack/plugins/ingest_manager/server/index.ts b/x-pack/plugins/ingest_manager/server/index.ts index 1823cc3561693..16c0b6449d1e8 100644 --- a/x-pack/plugins/ingest_manager/server/index.ts +++ b/x-pack/plugins/ingest_manager/server/index.ts @@ -20,7 +20,7 @@ export const config = { fleet: true, }, schema: schema.object({ - enabled: schema.boolean({ defaultValue: false }), + enabled: schema.boolean({ defaultValue: true }), registryUrl: schema.maybe(schema.uri()), fleet: schema.object({ enabled: schema.boolean({ defaultValue: true }), diff --git a/x-pack/plugins/ingest_manager/server/routes/app/index.ts b/x-pack/plugins/ingest_manager/server/routes/app/index.ts index 9d666efc7e9ce..ce2bf6fcdaf17 100644 --- a/x-pack/plugins/ingest_manager/server/routes/app/index.ts +++ b/x-pack/plugins/ingest_manager/server/routes/app/index.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import { IRouter, RequestHandler } from 'src/core/server'; -import { PLUGIN_ID, APP_API_ROUTES } from '../../constants'; +import { APP_API_ROUTES } from '../../constants'; import { appContextService } from '../../services'; import { CheckPermissionsResponse } from '../../../common'; @@ -37,7 +37,7 @@ export const registerRoutes = (router: IRouter) => { { path: APP_API_ROUTES.CHECK_PERMISSIONS_PATTERN, validate: {}, - options: { tags: [`access:${PLUGIN_ID}-read`] }, + options: { tags: [] }, }, getCheckPermissionsHandler ); diff --git a/x-pack/plugins/security_solution/public/app/home/setup.tsx b/x-pack/plugins/security_solution/public/app/home/setup.tsx index bf7ce2ddf8b50..3f4b0c19e7035 100644 --- a/x-pack/plugins/security_solution/public/app/home/setup.tsx +++ b/x-pack/plugins/security_solution/public/app/home/setup.tsx @@ -32,7 +32,7 @@ export const Setup: React.FunctionComponent<{ }); }; - ingestManager.success.catch((error: Error) => displayToastWithModal(error.message)); + ingestManager.isInitialized().catch((error: Error) => displayToastWithModal(error.message)); }, [ingestManager, notifications.toasts]); return null; diff --git a/x-pack/plugins/security_solution/public/common/mock/endpoint/dependencies_start_mock.ts b/x-pack/plugins/security_solution/public/common/mock/endpoint/dependencies_start_mock.ts index 9276d503176c6..9cf99f2442aab 100644 --- a/x-pack/plugins/security_solution/public/common/mock/endpoint/dependencies_start_mock.ts +++ b/x-pack/plugins/security_solution/public/common/mock/endpoint/dependencies_start_mock.ts @@ -59,6 +59,9 @@ export const depsStartMock: () => DepsStartMock = () => { return { data: dataMock, - ingestManager: { success: Promise.resolve(true), registerPackageConfigComponent }, + ingestManager: { + isInitialized: () => Promise.resolve(true), + registerPackageConfigComponent, + }, }; };