-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Fleet] Support browsing granular integrations #99866
[Fleet] Support browsing granular integrations #99866
Conversation
Pinging @elastic/fleet (Team:Fleet) |
@kpollich You might be interested in reviewing this PR and running through the above testing steps as it relates to what you've been working on. I apologize in advance that you might need to resolve even more conflicts with the top-level Integration UI work if this PR makes it in before that 😅 |
Thanks, @jen-huang - definitely touches a lot of the same files that will be moved as part of #99848. I think it definitely makes the most sense to aim for landing this PR first before we move integrations to a separate app. It will be easier to fix conflicts by just "re-moving" files around instead of recreating your changes on a bunch of newly relocated/renamed files. |
@elasticmachine merge upstream |
@elasticmachine merge upstream |
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 ran through the local testing instructions in the PR description and everything seems good on my end. This should get a second review from someone with more experience on the Fleet codebase, though.
validationResults.vars = packageVars.reduce((results, [name, varEntry]) => { | ||
results[name] = validatePackagePolicyConfig(varEntry, packageVarsByName[name]); | ||
return results; | ||
}, {} as ValidationEntry); |
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.
Minor thing, but it seems like elsewhere in the fleet codebase we use the reduce
's generic - e.g. packageVars.reduce<ValidationEntry>(...)
- instead of a type assertion like this. Although looking more it seems inconsistent file-to-file. Is this something we should or could make consistent for all our uses of reduce
?
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.
yeah our usage has been inconsistent, I will address this in the next PR for granularity support in order to get this one in now. thanks!
function InstalledPackages() { | ||
}); | ||
|
||
// Packages can export multiple integrations, aka `policy_templates` |
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.
Super helpful comment - thank you!
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]Module Count
Public APIs missing comments
Async chunks
Page load bundle
Saved Objects .kibana field count
Unknown metric groupsAPI count
References to deprecated APIs
History
To update your PR or re-run it, just comment with: cc @jen-huang |
* Manual cherry pick of work to support integration tiles and package-level vars * Fix types * Remove registry input group typings * Show integration-specific readme, title, and icon in package details page * Revert unnecessary changes * Add package-level `vars` field to package policy SO mappings * Fix types * Fix test Co-authored-by: Kibana Machine <[email protected]>
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
* Manual cherry pick of work to support integration tiles and package-level vars * Fix types * Remove registry input group typings * Show integration-specific readme, title, and icon in package details page * Revert unnecessary changes * Add package-level `vars` field to package policy SO mappings * Fix types * Fix test Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Jen Huang <[email protected]>
Hi, we have found a regression in the e2e tests, probably caused by this PR. We are observing changes in how an integration is added to the policy. Before these changes, we were able to hit the
And this code hasn’t changed in the test framework. I've checked the git history of Kibana for the I've diff'ed #99866, and the code in there seems a feasible candidate to cause the regression. I'm currently running the tests for the previous PR (#100476) using the dedicated pipeline we created to run e2e tests for Kibana: https://beats-ci.elastic.co/blue/organizations/jenkins/e2e-tests%2Fe2e-testing-mbp/detail/master/922/pipeline. At the same time, I've run the e2e tests for #99866: https://beats-ci.elastic.co/blue/organizations/jenkins/e2e-tests%2Fe2e-testing-mbp/detail/master/924/pipeline In both cases we:
It's possible to reproduce this locally: Before this changes, the tests adding integration to policies pass: TAGS="linux_integration" TIMEOUT_FACTOR=3 LOG_LEVEL=TRACE DEVELOPER_MODE=true KIBANA_VERSION=pr100476 make -C e2e/_suites/fleet functional-test Passing:
With this changes, the tests adding integration to policies fail:
Failing with:
|
Thanks for the all the investigation @mdelapenya . @nchaulet @kpollich I assume we introduce a breaking change during the introduction of the granular integration implementation. Can you please have a look? |
@mdelapenya it looks like the issue here is that the Pasting the error message from above just for convenience:
The This struct defines the
Fleet's expected schema for this object is defined here: kibana/x-pack/plugins/fleet/server/types/models/package_policy.ts Lines 37 to 43 in a4f6d43
I was able to reproduce this exact error locally by forcing an This PR didn't alter anything around this schema that I can see, the only changes made to this particular request structure were to allow for the
I'm new to the project (and Elastic in general 🙂), so I'm not 100% certain on how to proceed towards a resolution, but maybe someone else could chime in on a few questions:
|
As far as I know, the |
That could definitely be the case. I'll surface this with the rest of the Fleet team and take a look at how we enforce this request schema. |
We simple retrieve the integration hitting |
Yes I agree. I just filed an issue (#100897) to permit the |
Cool thank you for the fast response! If we decide to not accept the id field in the payload, I've just removed the ID in a local branch of the e2e tests, and it works, just in case. |
Summary
Part of #93315. This PR has two main parts:
Allow users to browse "granular integrations"
Screenshots
Granular AWS integration tiles on browse page

Integration specific detail page

Installed integrations page, single AWS tile

policy_templates
in their package definition. Previously, all packages exported 1 policy template. Now, we have changes coming to the AWS package (Adjust aws package to use input groups integrations#767) so that it exports multiple AWS integrations: AWS CloudWatch, AWS DynamoDB, etc.Support package-level vars (user configurable variables)
Screenshots
Policy editor "Integrations settings" area expanded to include package-level vars

Package-level vars are used properly while compiling final agent YAML

How to test
TLDR Build in-flight AWS package and load it into your local package registry
elastic-package
https://github.com/elastic/elastic-package<integrations>packages/aws
elastic-package build
, make note of the builtaws/0.6.0
package at<integrations>/build
package-registry
https://github.com/elastic/package-registry0.6.0
package to<package-registry>/build/package-storage/packages/aws
go run .
kibana.dev.yml
to use your local package registry by adding:xpack.fleet.registryUrl: http://localhost:8080
What's next
You'll notice that the policy editor for the AWS package only displays "Collect billing metrics". This is expected for now. The second part of the work to fully support all the requirements in #93315 is to adjust the policy editor to support multiple
policy_templates
too. Originally I tried putting everything in one PR but that second part is a bit more complex and it was holding up the rest of the work from going in 🙃