-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Ingest Manager] Support limiting integrations on an agent config #70542
[Ingest Manager] Support limiting integrations on an agent config #70542
Conversation
…ns available for an agent config
…eady from list of agent configs available for an integration
… tests to their own directory
Pinging @elastic/ingest-management (Team:Ingest Management) |
…gService.create()
Thanks Jen. LGTM visually |
@@ -3,6 +3,7 @@ | |||
* or more contributor license agreements. Licensed under the Elastic License; | |||
* you may not use this file except in compliance with the Elastic License. | |||
*/ | |||
import { HttpFetchQuery } from 'src/core/public'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this? It appears unused
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bad merge :)
(pkg) => (pkg.status = InstallationStatus.installed) | ||
); | ||
const installedPackagesInfo = await Promise.all( | ||
installedPackages.map(async (pkgInstall) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can drop async
since we're not using await
and getPackageInfo
is already async
}) | ||
); | ||
return installedPackagesInfo | ||
.filter((pkgInfo) => isPackageLimited(pkgInfo)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: no need for the lambda
.filter((pkgInfo) => isPackageLimited(pkgInfo)) | |
.filter(isPackageLimited) |
packageConfig: NewPackageConfig, | ||
options?: { id?: string; user?: AuthenticatedUser } | ||
): Promise<PackageConfig> { | ||
// Make sure the associated package is installed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do these requests in parallel?
Do we have to wait for ensureInstalledPackage
to complete before calling getPackageInfo
?
|
||
// EPM | ||
loadTestFile(require.resolve('./epm/list')); | ||
loadTestFile(require.resolve('./epm/list')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this should be changed to import a different file or removed
Updated PR with review feedback. I also re-enabled the skipped API integration test as the docker image was updated in #70716 🎉 |
}): Promise<string[]> { | ||
const { savedObjectsClient } = options; | ||
const allPackages = await getPackages({ savedObjectsClient }); | ||
const installedPackages = allPackages.filter( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can skip the get & filter by calling getPackageSavedObjects
. I don't know if it'll be a drop-in replacement, but it will start with the installed packages instead of getting all from the registry & filtering.
Not a blocker, just a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will end up being the same number of calls because getPackageSavedObjects
just returns the saved objects, which do not contain the necessary PackageInfo fields (from the registry) to detect if the package is limited or not
💚 Build SucceededBuild metrics@kbn/optimizer bundle module count
History
To update your PR or re-run it, just comment with: |
Holding off on backporting until backport #70862 is merged, to avoid conflicts. |
…0542) (#70895) * Add API endpoint and hook for retrieving restricted packages * Filter out restricted packages already in use from list of integrations available for an agent config * Allow list agent configs to optionally return expanded package configs, re * Filter out agent configs which already use the restricted package already from list of agent configs available for an integration * Allow more than 20 agent configs to be shown * Rename restricted to limited; add some common methods to DRY * Add limited package check on server side * Adjust copy wording * Fix typings * Add some package config api integration tests, update es archive mappings * Move test to dockerized integation tests directory; move existing epm tests to their own directory * Remove extra assignPackageConfigs() - already handled in packageConfigService.create() * Review fixes * Fix type, reenabled skipped test * Move new EPM integration test file
* master: (53 commits) [Composable template] Details panel + delete functionality (elastic#70814) [Uptime] Ping list body scroll (elastic#70781) moving indexPattern.delete() to indexPatterns.delete(indexPattern) (elastic#70430) Adapt expected response of advanced settings feature control for cloud tests (elastic#70793) skip flaky suite (elastic#70885) skip flaky suite (elastic#67814) skip flaky suite (elastic#70906) Revert "reenable regression and classification functional tests (elastic#70661)" (elastic#70908) Added UI validation when creating a Webhook connector with invalid URL (elastic#70025) [Security Solution] Change default index pattern (elastic#70797) ServiceNow push to Incident generic implementation (supporting both Case specific and generic Alerts) (elastic#68464) add button link to ingest (elastic#70142) reenable regression and classification functional tests (elastic#70661) [Component templates] Form wizard (elastic#69732) [Ingest Manager] Copy changes (elastic#70828) Adding test user to maps functional tests - PR 1 (elastic#70649) [Ingest Manager] Support limiting integrations on an agent config (elastic#70542) skip flaky suite (elastic#70880) [Metrics UI] Fix a bug in Metric Threshold query filter construction (elastic#70672) upgrade caniuse-lite database (elastic#70833) ...
* master: (46 commits) [Composable template] Details panel + delete functionality (elastic#70814) [Uptime] Ping list body scroll (elastic#70781) moving indexPattern.delete() to indexPatterns.delete(indexPattern) (elastic#70430) Adapt expected response of advanced settings feature control for cloud tests (elastic#70793) skip flaky suite (elastic#70885) skip flaky suite (elastic#67814) skip flaky suite (elastic#70906) Revert "reenable regression and classification functional tests (elastic#70661)" (elastic#70908) Added UI validation when creating a Webhook connector with invalid URL (elastic#70025) [Security Solution] Change default index pattern (elastic#70797) ServiceNow push to Incident generic implementation (supporting both Case specific and generic Alerts) (elastic#68464) add button link to ingest (elastic#70142) reenable regression and classification functional tests (elastic#70661) [Component templates] Form wizard (elastic#69732) [Ingest Manager] Copy changes (elastic#70828) Adding test user to maps functional tests - PR 1 (elastic#70649) [Ingest Manager] Support limiting integrations on an agent config (elastic#70542) skip flaky suite (elastic#70880) [Metrics UI] Fix a bug in Metric Threshold query filter construction (elastic#70672) upgrade caniuse-lite database (elastic#70833) ...
* actions/feature: (46 commits) [Composable template] Details panel + delete functionality (elastic#70814) [Uptime] Ping list body scroll (elastic#70781) moving indexPattern.delete() to indexPatterns.delete(indexPattern) (elastic#70430) Adapt expected response of advanced settings feature control for cloud tests (elastic#70793) skip flaky suite (elastic#70885) skip flaky suite (elastic#67814) skip flaky suite (elastic#70906) Revert "reenable regression and classification functional tests (elastic#70661)" (elastic#70908) Added UI validation when creating a Webhook connector with invalid URL (elastic#70025) [Security Solution] Change default index pattern (elastic#70797) ServiceNow push to Incident generic implementation (supporting both Case specific and generic Alerts) (elastic#68464) add button link to ingest (elastic#70142) reenable regression and classification functional tests (elastic#70661) [Component templates] Form wizard (elastic#69732) [Ingest Manager] Copy changes (elastic#70828) Adding test user to maps functional tests - PR 1 (elastic#70649) [Ingest Manager] Support limiting integrations on an agent config (elastic#70542) skip flaky suite (elastic#70880) [Metrics UI] Fix a bug in Metric Threshold query filter construction (elastic#70672) upgrade caniuse-lite database (elastic#70833) ...
Summary
Resolves #64371. This PR supports the package definition
config_templates.[0].multiple: false
field that indicates whether or not a package is allowed to be added to an agent config more than once. Currently the only package that uses this field isendpoint
.Server-side changes:
GET /api/ingest_manager/epm/packages/limited
that retrieves a list of package names which are limitedfull
to agent config list endpointGET /api/ingest_manager/agent_configs?full=true
to retrieve expandedpackage_configs
information on each agent configpackage_configs
fieldPOST /api/ingest_manager/package_configs
to return an error if a package config is using a 1) limited package and 2) is being added to an agent config which already has another package config using the same limited packagepackageConfigService.create()
insteadClient-side changes:
Agent config > Add integration
page, remove limited integrations which have already been added to that agent config from the list of available integrationsIntegration > Add [integration name
page, for limited integrations, disable agent configs which already have that integration addedAPI integration changes:
/ingest_manager_api_integration/apis/epm
/ingest_manager_api_integration/apis/package_config
create.ts
file created containing basic tests covering creating package configsNote: a test was written to cover the erroring case for limited packages described above, but is skipped ATM due to the docker image not containing recent package registry changes needed for the test to succeedTesting
Agent config > Add integration
page in two tabs, selecting Endpoint in both and submitting the first tab. Attempting to submit the second tab should result in a toast error message.Screenshots