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

[Fleet] Use default component templates from Elasticsearch #163731

Merged
merged 15 commits into from
Nov 2, 2023

Conversation

joshdover
Copy link
Contributor

@joshdover joshdover commented Aug 11, 2023

Summary

Fixes #163141
Fixes #160288

Blocked by:

This switches where integrations installed by EPM get their default index settings from to use the source-of-truth component templates supplied by Elasticsearch. This will help ensure that data streams configured by EPM always get the same defaults as data streams the user creates using the default logs-*-* and metrics-*-* templates. For now, no default mappings are sourced from Elasticsearch.

As part of this change the template format version was incremented to force EPM to reinstall all templates and rollover data streams on the Stack upgrade to the version including this change.

Checklist

Delete any items that are not applicable to this PR.

@apmmachine
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • /oblt-deploy-serverless : Deploy a serverless Kibana instance using the Observability test environments.
  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@felixbarny
Copy link
Member

elastic/elasticsearch#99975 has just been merged so this should be unblocked now.

@jpountz last chance for objections.

@joshdover
Copy link
Contributor Author

Thanks for the ping, @felixbarny. I'll get this updated soon

@joshdover joshdover force-pushed the fleet/es-default-components branch from 5445274 to b3b0064 Compare October 30, 2023 13:04
@joshdover joshdover marked this pull request as ready for review October 30, 2023 13:04
@joshdover joshdover requested a review from a team as a code owner October 30, 2023 13:04
@joshdover joshdover added release_note:enhancement Team:Fleet Team label for Observability Data Collection Fleet team labels Oct 30, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

Copy link
Member

@kpollich kpollich left a comment

Choose a reason for hiding this comment

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

LGTM, one minor comment

@joshdover joshdover requested a review from a team as a code owner October 31, 2023 16:45
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

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

@@ -242,7 +251,7 @@ const updateIndexTemplate = async (
aliases: template?.aliases,
},
_meta,
composed_of: composedOf,
composed_of: composedOf.filter((ct) => ct !== STACK_COMPONENT_TEMPLATE_LOGS_SETTINGS),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@elastic/kibana-cloud-security-posture Not basing the CSP transform index on the logs@settings template was necessary due to the logs@settings template on serverless specifying a default lifecycle. I could not find a way to override this from the index template, so instead I decided to filter this out for now and just manually specify the settings that were used before.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I do think we should remove this special initialization of the transform and index template and use the dedicated feature provided by Fleet for setting up transforms which would not have this issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

@CohenIdo CohenIdo enabled auto-merge (squash) November 1, 2023 11:54
@CohenIdo CohenIdo disabled auto-merge November 1, 2023 11:54
codec?: string;
mapping?: {
ignore_malformed: boolean;
};
Copy link
Contributor

@CohenIdo CohenIdo Nov 2, 2023

Choose a reason for hiding this comment

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

@joshdover, what those 2 new attributes are using for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These attributes were already being supplied previously by Fleet in the index template you were copying. With this PR, they're not longer added directly to the index template and instead are sourced from the logs@settings component template.

Since I'm filtering that component template out as mentioned above, I added these settings back explicitly to ensure that this index gets the same settings as it did before this change. I'll leave it to your team to decide if you need these settings or not, but they generally should help reduce storage costs and not drop any data.

@@ -242,7 +251,7 @@ const updateIndexTemplate = async (
aliases: template?.aliases,
},
_meta,
composed_of: composedOf,
composed_of: composedOf.filter((ct) => ct !== STACK_COMPONENT_TEMPLATE_LOGS_SETTINGS),
Copy link
Contributor

Choose a reason for hiding this comment

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

@joshdover joshdover merged commit ca90574 into elastic:main Nov 2, 2023
@joshdover joshdover deleted the fleet/es-default-components branch November 2, 2023 08:55
@kibanamachine kibanamachine added v8.12.0 backport:skip This commit does not require backporting labels Nov 2, 2023
delanni pushed a commit to delanni/kibana that referenced this pull request Nov 6, 2023
…63731)

## Summary

Fixes elastic#163141
Fixes elastic#160288

Blocked by:
- elastic/elasticsearch#98535

This switches where integrations installed by EPM get their default
index settings from to use the [source-of-truth component templates
supplied by
Elasticsearch](https://github.com/elastic/elasticsearch/tree/main/x-pack/plugin/core/template-resources/src/main/resources).
This will help ensure that data streams configured by EPM always get the
same defaults as data streams the user creates using the default
`logs-*-*` and `metrics-*-*` templates. For now, no default mappings are
sourced from Elasticsearch.

As part of this change the template format version was incremented to
force EPM to reinstall all templates and rollover data streams on the
Stack upgrade to the version including this change.

### Checklist

Delete any items that are not applicable to this PR.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: kibanamachine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:enhancement Team:Fleet Team label for Observability Data Collection Fleet team v8.12.0
Projects
None yet
8 participants