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][Discuss] Integration-specific saved object migration #94480

Open
jfsiii opened this issue Mar 11, 2021 · 8 comments
Open

[Fleet][Discuss] Integration-specific saved object migration #94480

jfsiii opened this issue Mar 11, 2021 · 8 comments
Labels
Team:Fleet Team label for Observability Data Collection Fleet team technical debt Improvement of the software architecture and operational architecture

Comments

@jfsiii
Copy link
Contributor

jfsiii commented Mar 11, 2021

Follow up ticket from #94171

Background

There are two places where fleet runs a saved object migration only for a specific integration. In both cases security_solution updates the package policy saved object.

Questions

How common a need do we think this is?

It's only security_solution at the moment, but might apm need this? Should nginx be able to do this?

Is the current approach reasonable or should we do something else?

Initially the migration code was stored in the plugin, and fleet imported and ran it. That caused a circular reference between the two, so #94171 moved it into fleet.

Adding integration-specific code in fleet feels like something to avoid. Each new integration-specific migration requires commit to fleet code. Ideally, the migration code is defined in the various plugin directories like before but if a) fleet has to run them b) at startup we're back at the circular reference issue.

Must fleet run these migrations? Can we push the definition and execution into the plugins?

Perhaps this really is for a small set of exceptional cases and we can live with it. I just want to get a better sense of what type/rate of tech debt this is.

@jfsiii jfsiii added the Team:Fleet Team label for Observability Data Collection Fleet team label Mar 11, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@nchaulet
Copy link
Member

I think this could be related to the package upgrade discussion we have currently as there is some "bugs" in the current implementation with saved object migration as the agents do not get the new policy immediately but only when the agent policy will be updated.

@ruflin
Copy link
Member

ruflin commented Mar 15, 2021

Agree that fleet should not run integration specific migrations. But I see some reasons that solutions with a package want to provide special logic for some of the migrations. What is the reasons this needs to be triggered by fleet? Couldn't the code be in Endpoint for example and then Endpoint only talks to Fleet API's to do a migration?

@ph ph assigned paul-tavares and unassigned ph Mar 15, 2021
@paul-tavares
Copy link
Contributor

paul-tavares commented Mar 17, 2021

Following our sync meeting this past week:

I think migration for integration policies fall in two categories:

  • migrations needed as part of stack upgrade
  • migration needed as part of a package install (upgrade)

We have not had the need for migration at package install time. We have been using the "stack upgrade" approach by "plugin into" the fleet SO migrations and only processing integration policies that are endpoint (I realize now that the updates never make it down to the agent/endpoint until a user changes something again). We need this for a few reasons:

  1. new features are introduced with endpoint security that we would like to apply defaults to for existing policies (ex. introduction of malware, etc)
  2. compatibility with existing stack changes (ex. move to fleet-server)

From the cases I have seen thus far, I think both of these endpoint cases could be addressed by moving the migration to the package install activity and allowing an extension point to be register a callback that would then perform the migration. I say this because Endpoint integration is set as a required package and I think (🤔 ) it is upgraded auto-magically whenever a new version of it shows up. But that would also imply that we would all need to develop the infrastructure for running package integration migrations (like: accounting for skipped versions, etc..).

The goal ultimately is: to ensure that policies remain compatible with the existing version of the stack before the APIs are available for use and/or the package is upgraded.

/cc: @scunningham , @kevinlog

@paul-tavares
Copy link
Contributor

One last thing:
The immediate need is for v7.13 - endpoint needs to migrate their Integration Policies in order to adjust the relative URL for artifacts, since those artifacts are now downloaded from fleet-server and not kibana. It feels as if this issue here will require a longer time frame to brainstorm and design a migration path for integrations.

@jfsiii , @ruflin , @nchaulet : How do you all feel about us continuing to use the existing SO migration for now until we can come up with a better approach?

@nchaulet
Copy link
Member

@paul-tavares I think for the specific case of 7.13 and the move to fleet server it will make sense 👍

@paul-tavares
Copy link
Contributor

Thanks @nchaulet . BTW - I think I need to bring back the feature flag you removed (temporary). our migration should only run if fleet-server enabled until we shut down the kibana agent code

@jen-huang jen-huang added the technical debt Improvement of the software architecture and operational architecture label Apr 28, 2021
@paul-tavares paul-tavares removed their assignment May 28, 2021
@paul-tavares
Copy link
Contributor

Note: I removed myself from the assignee field. Not sure that I should be assigned to this, but am glad to contribute/collaborate on a possible solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Fleet Team label for Observability Data Collection Fleet team technical debt Improvement of the software architecture and operational architecture
Projects
None yet
Development

No branches or pull requests

7 participants