[Fleet] Migrate inputs when migrate_from field is found#242934
[Fleet] Migrate inputs when migrate_from field is found#242934criamico merged 26 commits intoelastic:mainfrom
Conversation
|
@elasticmachine merge upstream |
|
@elasticmachine merge upstream |
|
Pinging @elastic/fleet (Team:Fleet) |
|
@elasticmachine merge upstream |
| // input should never be auto-enabled or have user configuration carried into it. | ||
|
|
||
| let originalInputToMigrate: NewPackagePolicyInput | undefined; | ||
| if (update.migrate_from !== undefined && !update.deprecated) { |
There was a problem hiding this comment.
it would be nice to break down this logic to smaller functions
| update.streams = update.streams.map((newStream, idx) => { | ||
| let oldStream; | ||
|
|
||
| // Migrate stream-level vars by position since datasets differ between input types. |
There was a problem hiding this comment.
Do I understand this correctly in that we assume that the old and new input types have an equivalent set of streams in the same order? Or could it happen that the new input type has more or fewer streams than the old one? Should there be an explicit check for this?
There was a problem hiding this comment.
Good question, I assumed that the migration is to an equivalent set of streams, but I have to ask the integration team. There was a similar discussion here but I'm not 100% sure about the streams.
| // input should never be auto-enabled or have user configuration carried into it. | ||
|
|
||
| let originalInputToMigrate: NewPackagePolicyInput | undefined; | ||
| if (update.migrate_from !== undefined && !update.deprecated) { |
There was a problem hiding this comment.
For my understanding: migrate_from doesn't seem to be cleaned up after migration, but that shouldn't be a concern on a future upgrade?
There was a problem hiding this comment.
migrate_from comes directly from the package and it's not stored anywhere, so if the next version doesn't have it anymore it shouldn't be a concern.
...lic/applications/fleet/sections/agent_policy/edit_package_policy_page/components/upgrade.tsx
Outdated
Show resolved
Hide resolved
|
@elasticmachine merge upstream |
|
@elasticmachine merge upstream |
|
@elasticmachine merge upstream |
|
@elasticmachine merge upstream |
|
@elasticmachine merge upstream |
|
@elasticmachine merge upstream |
⏳ Build in-progress
History
cc @criamico |
Related to elastic/package-spec#956 Package-spec PR: elastic/package-spec#1021 ## Summary Migrate inputs and vars when `migrate_from` field is found. **Please note:** for some integrations this migration path will require a change at elastic agent level. See elastic/package-spec#956 (comment) - Enable the new input and carries over its values from the old one - Inputs and variables that were enabled are now carried to the new version; however the state is maintained: if a variable is disabled, it stays disabled - Modified the secret handling so the existing secret references get carried over to the new inputs - Verified that this logic only run on package policy upgrade, when there is migrate_from present and Fleet detects a difference in input type - Add visual information about the migration Example with a test integration: https://github.com/user-attachments/assets/aaa56904-05d7-47b2-955b-5ae7a2c26c97 ### Testing This was tested with a test version of sentinelOne (not finalized yet): https://github.com/elastic/integrations/compare/main...kcreddy:sentinel_one-migrate-inputs?expand=1 ### Screenshots <img width="1641" height="1540" alt="Screenshot 2026-03-19 at 17 07 17" src="https://github.com/user-attachments/assets/819e46cd-823a-47df-8ef2-4fbce8900b53" /> <img width="1628" height="1524" alt="Screenshot 2026-03-19 at 17 07 43" src="https://github.com/user-attachments/assets/c5f97183-bcfd-496a-9882-e170323246e3" /> ### Checklist Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [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: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Related to elastic/package-spec#956
Package-spec PR: elastic/package-spec#1021
Summary
Migrate inputs and vars when
migrate_fromfield is found.Please note: for some integrations this migration path will require a change at elastic agent level. See elastic/package-spec#956 (comment)
Example with a test integration:
https://github.com/user-attachments/assets/aaa56904-05d7-47b2-955b-5ae7a2c26c97
Testing
This was tested with a test version of sentinelOne (not finalized yet): https://github.com/elastic/integrations/compare/main...kcreddy:sentinel_one-migrate-inputs?expand=1
Screenshots
Checklist
Reviewers should verify this PR satisfies this list as well.