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

Generate a unique enrollment ID for use as an idempotency token during enrollment #2820

Open
1 of 2 tasks
cmacknz opened this issue Jun 8, 2023 · 1 comment
Open
1 of 2 tasks
Labels
Team:Elastic-Agent Label for the Agent team Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

Comments

@cmacknz
Copy link
Member

cmacknz commented Jun 8, 2023

This is the agent side implementation for elastic/fleet-server#2254 where duplicate agents can be created at scale when the enrollment API request experiences an error that results in partial server side success.

The agent should generate a V4 random UUID for use as an idempotency token during enrollment to ensure that retrying enrollment does not generate duplicate agents in Fleet. The idempotency token will be supplied in the new enrollment_id parameter of the enrollment request added in elastic/fleet-server#2655.

The UUID should be written to disk, ideally it is persisted in the agent's encrypted store. The enrollment ID should be deleted after we have confirmed the enrollment has succeeded, ideally after the first Fleet checkin succeeds.

We will likely also need a flag to force regenerating the enrollment idempotency token for cases where a server side issue causes enrollment for a particular idempotency token to fail repeatedly. This could also prevent issues if someone clones a VM image where a previous enrollment attempt had already happened.

Depends on:

Relates to:

@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Elastic-Agent Label for the Agent team Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
Development

No branches or pull requests

4 participants