Skip to content

[Fleet] Limit reusable integration policies to 1000 agent policies#247276

Merged
nchaulet merged 12 commits intomainfrom
feature-limit-reusable-integration-policies
Jan 5, 2026
Merged

[Fleet] Limit reusable integration policies to 1000 agent policies#247276
nchaulet merged 12 commits intomainfrom
feature-limit-reusable-integration-policies

Conversation

@nchaulet
Copy link
Copy Markdown
Member

@nchaulet nchaulet commented Dec 22, 2025

Summary

Resolve #240983

Add a limit for the number of agent policies a reusable integration policy can reference. Set it to 1000 as we some code optimization it seems to be working on the API side (UI is probably not great with that number)

Details

When a package policy is referencing more than 100 agent policies, updating those policies will be done asynchronously in the task manager.

Test

I added some integration test to be sure we do not have regressions here in the future.

@nchaulet nchaulet self-assigned this Dec 22, 2025
@nchaulet nchaulet added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting Team:Fleet Team label for Observability Data Collection Fleet team labels Dec 22, 2025
@nchaulet nchaulet changed the title [Fleet] Limit reusable integration policies to 100 agent policies [Fleet] Limit reusable integration policies to 1000 agent policies Dec 23, 2025
@nchaulet nchaulet marked this pull request as ready for review December 23, 2025 16:57
@nchaulet nchaulet requested a review from a team as a code owner December 23, 2025 16:57
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/fleet (Team:Fleet)

@elastic-vault-github-plugin-prod elastic-vault-github-plugin-prod bot requested a review from a team as a code owner December 23, 2025 17:27
@nchaulet
Copy link
Copy Markdown
Member Author

nchaulet commented Jan 2, 2026

@elasticmachine merge upstream

@nchaulet
Copy link
Copy Markdown
Member Author

nchaulet commented Jan 5, 2026

@elasticmachine merge upstream

@nchaulet nchaulet requested a review from juliaElastic January 5, 2026 14:18
calls.forEach((call, idx) => {
expect(call[2]).toContain(`test-agent-policy-${idx + 1}`);
expect(call[3]).toMatchObject({ removeProtection: false });
expect(call[3]).toMatchObject({ removeProtection: undefined });
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

did the logic change that removeProtection became undefined?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The code has been refactored so the same code is called for all bump policies, and removeProtection: false or removeProtection: undefined has the same effect

@nchaulet nchaulet requested a review from juliaElastic January 5, 2026 15:34
user: options?.user,
asyncDeploy:
options.asyncDeploy || policyIds.length > ASYNC_DEPLOY_POLICIES_THRESHOLD
? true
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: ? true : false is unnecessary

asyncDeploy: options?.asyncDeploy,
});
}
await this.bumpAgentPoliciesRevision({ soClient, esClient }, [...agentPolicyIds], {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: why is it necessary to copy agentPolicyIds and associatedPolicyIds below?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

agentPolicyIds is a Set and bumpAgentPoliciesRevision needs an array

@nchaulet nchaulet requested a review from juliaElastic January 5, 2026 15:54
Copy link
Copy Markdown
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.

LGTM

@nchaulet nchaulet enabled auto-merge (squash) January 5, 2026 16:02
@nchaulet nchaulet merged commit c906c33 into main Jan 5, 2026
14 checks passed
@nchaulet nchaulet deleted the feature-limit-reusable-integration-policies branch January 5, 2026 17:36
@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

cc @nchaulet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR 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 v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Fleet] Investigate and define max cardinality for reusable package policy

5 participants