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] Fix fleet_server_hosts value in fleet/settings API #144898

Merged
merged 6 commits into from
Nov 10, 2022

Conversation

kpollich
Copy link
Member

@kpollich kpollich commented Nov 9, 2022

Summary

Resolve fleet_server_hosts from the new Fleet Server Host SO type instead of the settings SO.

Would like to add an integration test for this, but requires setting up a new "get settings" suite. Will push a follow-up commit.

Fixes elastic/fleet-server#2068

Checklist

image

@kpollich kpollich added release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team labels Nov 9, 2022
@kpollich kpollich requested a review from a team as a code owner November 9, 2022 13:48
@kpollich kpollich self-assigned this Nov 9, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

Copy link
Contributor

@juliaElastic juliaElastic left a comment

Choose a reason for hiding this comment

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

🚀

@criamico
Copy link
Contributor

criamico commented Nov 9, 2022

I have a broader question about this change. Are we keeping the /settings endpoint route as it is?

I originally thought we wanted to deprecate it in favour of the new endpoints, since settings gives the idea of reading/editing all the possible settings (also outputs, etc..) and not only the hosts.

EDIT: I see from the description that other teams are using this endpoint, so my comment is intended on the long run rather than the immediate.

@kpollich
Copy link
Member Author

kpollich commented Nov 9, 2022

I have a broader question about this change. Are we keeping the /settings endpoint route as it is?

I originally thought we wanted to deprecate it in favour of the new endpoints, since settings gives the idea of reading/editing all the possible settings (also outputs, etc..) and not only the hosts.

It's probably worth discussing, but it would make sense to do away with the singular /settings endpoint as we now have distinct resource types the drive Fleet's settings page:

  • Fleet Server Hosts
  • Outputs
  • Agent Binary Download Sources
  • (soon) Proxies

We no longer have a real use case for a unified /settings API as all the settings that drive this configuration experience are surfaced as their own, first-class API resources.

Still, this would be a breaking change, so we should work with other teams to determine an approach here. We'll also want to audit our client side code to make sure we're not relying on this settings API anywhere in Fleet's own codebase.

Probably something worth discussing in the Fleet API GA issue: #123150

@kpollich
Copy link
Member Author

kpollich commented Nov 9, 2022

@elasticmachine merge upstream

@@ -18,7 +18,8 @@ export default function (providerContext: FtrProviderContext) {
const esClient = getService('es');
const esArchiver = getService('esArchiver');

describe('Settings - update', async function () {
// Skipped as the Fleet Server hosts settings values are no longer used as of https://github.com/elastic/kibana/issues/137785
Copy link
Member Author

Choose a reason for hiding this comment

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

I think this is the right move to skip these tests - these are leftover from when we were using the /settings API to create new Fleet Server hosts. AFAIK this is no longer supported, as any Fleet Server Hosts within the Fleet settings saved object will be ignored. @nchaulet please correct me if I'm wrong here.

We'll probably want to remove this API altogether as part of the GA work.

Copy link
Member

Choose a reason for hiding this comment

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

Yes we probably want to remove these tests, and this API (at least the fleet_server_hosts) part should be removed as part of the GA work (we should already mark them as deprecated in the open API spec and point to new fleet server hosts endpoints)

throw err;
});
const fleetServerHosts = await listFleetServerHosts(soClient);
const numHostsUrls = fleetServerHosts.total;
Copy link
Member Author

Choose a reason for hiding this comment

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

I update this telemetry collector to use the new Fleet Server Hosts model for its calculation instead of the settings SO.

Copy link
Member

Choose a reason for hiding this comment

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

Good catch 👍

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Unknown metric groups

ESLint disabled in files

id before after diff
osquery 1 2 +1

ESLint disabled line counts

id before after diff
enterpriseSearch 19 21 +2
fleet 59 65 +6
osquery 108 113 +5
securitySolution 440 446 +6
total +19

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
fleet 67 73 +6
osquery 109 115 +6
securitySolution 517 523 +6
total +20

History

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

cc @kpollich

@kpollich kpollich merged commit db3572a into elastic:main Nov 10, 2022
@kibanamachine kibanamachine added v8.6.0 backport:skip This commit does not require backporting labels Nov 10, 2022
@kpollich kpollich deleted the fleet/fix-settings-fleet-server-hosts branch November 10, 2022 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v8.6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

/settings in Fleet API no longer lists Fleet endpoints - Fleet Scaling BLOCKER
7 participants