Extract hosts/pods/containers/services assets #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Closes elastic/kibana#155870
The change introduces asset-scoped queries for hosts, pods, containers and services. Each query is responsible for building documents of a single type and setting relationships found in the documents metadata. The queries are only building assets of the concerned type and not the related ones; for example if host document contains pod metadata, the host logic will set the pod ean as a child, but leave the pod asset creation to the pod logic. This may create dangling references but keeps the post processing of each query simple, and can be updated later if needed.
Testing
config.json
(I used edge-oblt as source and local es as dest)npx ts-node run.ts --read=<source> --write=<dest>
assets-*
data streamsGET kbn:/api/asset-manager/assets/related?relation=ancestors&from=2023-05-05T00:00:00.000Z&ean=service:emailService&maxDistance=3
)