-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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] Add "Keep Policies up to Date" functionality for integrations #112702
[Fleet] Add "Keep Policies up to Date" functionality for integrations #112702
Conversation
...ins/fleet/public/applications/integrations/sections/epm/screens/detail/settings/settings.tsx
Outdated
Show resolved
Hide resolved
- Move keep policies up to date switch to separate component - Use PACKAGE_POLICY_SAVED_OBJECT_TYPE instead of magic string
@juliaElastic thanks for the review! I've addressed your comments in f332f7e Since CI is finally green for this I'm marking it as ready for review 🎉 |
@elasticmachine merge upstream |
FYI I tested the changes to the |
...ins/fleet/public/applications/integrations/sections/epm/screens/detail/settings/settings.tsx
Show resolved
Hide resolved
x-pack/plugins/fleet/server/services/epm/packages/_install_package.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did some local testing and everything seems to work as expected 🚀
- Don't index keep_policies_up_to_date field - Use SO_SEARCH_LIMIT constant instead of magic number
💛 Build succeeded, but was flaky
Test FailuresKibana Pipeline / general / Allows the rule to be duplicated from the edit screen.indicator match Detection rules, Indicator Match Duplicates the indicator rule Allows the rule to be duplicated from the edit screenStack Trace
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Page load bundle
Saved Objects .kibana field count
History
To update your PR or re-run it, just comment with: cc @kpollich |
…elastic#112702) * Add initial implementation for keep policies up to date functionality * Upgrade package policies during preconfiguration check * Only show keep policies up to date switch for default/auto-update packages * Fix type error * Fixup setup policy upgrade logic * Add migration for keep policies up to date flag * Move setup package policy logic to new module + add tests * Update snapshots to include keepPoliciesUpToDate field * Fix type errors * Fix some CI failures * Fix more type errors * Fix type error in isolation test * Fix package fixtures types * Fix another type error * Move policy upgrade error swallowing up a level in setup * Address PR feedback - Move keep policies up to date switch to separate component - Use PACKAGE_POLICY_SAVED_OBJECT_TYPE instead of magic string * Fix overwriting user values when upgrading Fixes elastic#113731 * Add test package * Fix tests for overridePackageVars * Address PR feedback - Don't index keep_policies_up_to_date field - Use SO_SEARCH_LIMIT constant instead of magic number * Make toast translation usage more consistent Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
…#112702) (#113972) * Add initial implementation for keep policies up to date functionality * Upgrade package policies during preconfiguration check * Only show keep policies up to date switch for default/auto-update packages * Fix type error * Fixup setup policy upgrade logic * Add migration for keep policies up to date flag * Move setup package policy logic to new module + add tests * Update snapshots to include keepPoliciesUpToDate field * Fix type errors * Fix some CI failures * Fix more type errors * Fix type error in isolation test * Fix package fixtures types * Fix another type error * Move policy upgrade error swallowing up a level in setup * Address PR feedback - Move keep policies up to date switch to separate component - Use PACKAGE_POLICY_SAVED_OBJECT_TYPE instead of magic string * Fix overwriting user values when upgrading Fixes #113731 * Add test package * Fix tests for overridePackageVars * Address PR feedback - Don't index keep_policies_up_to_date field - Use SO_SEARCH_LIMIT constant instead of magic number * Make toast translation usage more consistent Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Kyle Pollich <kyle.pollich@elastic.co>
Hi @kpollich We have below queries on this merges regarding auto upgrade of default or managed integrations. As far as we have noticed earlier also, these integrations were capable of auto upgrading by default.
So here, question arises, in which situation does this setting be helpful, when during build creation it automatically downloads latest version for default packages. Screenshot: Thanks |
@dikshachauhan-qasource - thanks very much for your questions. I'll try to answer them below.
The "Keep Policies up to date" setting is intended to allow users to opt into keeping "managed" or "internal" integration policies for integrations like If the user does not opt into this functionality using the checkbox, endpoint will still be updated to its latest version, the user will just need to manually upgrade all of their policies after the fact. The intent of the checkbox is to make this entire process automatic and avoid the need for user intervention. It's essentially an opt-in to allow Fleet to manage everything top-to-bottom for its associated with its various managed integrations.
The checkbox does not have any bearing on the actual package updating process. kibana/x-pack/plugins/fleet/common/constants/epm.ts Lines 46 to 50 in de59cfe
The "Keep Policies up to date" checkbox only controls whether Fleet will automatically upgrade and deploy new policy versions when a new version of the package is installed.
I'm not sure this is related to any new functionality. @jen-huang @nchaulet can you advise? That error message above seems to pre-date any of the policy upgrade implementations. I'm not sure we've ever supported downgrading managed packages in this way. |
No it's not a new functionality you cannot install an old version of a package unless you pass the |
Hi @kpollich We have validated auto upgrade of package with policies as well on 7.16 BC1 build and found below reported issues.
Validated on 7.16 BC1. Build details are as follows: Further, Once fixes are available, we will start working upon testcases too under this feature for appropriate coverage. Thanks |
Summary
Final implementation piece of #106048
Adds a "Keep Policies Up to Date" setting to Elastic Agent integrations that allows Fleet to automatically upgrade integration policies when a new version of a package is installed. This setting is only exposed for "managed" packages that are specified in
AUTO_UPGRADE_PACKAGES
orDEFAULT_PACKAGES
.During calls to
/api/fleet/setup
, we now upgrade policies for any packages flagged withkeep_policies_up_to_date: true
, or those that appear in our hardcodedAUTO_UPGRADE_PACKAGES
list in our preconfiguration constants.08811a1 fixes #113731
Screen Recording
To-DoIntegrations > Integration details > Settings
to match designKeep policies up-to-date
checkbox and description