-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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] Update logic for "Keep policies up to date" defaults in 8.0 #119126
Conversation
Pinging @elastic/fleet (Team:Fleet) |
@@ -534,9 +534,9 @@ export async function createInstallation(options: { | |||
const removable = !isUnremovablePackage(pkgName); | |||
const toSaveESIndexPatterns = generateESIndexPatterns(packageInfo.data_streams); | |||
|
|||
// For default packages, default the `keep_policies_up_to_date` setting to true. For all other | |||
// package, default it to false. | |||
const defaultKeepPoliciesUpToDate = DEFAULT_PACKAGES.some( |
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.
The original intent here should have been to leave keep_policies_up_to_date
set to undefined
unless it was explicitly set by the user, but this code introduced in #116993 sets the default value to false
instead for any non-default package that's installed.
Because we explicitly set this to false
during installation for any non-default package, we can't reliably honor user settings during our migration.
For example, if a user installed apm
on their 7.16 Kibana instance, the installation SO would have keep_policies_up_to_date: false
. So, we have to make a choice in this PR whether we should discard any user-provided value for keep_policies_up_to_date
on managed policies and simply set them all globally to true
.
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.
To close the loop here, I spoke with Josh offline and got a few pieces of direction here.
- The only packages that must have their policies upgraded are
APM
andSynthetics
- We shouldn't automatically opt
system
into keeping policies up to date, because it's widely used and could cause rollout/performance issues in environments with many agents
With those two things in mind, I elected to make the changes detailed in my previous comment.
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.
Tested locally, LGTM
@@ -72,6 +72,8 @@ export const AUTO_UPDATE_PACKAGES = autoUpdatePackages.map((name) => ({ | |||
version: PRECONFIGURATION_LATEST_KEYWORD, | |||
})); | |||
|
|||
export const MANAGED_PACKAGES = [...DEFAULT_PACKAGES, ...AUTO_UPDATE_PACKAGES]; |
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.
I found the naming kind of confusing we already use the managed term for the preconfigured policy (Probably a bad naming) but what about a more explicit name here like KEEP_POLICIES_UP_TO_DATE_PACKAGES
I pushed up 7a444a4 which makes a few changes to our logic here
|
@elasticmachine merge upstream |
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.
Thanks for changing the naming and all the comments make things a lot more better 🚀
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: cc @kpollich |
…lastic#119126) * Auto-upgrade policies for all managed packages by default * Fixing unused import in test * Add migration to installation list * Update naming + disable input for APM + Synthetics * Remove unused import + add message for disabled policy update settingg * Fix failing tests Co-authored-by: Kibana Machine <[email protected]>
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
…119126) (#119270) * Auto-upgrade policies for all managed packages by default * Fixing unused import in test * Add migration to installation list * Update naming + disable input for APM + Synthetics * Remove unused import + add message for disabled policy update settingg * Fix failing tests Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Kyle Pollich <[email protected]>
…119126) * Auto-upgrade policies for all managed packages by default * Fixing unused import in test * Add migration to installation list * Update naming + disable input for APM + Synthetics * Remove unused import + add message for disabled policy update settingg * Fix failing tests Co-authored-by: Kibana Machine <[email protected]>
…lastic#119126) * Auto-upgrade policies for all managed packages by default * Fixing unused import in test * Add migration to installation list * Update naming + disable input for APM + Synthetics * Remove unused import + add message for disabled policy update settingg * Fix failing tests Co-authored-by: Kibana Machine <[email protected]>
Summary
Ref #111858
Introduces two new constants that control the functionality around our
keep_policies_up_to_date
field:KEEP_POLICIES_UP_TO_DATE_PACKAGES
- controls packages on which we allow users to configurekeep_policies_up_to_date
via the integration settings UIAUTO_UPGRADE_POLICIES_PACKAGES
- list of packages for which we defaultkeep_policies_up_to_date
totrue
, and do not allow users to opt out.Previously, we applied a default of
true
to allDEFAULT_PACKAGES
, but in reality, the only packages that are required to opt into this behavior are APM and Synthetics - which we consider "stack-aligned" due to shipping custom policy editor UI's with Kibana. So, in this PR we've added a migration to setkeep_policies_up_to_date: true
for these two packages. Previously supplied values for default packages will remain in place, and the migration only touchesAUTO_UPGRADE_POLICIES_PACKAGES
.To summarize:
keep_policies_up_date
defaultsystem
,fleet_server
)For historical context around "stack aligned package upgrades", see these issues:
In 7.16, we pared down the implementation here to avoid breakages. With 8.0 as the target for this change, it seems appropriate that we ease our concerns for breaking changes.
For some additional context, our initial plan around this functionality was to push the "auto-upgrade policies" opt-in out into the package spec via this change proposal: elastic/package-spec#244. However, it seems after some thorough and helpful conversations with members of the ecosystem team, we won't land on exactly the functionality we initially specced out. Things are still in flight here, so for the time being we've elected to unblock ourselves and continue relying on our hardcoded package lists to support automatic policy upgrades for our various managed packages.
With this PR the list of "managed" packages in 8.0 will be
system
elastic_agent
fleet_server
endpoint
apm
synthetics
Related issues
Testing Instructions
Installation Path
apm
integrationUpgrade Path
<kibana>/integrations/detail/apm-0.4.0/overview
and add theapm
integrationapm
integration policy has been upgraded