Skip to content

[Fleet] Improve Functionality around Managed Package Policies#114526

Merged
kpollich merged 14 commits intoelastic:masterfrom
kpollich:114306-enable-auto-updates-synthetics-apm
Oct 14, 2021
Merged

[Fleet] Improve Functionality around Managed Package Policies#114526
kpollich merged 14 commits intoelastic:masterfrom
kpollich:114306-enable-auto-updates-synthetics-apm

Conversation

@kpollich
Copy link
Copy Markdown
Member

@kpollich kpollich commented Oct 11, 2021

Summary

Ref #114306

This is a repurposed PR that initially handled adding functionality such that APM and Synthetics would automatically have their policies upgraded as part of Fleet's preconfiguration/setup flow. That concept was altered, but there were still some valuable pieces here, namely:

  • Prevent upgrade attempts for up-to-date policies
  • Perform a dry run to catch granular conflicts and report them as non-fatal errors along with the full diff in a new packagePolicyUpgradeResults value returned from setup API calls
  • Improve test coverage for managed package policy logic

We need to perform a dry run before upgrading package policies during setup, because our packagePolicyService.upgrade method does not report errors or return a diff in the same manner as our dry run process. By running the dry run first, we can report granular errors and the full upgrade diff in the event of a conflict.

@kpollich kpollich added v8.0.0 release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team auto-backport Deprecated - use backport:version if exact versions are needed v7.16.0 labels Oct 11, 2021
@kpollich kpollich self-assigned this Oct 11, 2021
@kpollich kpollich marked this pull request as ready for review October 12, 2021 12:19
@kpollich kpollich requested a review from a team as a code owner October 12, 2021 12:19
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/fleet (Team:Fleet)

@kpollich kpollich changed the title [WIP] [Fleet] Enable auto policy upgrades for APM and Synthetics [Fleet] Enable auto policy upgrades for APM and Synthetics Oct 12, 2021
@kpollich
Copy link
Copy Markdown
Member Author

@elasticmachine merge upstream

@kpollich
Copy link
Copy Markdown
Member Author

@elasticmachine merge upstream

@kpollich kpollich changed the title [Fleet] Enable auto policy upgrades for APM and Synthetics [Fleet] Improve Functionality around Managed Package Policies Oct 13, 2021
({ policy }) => policy?.package_policies as string[]
);
const fulfilledPolicyPackagePolicyIds = fulfilledPolicies
.filter(({ policy }) => policy?.package_policies)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nchaulet - Here's the fix for that Not Found error we were throwing in tests yesterday

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great 👍 I am still wondering how this happen in the first place (a default agent policy without package policies)

@kibanamachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @kpollich

Copy link
Copy Markdown
Member

@nchaulet nchaulet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 🚀

@kpollich kpollich merged commit 187d949 into elastic:master Oct 14, 2021
@kpollich kpollich deleted the 114306-enable-auto-updates-synthetics-apm branch October 14, 2021 11:19
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Oct 14, 2021
…c#114526)

* Enabled auto policy upgrades for APM and Synthetics

* fixup! Enabled auto policy upgrades for APM and Synthetics

* Rework preconfiguration policy upgrade flow + report errors

* Fix type error in test

* Fix type errors + tests

* wip

* Remove keep policies up to date checks

* Remove references to KEEP_POLICIES_UP_TO_DATE_PACKAGES

* Move package policy upgrade results to nonFatalErrors

* Fix types

* Fix type error

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
@kibanamachine
Copy link
Copy Markdown
Contributor

💚 Backport successful

Status Branch Result
7.x

This backport PR will be merged automatically after passing CI.

jloleysens added a commit to jloleysens/kibana that referenced this pull request Oct 14, 2021
…mple/introduce-baseline-tests

* 'master' of github.com:elastic/kibana: (55 commits)
  [Fleet] Improve Functionality around Managed Package Policies (elastic#114526)
  cleanup (elastic#114902)
  remove stray semicolon (elastic#114969)
  [Security Solution] Edit host isolation exception IP UI (elastic#114279)
  [ML] APM Correlations: Round duration values to be used in range aggregations. (elastic#114833)
  [Index Management] Added `data-test-subj` values to the index context menu buttons (elastic#114900)
  [Stack monitoring] Fix logstash functional tests for react (elastic#114819)
  Implement hybrid approach to writing rule execution event logs (elastic#114852)
  [Detection Rules] Add 7.16 rules (elastic#114939)
  Fixing exceptions export format (elastic#114920)
  Clean up inaccurate comments (elastic#114935)
  chore(NA): fixes a typo on persist_bazel_cache.sh comment (elastic#114943)
  [ci] Fixes Bazel cache writes (elastic#114915)
  fix package.json: (elastic#114936)
  [Controls] Redux Toolkit and Embeddable Redux Wrapper (elastic#114371)
  [APM] Fixes incorrect index config names (elastic#114901) (elastic#114904)
  [Workplace Search] Fix button order and remove extra source name label (elastic#114899)
  [Actions] Fixed actions telemetry for multiple namespaces usage (elastic#114748)
  docs: fix config names (elastic#114903)
  Update kibana to EMS 7.16 (elastic#114865)
  ...
kibanamachine added a commit that referenced this pull request Oct 14, 2021
… (#114980)

* Enabled auto policy upgrades for APM and Synthetics

* fixup! Enabled auto policy upgrades for APM and Synthetics

* Rework preconfiguration policy upgrade flow + report errors

* Fix type error in test

* Fix type errors + tests

* wip

* Remove keep policies up to date checks

* Remove references to KEEP_POLICIES_UP_TO_DATE_PACKAGES

* Move package policy upgrade results to nonFatalErrors

* Fix types

* Fix type error

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kyle Pollich <kyle.pollich@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Deprecated - use backport:version if exact versions are needed release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v7.16.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants