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] Create input package policy template assets when upgrading from type "integration" to "input" #149423

Closed
hop-dev opened this issue Jan 24, 2023 · 2 comments · Fixed by #151174
Assignees
Labels
estimate:medium Medium Estimated Level of Effort Team:Fleet Team label for Observability Data Collection Fleet team

Comments

@hop-dev
Copy link
Contributor

hop-dev commented Jan 24, 2023

Part of #133296

It is currently possible to change a package from type "integration" to type "input", package policy variables are mapped across.

Now that #145529 is complete, we create index and component templates for input packages at package policy creation time. Should we create these assets on package upgrade as well?

Considerations:

  1. What if the data stream already exists and is managed by a different package?

    • Currently, when creating a package policy, if a user elects to send data to an existing data stream then the API force flag must be used. On upgrade we should inform the user that the data stream exists and is not managed by the package, and allow them to proceed.
  2. Race conditions updating installed_es on installation SO

    • if a package has a lot of package policies e.g 1000 , and the user opts to automatically upgrade package policies, we would need to install 1000 lots of templates, the current code has basic concurrency control but is not designed for this level of concurrent work, we would have to do this installation in one go and updated installed_es once per package upgrade not once per package policy upgrade.
@hop-dev hop-dev added the Team:Fleet Team label for Observability Data Collection Fleet team label Jan 24, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@joshdover
Copy link
Contributor

Should we create these assets on package upgrade as well?

If we don't create them during upgrade, do we at least create them the next time the user goes to edit the policy? If we have that workaround, I'd see this as more optional, but I agree it's a painpoint we'd probably want to fix sooner than later.

@hop-dev hop-dev added the estimate:medium Medium Estimated Level of Effort label Jan 31, 2023
hop-dev added a commit that referenced this issue Feb 9, 2023
…gle package policy from type integration to input. (#150199)

## Summary

Part of #149423 

When upgrading a single package policy with conflicts, we use the update
package API. When we update from an input package to an integration
package, we need to create the per-policy assets. This PR detects if an
update is changing from an integration package to an input package and
creates the assets as part of the update.

I've added an integration test for this scenario.

---------

Co-authored-by: Nicolas Chaulet <[email protected]>
Co-authored-by: Kibana Machine <[email protected]>
hop-dev added a commit that referenced this issue Feb 15, 2023
…orrect assets (#151174)

## Summary

Closes #149423

Turns out no code changes needed after
#150199 🥳

Add tests for the `/api/fleet/package_policies/upgrade` and
`/api/fleet/package_policies/upgrade/dryrun` endpoints to verify they
create the package policy assets when upgrading from an integration of
type integration to type input.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
estimate:medium Medium Estimated Level of Effort Team:Fleet Team label for Observability Data Collection Fleet team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants