-
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] use package storage when getting a package #85337
Conversation
x-pack/plugins/fleet/server/services/epm/kibana/index_pattern/install.ts
Outdated
Show resolved
Hide resolved
8cb84fb
to
12ccfea
Compare
|
||
// create the packageInfo | ||
// TODO: this is mostly copied from validtion.ts, but we should save packageInfo somewhere | ||
// so we don't need to do this again as this was already done either in registry or through upload |
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'm still getting the full picture of what's going on, but wanted to remind we have get/setPackageInfo methods
export const setPackageInfo = ({ |
Same trade-offs as elsewhere re: memory cache
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.
For packages that are not yet in storage (packages installed before storage was available) or in cache we would need to still create the package info. Also in the case the package IS in storage but not in cache, we don't have the package info. One thing I can do is check first if its in packageInfoCache
, if its not, create it from storage as is being done here and add it to packageInfoCache
.
manifestPolicyTemplates.forEach((policyTemplate: any) => { | ||
const { name, title: policyTemplateTitle, description, inputs, multiple } = policyTemplate; | ||
if (!(name && policyTemplateTitle && description && inputs)) { | ||
if (!(name && policyTemplateTitle && description)) { |
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.
@skh I removed input
being required in a policy template because it was causing all packages to fail during install or uninstall when getting the endpoint
package from storage. endpoint
does not have any inputs
in its policy_templates
in its manifest.yml. Is the package correct or is the spec incorrect?
inputs
will now be an empty array if there are no inputs in the manifest.
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 you have it right. Let's follow spec as written and fix any bugs there
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.
In the parseAndVerify* methods I followed our existing types to decide which fields are mandatory. Spec and actual working package should take precedence though.
f266693
to
155b33d
Compare
…seAndVerifyPolicyTemplates
155b33d
to
83b3480
Compare
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.
Pinging @elastic/ingest-management (Team:Ingest Management) |
I added some manual steps for testing. We don't currently test getting package info from cache or registry, only a 200 response. I think there should be tests written in a follow up that test when a package is expected to come from registry, cache, or storage. |
@neptunian thanks for listing those. I'll need to confirm, but I don't believe this is correct: I believe the server needs to be restarted (stop & start) vs merely "rebuilt" via a change to a watched file. I'll take a look and update the instructions if they need it. Thanks again for the PR and additional notes |
@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.
LGTM. I'd like to follow up with some changes like those in #85711 to break up getEsPackage
and remove the duplication of validation code but that can be done in a follow up.
💚 Build SucceededMetrics [docs]
History
To update your PR or re-run it, just comment with: |
* getPackageFromSource to use package storage * fix type * use bulkGet * add data streams and policy templates to package info from storage * fix merge conflict * comment out policy_templates for now * add policy_templates to package info, remove required inputs from parseAndVerifyPolicyTemplates * add storage assets to cache * tidy up Co-authored-by: Kibana Machine <[email protected]>
* getPackageFromSource to use package storage * fix type * use bulkGet * add data streams and policy templates to package info from storage * fix merge conflict * comment out policy_templates for now * add policy_templates to package info, remove required inputs from parseAndVerifyPolicyTemplates * add storage assets to cache * tidy up Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Kibana Machine <[email protected]>
This is the implementation of integrations using the package storage to get assets or install from.
getEsPackage
to get the package in storage. this function has to create the 'package info' as well.Manual test uploaded package
Manual test package installed from registry
Manual test package installed from registry before the storage feature was available