-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[Agent] Change logic to find agent policy during Fleet enrollment #29774
Comments
Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane) |
Thanks @juliaElastic and @joshdover for raising this up. I am sorry but it's quite late to integrate it in 8.1. Could we keep it for a later release? |
I'm trying to understand why any changes in Elastic Agent are needed. If the first policy is created by default, can't it still have the same name as it does now? |
@ruflin as part of elastic/kibana#121628 Fleet will no longer create any default policies on setup, and remove the is_default_fleet_server flag altogether. I agree that this dependency was discovered quite late, for me it was not clear initially that we are targeting to remove the is_default_fleet_server flag as part of this change. If the change in agent is not feasible for 8.1, and the breaking of functionality is not acceptable, we could phase out the Fleet change, and keep the is_default_fleet_server flag until 8.2 when agent can change the logic too. |
If possible, I would like to split up the changes of "not creating the default policy on startup" from removing The part I still don't understand is why we have to make this breaking change? What happens to policies coming from 8.0 that have is_default set? Will it be remove in 8.1? What if users have automation in place that does not set the id, will it suddenly break with 8.1? |
@ruflin as discussed with @mostlyjason, we agreed to leave in the |
Great to hear, this gives us some more time to figure out if it will be a breaking change and how we could deal with it. Is my assumption correct that we will also keep |
@ruflin yes, I mean we keep both flags for now |
@jlind23 just to confirm, is there any similar logic that expects a default policy for enrolling an agent (not fleet server)? |
@blakerouse Can you comment on the question from @juliaElastic ? |
@juliaElastic Correct, there is no default in the case of an Elastic Agent enrollment. |
@blakerouse Actually I found a logic which falls back to default policy in case enrollment token is not specified in agent enroll: https://github.com/elastic/beats/blob/master/x-pack/elastic-agent/pkg/agent/cmd/container.go#L544
I don't know if it makes sense to change this logic, in case we completely want to move away from marking policies as default. Maybe in lack of a specified policy/token, the logic could try to find a policy that doesn't have fleet_server integration and choose that? |
It doesn't implement all the logic discussed in this issue, but I started a PR to address this #30256 @juliaElastic I wasn't actually able to find anywhere else in the agent code base that references those flags. There are some more references to kibana I need to run down in the Currently it just picks the first either fleet/non-fleet policy available based on the package policies assigned to each agent policy if there is no id/name specified. |
@lykkin What happens if there are more than one fleet/non-fleet policy available? Would the logic pick the first one (which might not be deterministic)? I think for this reason we said to try with the id |
|
In Fleet we are making changes to remove the
Default Fleet Server policy
from on-prem installations: elastic/kibana#121628This change is planned for 8.1 version.
This impacts Elastic Agent, as the current Fleet enrolment logic which looks for default policy id will not work anymore.
The proposed change is this (recommended by @blakerouse):
elastic/kibana#121628 (comment)
The text was updated successfully, but these errors were encountered: