-
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
Handle ID changes to Saved Objects installed by Fleet #108959
Comments
Pinging @elastic/fleet (Team:Fleet) |
From the proposed Option 1:
It's implied but I wanted to restate that assets (such as dashboards, etc.) will first be made share-capable in the 8.0 release, and fully shareable in a future 8.x release. The latter has not yet been planned.
FWIW, defining From the proposed Option 2:
I just wanted to mention that Instead, you can use From the proposed Option 3:
In addition to these problems, reinstalling assets in Option 3 will create "alias conflict" scenarios that we are desperately trying to avoid. Legacy URL aliases are created for objects that are converted, and recreating an object in a space with its old ID (using the Thanks for putting this together, Josh. I am happy to consult on Option 1 or 2 if need be. |
Great, didn't realize this API existed. This works even better 😄
Thanks for calling this out, it sounds like a very ugly situation for we could run into for users who upgrade or install a package into a non-default Space for the second time after the ID re-write migration has been run. I'll update the issue description to reflect this. Currently, we plan on pursuing Option 1 since it's the smoothest path forward for users and likely will more closely match the UX we want to achieve long-term for Fleet-installed assets. |
Good to know, but that won't be achievable in 8.0, since we don't plan on making index patterns, dashboards, etc. shareable in that release. So perhaps Option 2 could be a stepping stone in the 8.0 release, thoughts? |
My thinking is that we can implement it in a way that it will 'just work' once these types become shareable by using the |
Yes that's doable, the problem is that the objects won't be fully shareable until sometime in 8.x -- again, the work to move from "share-capable" to "fully shareable" has not yet been planned. For the sake of argument, let's assume that dashboards/etc will be fully shareable in 8.2. This won't negatively impact Fleet directly, but it will affect the plugin authors for those assets. |
Got it, so the IDs are not changing at the same time the objects actually support multiple spaces. So we won't be able to create a new object that is shared to all spaces that the asset may have been installed into whenever the IDs change in the 8.0 release. It seems option 2 is going to be the best path forward until we can have a true multi-space experience for Fleet assets, at which point we should also do something similar to option 1. It would be great if we could coordinate to release UX changes in the Fleet & Integrations apps to support multiple Spaces at the same time that Dashboards, Visualizations, index patterns, etc. support sharing, but I don't think that's absolutely necessary. |
👍
I'm sure I will be at least somewhat involved in the changes for those code owners, I'll do my best to coordinate with y'all when the time comes. |
I've got a draft PR to change the Sample Data installer to use the import API: #116378 Fleet will need to make the same changes to its asset installer for those assets to continue working as expected post-8.0. |
* Do not add fields to index patterns * remove redundant tests * install index patterns before package install * update remove comment * use import to create package assets Here I have also moved to importing all assets at once. This is essential when importing to ensure that all saved objects references are imported at once. There is also an efficiencey improvement. * Import index patterns * use resolve when deleting index patterns * fix: asset type validation * add option to override supported import types * make ml-module importable * Revert "add option to override supported import types" This reverts commit 1f48e6ee193fea5e5cb0f37c70cbfa7ae47eeab5. * remove hidden: false from ml-module * use resolve when deleting assets * make security-rule SO type importable * use bulkResolve to get package assets * fix tests * fix 'multiple' tests * remove unused function * create index patterns at the same time as other assets * remove unused test * Fix integration tests We were checking for an error before the import was complete. * tidy for PR * add missing test assets * do not attempt to delete missing assets * resolve any reference errors that occur on import * await installKibanaAssets immediately * show assets not found when assets installed in a different space * fix delete asset check on force upgrade * add comment about reference errors * remove a couple of appContextService dependencies
* Do not add fields to index patterns * remove redundant tests * install index patterns before package install * update remove comment * use import to create package assets Here I have also moved to importing all assets at once. This is essential when importing to ensure that all saved objects references are imported at once. There is also an efficiencey improvement. * Import index patterns * use resolve when deleting index patterns * fix: asset type validation * add option to override supported import types * make ml-module importable * Revert "add option to override supported import types" This reverts commit 1f48e6ee193fea5e5cb0f37c70cbfa7ae47eeab5. * remove hidden: false from ml-module * use resolve when deleting assets * make security-rule SO type importable * use bulkResolve to get package assets * fix tests * fix 'multiple' tests * remove unused function * create index patterns at the same time as other assets * remove unused test * Fix integration tests We were checking for an error before the import was complete. * tidy for PR * add missing test assets * do not attempt to delete missing assets * resolve any reference errors that occur on import * await installKibanaAssets immediately * show assets not found when assets installed in a different space * fix delete asset check on force upgrade * add comment about reference errors * remove a couple of appContextService dependencies
* Do not add fields to index patterns * remove redundant tests * install index patterns before package install * update remove comment * use import to create package assets Here I have also moved to importing all assets at once. This is essential when importing to ensure that all saved objects references are imported at once. There is also an efficiencey improvement. * Import index patterns * use resolve when deleting index patterns * fix: asset type validation * add option to override supported import types * make ml-module importable * Revert "add option to override supported import types" This reverts commit 1f48e6ee193fea5e5cb0f37c70cbfa7ae47eeab5. * remove hidden: false from ml-module * use resolve when deleting assets * make security-rule SO type importable * use bulkResolve to get package assets * fix tests * fix 'multiple' tests * remove unused function * create index patterns at the same time as other assets * remove unused test * Fix integration tests We were checking for an error before the import was complete. * tidy for PR * add missing test assets * do not attempt to delete missing assets * resolve any reference errors that occur on import * await installKibanaAssets immediately * show assets not found when assets installed in a different space * fix delete asset check on force upgrade * add comment about reference errors * remove a couple of appContextService dependencies Co-authored-by: Mark Hopkin <[email protected]>
Hi @joshdover
For assets tab we have created more scenarios at #74353 Thanks!! |
Hi @joshdover, could you please checkout the boxes if the scenarios are correct. |
* Do not add fields to index patterns * remove redundant tests * install index patterns before package install * update remove comment * use import to create package assets Here I have also moved to importing all assets at once. This is essential when importing to ensure that all saved objects references are imported at once. There is also an efficiencey improvement. * Import index patterns * use resolve when deleting index patterns * fix: asset type validation * add option to override supported import types * make ml-module importable * Revert "add option to override supported import types" This reverts commit 1f48e6ee193fea5e5cb0f37c70cbfa7ae47eeab5. * remove hidden: false from ml-module * use resolve when deleting assets * make security-rule SO type importable * use bulkResolve to get package assets * fix tests * fix 'multiple' tests * remove unused function * create index patterns at the same time as other assets * remove unused test * Fix integration tests We were checking for an error before the import was complete. * tidy for PR * add missing test assets * do not attempt to delete missing assets * resolve any reference errors that occur on import * await installKibanaAssets immediately * show assets not found when assets installed in a different space * fix delete asset check on force upgrade * add comment about reference errors * remove a couple of appContextService dependencies
As part of the #27004, the IDs for many Saved Object types will change for objects installed by Fleet packages in spaces other than the "default" space.
These ID changes will break a few features in the Fleet UI:
This issue is intended to outline a short-term solution for this problem for the 8.0 release, while the long-term solution is to fully support Spaces within Fleet #99116.
Background
references
feature does not currently support pointing to objects in other spaces or of different "namespace types”. In other words, the references feature doesn’t support a global object (eg. a epm-package) to a non-global object (eg. dashboard).epm-packages
type to handle migrating the IDs in its internalinstalled_kibana
array.Proposed changes
Decision: We have decided to go with option (2) for the 8.0 release and have the option to pursue option (1) once the saved object types are shareable in a future 8.x release.
Option 1: Updating IDs on
epm-packages
(higher effort) - not possible until later in 8.xOnce a Saved Object type becomes shareable in 8.x, it's IDs will be re-written for all objects not in the default space. This will break the uninstall flow and asset links as noted at the top of the issue.
Given that we are not currently storing the space ID that an asset was installed into, in order to update the IDs on the
epm-packages
object, we're going to need to add some logic that runs on Kibana startup to find these objects and their new IDs:epm-packages
object:installed_kibana
asset in the package object:start
lifecycle, thecore.savedObjects.getTypeRegistry()
API exposes the details we need for each type. Specifically theconvertToMultiNamespaceTypeVersion
field should be<=
the current version.alias
saved objects that point this ID to another ID in each space.This would result in these assets existing in all the same spaces they existed in before and would not break any URL bookmarks pointing to these assets. It would also allow us to have a single Saved Object that represents these assets and would allow for clean uninstalls in the future.
Option 2: Reducing duplicates on package upgrades and installs (lower effort)
Alternatively, if we need to cut scope, we could take a shorter path forward and move from using the
bulkCreate
Saved Object API to using theimport
API. We would want to do this because if any Fleet assets are upgraded or re-created for any reason in a non-default Space, thebulkCreate
API will create duplicates, whereas theimport
API will overwrite the existing objects that were installed prior to 8.0.We'd also need to use the
resolve
API during the uninstall process and for populating the "assets" tab in the integrations UI for locating the new object IDs for assets installed in a non-default space.This option still has the drawbacks that exist today for all Fleet packages that are installed into a non-default Space:
This option has the additional drawback of leaving around some tech debt and broken ID references in the
epm-packages
objects for some time that we'll need to consider when adding any other features that reference these IDs or until #74353 is addressed.Implementation Scope
import
instead ofbulkCreate
here:kibana/x-pack/plugins/fleet/server/services/epm/kibana/assets/install.ts
Lines 169 to 171 in d2c6c41
SavedObjectImporter
class provided bysrc/core/server
.Readable
ndjson stream of objects, so we'll need to convert our objects into this format.{ createNewCopies: false, overwrite: true }
bulkResolve
pre-flight check in order to find the updated IDs before callingdelete
here:kibana/x-pack/plugins/fleet/server/services/epm/packages/remove.ts
Line 89 in d2c6c41
bulkResolve
to find the updated IDs for links.Option 3: Do nothing (zero effort)
If we do nothing, we'll have a similarly broken experience to what we have today. However, we'll be increasing the blast radius of the two issues presented above (uninstalls don't remove these objects and the asset links are broken), except it will be broken for all integrations installed in a non-default space whereas before they were only broken when viewing an integration from a different Space from where it was installed from.
As noted by @jportner below, it also creates the potential for alias conflicts for users who reinstall or upgrade a package in a non-default Space:
cc @jportner
The text was updated successfully, but these errors were encountered: