Skip to content

Fix honoring deployment mode restrictions#231679

Merged
MichelLosier merged 14 commits intoelastic:mainfrom
MichelLosier:fix-honoring-deployment-mode-restrictions
Aug 19, 2025
Merged

Fix honoring deployment mode restrictions#231679
MichelLosier merged 14 commits intoelastic:mainfrom
MichelLosier:fix-honoring-deployment-mode-restrictions

Conversation

@MichelLosier
Copy link
Contributor

@MichelLosier MichelLosier commented Aug 13, 2025

Summary

Resolves: #231621

This makes sure that when creating package policies the deployment_modes definition, if available, on policy templates are evaluated as such:

  • When agentless mode is selected
    • inputs of policy templates are only included if the deployment mode explicitly declares agentless enabled
  • When default mode (agent-based) is selected
    • inputs are included if policy template deployment mode is not declared, or if declared only if default.enabled is true
Screen.Recording.2025-08-15.at.8.45.39.AM.mov

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines
  • Review the backport guidelines and apply applicable backport:* 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.

  • Some package policy templates that do support agentless, but have not explicitly declared so in the policy template may not show as agentless supporting. It would seem better to err on this side though than the current state.

Release note:

Fixes the deployment_modes evaluation for policy templates when creating a package policy. When deploying in agentless mode this ensures we don't allow inputs from policy templates that are not opted into the agentless mode at the template level.

@MichelLosier MichelLosier marked this pull request as ready for review August 14, 2025 16:41
@MichelLosier MichelLosier requested a review from a team as a code owner August 14, 2025 16:41
@MichelLosier MichelLosier added release_note:fix backport:all-open Backport to all branches that could still receive a release backport:prev-minor v8.19.3 and removed backport:all-open Backport to all branches that could still receive a release backport:prev-major labels Aug 14, 2025
@MichelLosier
Copy link
Contributor Author

Noticing in the add integration form while excluding unsupported agentless policy templates: Your integration policy has errors. Please fix them before saving.

No form errors present though. May have to examine the form state.

@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Aug 14, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@MichelLosier MichelLosier marked this pull request as draft August 14, 2025 19:22
@MichelLosier
Copy link
Contributor Author

/ci

@MichelLosier MichelLosier self-assigned this Aug 15, 2025
@MichelLosier MichelLosier marked this pull request as ready for review August 15, 2025 15:55
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
fleet 2.1MB 2.1MB +622.0B

History

cc @MichelLosier

@jen-huang jen-huang self-requested a review August 18, 2025 23:23
Copy link
Contributor

@jen-huang jen-huang left a comment

Choose a reason for hiding this comment

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

Tested locally and LGTM. Ty for the changes!

Please double check the backport and version labels :)

@MichelLosier MichelLosier merged commit 99bed97 into elastic:main Aug 19, 2025
17 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.18, 8.19, 9.0, 9.1

https://github.com/elastic/kibana/actions/runs/17071347943

@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.18 Backport failed because of merge conflicts
8.19 Backport failed because of merge conflicts
9.0 Backport failed because of merge conflicts
9.1 Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

node scripts/backport --pr 231679

Questions ?

Please refer to the Backport tool documentation

MichelLosier added a commit to MichelLosier/kibana that referenced this pull request Aug 19, 2025
Resolves: elastic#231621

This makes sure that when creating package policies the
`deployment_modes` definition, if available, on policy templates are
evaluated as such:

* When agentless mode is selected, inputs of policy templates are only included if the deployment mode
explicitly declares agentless enabled
* When default mode (agent-based) is selected, inputs are included if policy template deployment mode is not
declared, or if declared only if default.enabled is true

## Release note:

Fixes the `deployment_modes` evaluation for policy templates when creating a
package policy. When deploying in agentless mode this ensures we don't
allow inputs from policy templates that are not opted into the agentless
mode at the template level.

(cherry picked from commit 99bed97)

# Conflicts:
#	x-pack/platform/plugins/shared/fleet/common/services/agentless_policy_helper.test.ts
#	x-pack/platform/plugins/shared/fleet/common/services/agentless_policy_helper.ts
#	x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/steps/step_configure_package.tsx
#	x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/hooks/form.test.tsx
#	x-pack/platform/test/fleet_api_integration/apis/fixtures/test_packages/deployment_modes_test/1.0.0/manifest.yml
MichelLosier added a commit to MichelLosier/kibana that referenced this pull request Aug 19, 2025
Resolves: elastic#231621

This makes sure that when creating package policies the
`deployment_modes` definition, if available, on policy templates are
evaluated as such:

* When agentless mode is selected, inputs of policy templates are only included if the deployment mode
explicitly declares agentless enabled
* When default mode (agent-based) is selected, inputs are included if policy template deployment mode is not
declared, or if declared only if default.enabled is true

## Release note:

Fixes the `deployment_modes` evaluation for policy templates when creating a
package policy. When deploying in agentless mode this ensures we don't
allow inputs from policy templates that are not opted into the agentless
mode at the template level.

(cherry picked from commit 99bed97)
@MichelLosier
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
9.1

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

MichelLosier added a commit that referenced this pull request Aug 19, 2025
# Backport

This will backport the following commits from `main` to `9.1`:
- [Fix honoring deployment mode restrictions
(#231679)](#231679)

<!--- Backport version: 10.0.1 -->

### 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-08-19T13:37:21Z","message":"Fix
honoring deployment mode restrictions (#231679)\n\nResolves:
https://github.com/elastic/kibana/issues/231621\n\nThis makes sure that
when creating package policies the\n`deployment_modes` definition, if
available, on policy templates are\nevaluated as such:\n\n* When
agentless mode is selected, inputs of policy templates are only included
if the deployment mode\nexplicitly declares agentless enabled\n* When
default mode (agent-based) is selected, inputs are included if policy
template deployment mode is not\ndeclared, or if declared only if
default.enabled is true\n\n## Release note:\n\nFixes the
`deployment_modes` evaluation for policy templates when creating
a\npackage policy. When deploying in agentless mode this ensures we
don't\nallow inputs from policy templates that are not opted into the
agentless\nmode at the template
level.","sha":"99bed97a5a347ad30ba5f3fe289c4c64f85f01b4","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Fleet","backport:current-major","v9.2.0"],"title":"Fix
honoring deployment mode
restrictions","number":231679,"url":"https://github.com/elastic/kibana/pull/231679","mergeCommit":{"message":"Fix
honoring deployment mode restrictions (#231679)\n\nResolves:
https://github.com/elastic/kibana/issues/231621\n\nThis makes sure that
when creating package policies the\n`deployment_modes` definition, if
available, on policy templates are\nevaluated as such:\n\n* When
agentless mode is selected, inputs of policy templates are only included
if the deployment mode\nexplicitly declares agentless enabled\n* When
default mode (agent-based) is selected, inputs are included if policy
template deployment mode is not\ndeclared, or if declared only if
default.enabled is true\n\n## Release note:\n\nFixes the
`deployment_modes` evaluation for policy templates when creating
a\npackage policy. When deploying in agentless mode this ensures we
don't\nallow inputs from policy templates that are not opted into the
agentless\nmode at the template
level.","sha":"99bed97a5a347ad30ba5f3fe289c4c64f85f01b4"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/231679","number":231679,"mergeCommit":{"message":"Fix
honoring deployment mode restrictions (#231679)\n\nResolves:
https://github.com/elastic/kibana/issues/231621\n\nThis makes sure that
when creating package policies the\n`deployment_modes` definition, if
available, on policy templates are\nevaluated as such:\n\n* When
agentless mode is selected, inputs of policy templates are only included
if the deployment mode\nexplicitly declares agentless enabled\n* When
default mode (agent-based) is selected, inputs are included if policy
template deployment mode is not\ndeclared, or if declared only if
default.enabled is true\n\n## Release note:\n\nFixes the
`deployment_modes` evaluation for policy templates when creating
a\npackage policy. When deploying in agentless mode this ensures we
don't\nallow inputs from policy templates that are not opted into the
agentless\nmode at the template
level.","sha":"99bed97a5a347ad30ba5f3fe289c4c64f85f01b4"}}]}]
BACKPORT-->
qn895 pushed a commit to qn895/kibana that referenced this pull request Aug 26, 2025
Resolves: elastic#231621

This makes sure that when creating package policies the
`deployment_modes` definition, if available, on policy templates are
evaluated as such:

* When agentless mode is selected, inputs of policy templates are only included if the deployment mode
explicitly declares agentless enabled
* When default mode (agent-based) is selected, inputs are included if policy template deployment mode is not
declared, or if declared only if default.enabled is true

## Release note:

Fixes the `deployment_modes` evaluation for policy templates when creating a
package policy. When deploying in agentless mode this ensures we don't
allow inputs from policy templates that are not opted into the agentless
mode at the template level.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release_note:fix Team:Fleet Team label for Observability Data Collection Fleet team v9.1.3 v9.2.0

4 participants