Skip to content

Remove extra search when preparing agent policies - #5283

Merged
michel-laterman merged 1 commit into
elastic:mainfrom
michel-laterman:fix/policy-remove-extra-search
Aug 20, 2025
Merged

michel-laterman merged 1 commit into
elastic:mainfrom
michel-laterman:fix/policy-remove-extra-search

Conversation

@michel-laterman

Copy link
Copy Markdown
Contributor

What is the problem this PR solves?

Preparing the agent policy makes an unneeded search.

How does this PR solve the problem?

Remove an extra search (for the agent) when preparing the agent's policy when a POLICY_CHANGE action is needed, use the agent retrieved when the API key is validated instead.

Design Checklist

  • I have ensured my design is stateless and will work when multiple fleet-server instances are behind a load balancer.
  • I have or intend to scale test my changes, ensuring it will work reliably with 100K+ agents connected.
  • I have included fail safe mechanisms to limit the load on fleet-server: rate limiting, circuit breakers, caching, load shedding, etc.

Checklist

  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in ./changelog/fragments using the changelog tool

@michel-laterman
michel-laterman requested a review from a team as a code owner August 19, 2025 23:09
@michel-laterman michel-laterman added bug Something isn't working Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team backport-active-all Automated backport with mergify to all the active branches labels Aug 19, 2025
@prodsecmachine

prodsecmachine commented Aug 19, 2025 •

Copy link
Copy Markdown

🎉 Snyk checks have passed. No issues have been found so far.

✅ security/snyk check is complete. No issues have been found. (View Details)

✅ license/snyk check is complete. No issues have been found. (View Details)

@michel-laterman
michel-laterman force-pushed the fix/policy-remove-extra-search branch from 4877508 to ee53aaa Compare August 19, 2025 23:10
@elastic-sonarqube

Copy link
Copy Markdown

Comment thread internal/pkg/api/handleCheckin.go
@michel-laterman
michel-laterman merged commit eb79c95 into elastic:main Aug 20, 2025
@michel-laterman
michel-laterman deleted the fix/policy-remove-extra-search branch August 20, 2025 21:39
@github-actions

Copy link
Copy Markdown
Contributor

@Mergifyio backport 8.17 8.18 8.19 9.0 9.1

@mergify

mergify Bot commented Aug 20, 2025 •

Copy link
Copy Markdown
Contributor

mergify Bot pushed a commit that referenced this pull request Aug 20, 2025
mergify Bot pushed a commit that referenced this pull request Aug 20, 2025
mergify Bot pushed a commit that referenced this pull request Aug 20, 2025
mergify Bot pushed a commit that referenced this pull request Aug 20, 2025
mergify Bot pushed a commit that referenced this pull request Aug 20, 2025
michel-laterman added a commit that referenced this pull request Aug 22, 2025
(cherry picked from commit eb79c95)

Co-authored-by: Michel Laterman <82832767+michel-laterman@users.noreply.github.com>
michel-laterman added a commit that referenced this pull request Aug 22, 2025
(cherry picked from commit eb79c95)

Co-authored-by: Michel Laterman <82832767+michel-laterman@users.noreply.github.com>
michel-laterman added a commit that referenced this pull request Aug 22, 2025
(cherry picked from commit eb79c95)

Co-authored-by: Michel Laterman <82832767+michel-laterman@users.noreply.github.com>
michel-laterman added a commit that referenced this pull request Aug 22, 2025
(cherry picked from commit eb79c95)

Co-authored-by: Michel Laterman <82832767+michel-laterman@users.noreply.github.com>
michel-laterman added a commit that referenced this pull request Aug 22, 2025
(cherry picked from commit eb79c95)

Co-authored-by: Michel Laterman <82832767+michel-laterman@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-active-all Automated backport with mergify to all the active branches bug Something isn't working Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants