Skip to content
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

[EPM] Use index templates v2 #64305

Merged
merged 9 commits into from
Apr 28, 2020
Merged

[EPM] Use index templates v2 #64305

merged 9 commits into from
Apr 28, 2020

Conversation

skh
Copy link
Contributor

@skh skh commented Apr 23, 2020

Summary

Implements the alpha1 / 7.8 parts of #63950

  • handles v1 and v2 prebuilt index templates in the base package
  • only generates v2 index templates for package datasets

This should not affect how we update packages, as long as we don't use index template composition for generated v2 index templates.

How to test this

  • Run this PR against our default package registry, with a fresh elasticsearch database (e.g. by restarting yarn es snapshot).
  • Kibana should start without errors, login should work without errors.
  • Verify in the Kibana dev console or with curl that after login, GET _cat/templates correctly lists all packages from the base package that was installed during setup (that is, event-mappings, event-settings, logs-mappings, logs-settings, metrics-mappings and metrics-settings.


  • Now verify (running against either package registry) that GET _index_template correctly returns a v2 index template for every dataset from the system package.
  • Add a datasource for the nginx package, thereby triggering the installation of this package. This should work without error too. Again, verify with GET _index_template that index templates have been installed for all datasets of the package.
  • In the UI, delete the newly created nginx-1 datasource, then uninstall the nginx integration. Both operation should complete without errors.
  • Verify with GET _index_template that the nginx index templates have been removed.
  • Try to break it in any other way!

@skh skh self-assigned this Apr 23, 2020
@skh skh added Feature:EPM Fleet team's Elastic Package Manager (aka Integrations) project Team:Fleet Team label for Observability Data Collection Fleet team v7.8 v8.0.0 labels Apr 23, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/ingest-management (Team:Ingest Management)

@skh skh added v7.8.0 and removed v7.8 labels Apr 23, 2020
@skh skh changed the title Install prebuilt index templates as v2 [EPM] Use index templates v2 Apr 23, 2020
@skh skh added the release_note:skip Skip the PR/issue when compiling release notes label Apr 23, 2020
@skh skh marked this pull request as ready for review April 27, 2020 16:03
@skh skh requested a review from a team April 27, 2020 16:03
Copy link
Member

@ruflin ruflin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this with elastic/package-registry#392 and works as expected.

@skh At the moment all the mappings for metrics-system.cpu are directly in this template. As a next step I would suggest to also use components here so we have metrics-system.cpu-mapping component, this will make it natural if we add later metrics-system.cpu-settings.

@skh
Copy link
Contributor Author

skh commented Apr 28, 2020

As a next step I would suggest to also use components here so we have metrics-system.cpu-mapping component, this will make it natural if we add later metrics-system.cpu-settings.

For alpha 1?

@skh
Copy link
Contributor Author

skh commented Apr 28, 2020

@elasticmachine merge upstream

@ruflin
Copy link
Member

ruflin commented Apr 28, 2020

@skh Alpha 1 question: No.

@skh
Copy link
Contributor Author

skh commented Apr 28, 2020

@ruflin See the 7.9 / beta1 section of #63950.

@skh
Copy link
Contributor Author

skh commented Apr 28, 2020

I did forget to handle index template deletion, 351a051 fixes that.

To test this:

  • after creating a datasource for nginx, verify that the index templates have been installed correctly with GET _index_template.
  • In the UI, delete the newly created nginx-1 datasource, then uninstall the nginx integration. Both operation should complete without errors.
  • Verify with GET _index_template that the nginx index templates have been removed.

@skh
Copy link
Contributor Author

skh commented Apr 28, 2020

@ruflin thanks for the approval!
@neptunian Your review would be much appreciated. I'm not entirely sure how to test the upgrade scenario.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@ruflin
Copy link
Member

ruflin commented Apr 28, 2020

Also tested the deleting part for nginx and templates are removed again on uninstall.

@skh skh merged commit 512e097 into elastic:master Apr 28, 2020
skh added a commit to skh/kibana that referenced this pull request Apr 28, 2020
* Install prebuilt index templates as v2

* Correctly handle pre-build v1 index templates

* Generate index templates v2 during package install

* Update unit tests for index template v2

* Fix imports.

* Fix types.

* Use index template v2 API for template deletion

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
skh added a commit that referenced this pull request Apr 29, 2020
* Install prebuilt index templates as v2

* Correctly handle pre-build v1 index templates

* Generate index templates v2 during package install

* Update unit tests for index template v2

* Fix imports.

* Fix types.

* Use index template v2 API for template deletion

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:EPM Fleet team's Elastic Package Manager (aka Integrations) project release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v7.8.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants