Ensure fleet deployment uses fleet url provided by fleet_server_host_id#225699
Conversation
|
This draft PR at this point is to more so demo the issue and a "for now" path we could take, but @jen-huang given the underlying issue for this, it seems that maybe the more durable solution, and what I lean towards, would be to have When I was working in this area I came across the code comment linking to: which led me to the draft that you put up recently related to that here: If I take the path I'm proposing (using constants and not relying in req params for agentless), I don't want to create too much merge conflict for what you are setting up there. That said, I could just branch off your draft instead and work towards that direction and PR to your branch. What do you think? |
I would be in favor of continuing with the patch you have here that reads from the policy's This will ensure that the |
|
Pinging @elastic/fleet (Team:Fleet) |
💚 Build Succeeded
Metrics [docs]
History
|
|
Starting backport for target branches: 9.1 |
…id (elastic#225699) ## Summary Resolves: elastic#221900 In an ECH environment, if a user creates a new fleet server and sets it as default, a new agentless deployment can be created that uses the url of the new default fleet server, but the enrollment API key of the expected preconfigured fleet server. For agentless deployments, we'll want to use the default managed fleet server provided in the cloud environment. This PR ensures we use the fleet server id provided in the request to obtain the url. --------- Co-authored-by: Julia Bardi <90178898+juliaElastic@users.noreply.github.com> (cherry picked from commit 09abd61)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…_host_id (#225699) (#225871) # Backport This will backport the following commits from `main` to `9.1`: - [Ensure fleet deployment uses fleet url provided by fleet_server_host_id (#225699)](#225699) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Michel Losier","email":"michel.losier@elastic.co"},"sourceCommit":{"committedDate":"2025-06-30T15:19:45Z","message":"Ensure fleet deployment uses fleet url provided by fleet_server_host_id (#225699)\n\n## Summary\n\nResolves: https://github.com/elastic/kibana/issues/221900\n\nIn an ECH environment, if a user creates a new fleet server and sets it\nas default, a new agentless deployment can be created that uses the url\nof the new default fleet server, but the enrollment API key of the\nexpected preconfigured fleet server. For agentless deployments, we'll\nwant to use the default managed fleet server provided in the cloud\nenvironment. This PR ensures we use the fleet server id provided in the request to obtain the url.\n\n---------\n\nCo-authored-by: Julia Bardi <90178898+juliaElastic@users.noreply.github.com>","sha":"09abd61c5b2bebf0ab48b2098458a30ba02ab02a","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","backport:prev-minor","v9.1.0","v9.2.0"],"title":"Ensure fleet deployment uses fleet url provided by fleet_server_host_id","number":225699,"url":"https://github.com/elastic/kibana/pull/225699","mergeCommit":{"message":"Ensure fleet deployment uses fleet url provided by fleet_server_host_id (#225699)\n\n## Summary\n\nResolves: https://github.com/elastic/kibana/issues/221900\n\nIn an ECH environment, if a user creates a new fleet server and sets it\nas default, a new agentless deployment can be created that uses the url\nof the new default fleet server, but the enrollment API key of the\nexpected preconfigured fleet server. For agentless deployments, we'll\nwant to use the default managed fleet server provided in the cloud\nenvironment. This PR ensures we use the fleet server id provided in the request to obtain the url.\n\n---------\n\nCo-authored-by: Julia Bardi <90178898+juliaElastic@users.noreply.github.com>","sha":"09abd61c5b2bebf0ab48b2098458a30ba02ab02a"}},"sourceBranch":"main","suggestedTargetBranches":["9.1"],"targetPullRequestStates":[{"branch":"9.1","label":"v9.1.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/225699","number":225699,"mergeCommit":{"message":"Ensure fleet deployment uses fleet url provided by fleet_server_host_id (#225699)\n\n## Summary\n\nResolves: https://github.com/elastic/kibana/issues/221900\n\nIn an ECH environment, if a user creates a new fleet server and sets it\nas default, a new agentless deployment can be created that uses the url\nof the new default fleet server, but the enrollment API key of the\nexpected preconfigured fleet server. For agentless deployments, we'll\nwant to use the default managed fleet server provided in the cloud\nenvironment. This PR ensures we use the fleet server id provided in the request to obtain the url.\n\n---------\n\nCo-authored-by: Julia Bardi <90178898+juliaElastic@users.noreply.github.com>","sha":"09abd61c5b2bebf0ab48b2098458a30ba02ab02a"}}]}] BACKPORT--> Co-authored-by: Michel Losier <michel.losier@elastic.co> Co-authored-by: Julia Bardi <90178898+juliaElastic@users.noreply.github.com>
Summary
Resolves: #221900
In an ECH environment, if a user creates a new fleet server and sets it as default, a new agentless deployment can be created that uses the url of the new default fleet server, but the enrollment API key of the expected preconfigured fleet server. For agentless deployments, we'll want to use the default managed fleet server provided in the cloud environment
To reproduce (on main):
Ensure the kibana.dev.yml is setup to enable agentless, and to think its in a cloud environment, specifically ECH
Make sure the default fleet server host id and output ids match what is expected for ECH:
Steps:
[Agentless API] Creating agentless agent with fleetUrl ${fleetUrl} and fleet_token: [REDACTED]show the fleetUrl for the new default fleet server.Then try the same steps on this branch and observe the same log line. You should see the fleetUrl match the preconfigured one.
Checklist
Check the PR satisfies following conditions.
Reviewers should verify this PR satisfies this list as well.
release_note:breakinglabel should be applied in these situations.release_note:*label is applied per the guidelinesbackport:*labels.Identify risks
Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss.
Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging.