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

[Fleet] backfill agentless package policies with supports_agentless field #204410

Merged
merged 4 commits into from
Dec 17, 2024

Conversation

juliaElastic
Copy link
Contributor

@juliaElastic juliaElastic commented Dec 16, 2024

Summary

Closes #203821

Added a function to Fleet setup to query package policies that are missing supports_agentless field and backfilling them. Only doing this for cloud_security_posture package, to skip other non-related packages like system.

To verify:

  • follow the steps in the description here to create an agentless agent policy with cspm integration: [UII] Add status tracking for agentless integrations #199567
  • manually update the package policy to simulate supports_agentless:false
  • trigger Fleet setup
  • verify that the cspm package policy has supports_agentless:true
PUT kbn:/api/fleet/package_policies/<policy_id>
{
   "supports_agentless": false
}

POST kbn:/api/fleet/setup

GET kbn:/api/fleet/package_policies/<policy_id>

Logs:

[2024-12-16T15:42:11.027+01:00][DEBUG][plugins.fleet] Backfilling package policy supports_agentless field
[2024-12-16T15:42:11.034+01:00][DEBUG][plugins.fleet] Backfilling supports_agentless on package policies: 6a06d167-e02e-4057-9d71-e1f7e5dd2847
[2024-12-16T15:42:11.035+01:00][DEBUG][plugins.fleet] Starting update of package policy 6a06d167-e02e-4057-9d71-e1f7e5dd2847
[2024-12-16T15:42:13.213+01:00][DEBUG][plugins.fleet] Deploying policies: 0ed942d5-6c01-484f-a1c5-6c7fff92b020:12
[2024-12-16T15:42:13.610+01:00][DEBUG][plugins.fleet] Agent policy 0ed942d5-6c01-484f-a1c5-6c7fff92b020 update completed, revision: 12
[2024-12-16T15:42:13.610+01:00][DEBUG][plugins.fleet] Package policy 6a06d167-e02e-4057-9d71-e1f7e5dd2847 update completed

Checklist

@juliaElastic juliaElastic added release_note:skip Skip the PR/issue when compiling release notes backport:prev-minor Backport to (9.0) the previous minor version (i.e. one version back from main) labels Dec 16, 2024
@juliaElastic juliaElastic self-assigned this Dec 16, 2024
@juliaElastic juliaElastic requested a review from a team as a code owner December 16, 2024 14:39
@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Dec 16, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

Copy link
Member

@nchaulet nchaulet left a comment

Choose a reason for hiding this comment

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

code LGTM 🚀

@juliaElastic juliaElastic enabled auto-merge (squash) December 17, 2024 08:28
@juliaElastic juliaElastic merged commit a229d7a into elastic:main Dec 17, 2024
8 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

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

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

cc @juliaElastic

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Dec 17, 2024
… field (elastic#204410)

## Summary

Closes elastic#203821

Added a function to Fleet setup to query package policies that are
missing `supports_agentless` field and backfilling them. Only doing this
for `cloud_security_posture` package, to skip other non-related packages
like `system`.

To verify:
- follow the steps in the description here to create an agentless agent
policy with cspm integration:
elastic#199567
- manually update the package policy to simulate
`supports_agentless:false`
- trigger Fleet setup
- verify that the cspm package policy has `supports_agentless:true`

```
PUT kbn:/api/fleet/package_policies/<policy_id>
{
   "supports_agentless": false
}

POST kbn:/api/fleet/setup

GET kbn:/api/fleet/package_policies/<policy_id>
```

Logs:
```
[2024-12-16T15:42:11.027+01:00][DEBUG][plugins.fleet] Backfilling package policy supports_agentless field
[2024-12-16T15:42:11.034+01:00][DEBUG][plugins.fleet] Backfilling supports_agentless on package policies: 6a06d167-e02e-4057-9d71-e1f7e5dd2847
[2024-12-16T15:42:11.035+01:00][DEBUG][plugins.fleet] Starting update of package policy 6a06d167-e02e-4057-9d71-e1f7e5dd2847
[2024-12-16T15:42:13.213+01:00][DEBUG][plugins.fleet] Deploying policies: 0ed942d5-6c01-484f-a1c5-6c7fff92b020:12
[2024-12-16T15:42:13.610+01:00][DEBUG][plugins.fleet] Agent policy 0ed942d5-6c01-484f-a1c5-6c7fff92b020 update completed, revision: 12
[2024-12-16T15:42:13.610+01:00][DEBUG][plugins.fleet] Package policy 6a06d167-e02e-4057-9d71-e1f7e5dd2847 update completed
```

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

(cherry picked from commit a229d7a)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

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

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Dec 17, 2024
…_agentless&#x60; field (#204410) (#204552)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Fleet] backfill agentless package policies with
&#x60;supports_agentless&#x60; field
(#204410)](#204410)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Julia
Bardi","email":"90178898+juliaElastic@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-12-17T11:31:08Z","message":"[Fleet]
backfill agentless package policies with `supports_agentless` field
(#204410)\n\n## Summary\r\n\r\nCloses
https://github.com/elastic/kibana/issues/203821\r\n\r\nAdded a function
to Fleet setup to query package policies that are\r\nmissing
`supports_agentless` field and backfilling them. Only doing this\r\nfor
`cloud_security_posture` package, to skip other non-related
packages\r\nlike `system`.\r\n\r\nTo verify:\r\n- follow the steps in
the description here to create an agentless agent\r\npolicy with cspm
integration:\r\nhttps://github.com//pull/199567\r\n-
manually update the package policy to
simulate\r\n`supports_agentless:false`\r\n- trigger Fleet setup\r\n-
verify that the cspm package policy has
`supports_agentless:true`\r\n\r\n```\r\nPUT
kbn:/api/fleet/package_policies/<policy_id>\r\n{\r\n
\"supports_agentless\": false\r\n}\r\n\r\nPOST
kbn:/api/fleet/setup\r\n\r\nGET
kbn:/api/fleet/package_policies/<policy_id>\r\n```\r\n\r\nLogs:\r\n```\r\n[2024-12-16T15:42:11.027+01:00][DEBUG][plugins.fleet]
Backfilling package policy supports_agentless
field\r\n[2024-12-16T15:42:11.034+01:00][DEBUG][plugins.fleet]
Backfilling supports_agentless on package policies:
6a06d167-e02e-4057-9d71-e1f7e5dd2847\r\n[2024-12-16T15:42:11.035+01:00][DEBUG][plugins.fleet]
Starting update of package policy
6a06d167-e02e-4057-9d71-e1f7e5dd2847\r\n[2024-12-16T15:42:13.213+01:00][DEBUG][plugins.fleet]
Deploying policies:
0ed942d5-6c01-484f-a1c5-6c7fff92b020:12\r\n[2024-12-16T15:42:13.610+01:00][DEBUG][plugins.fleet]
Agent policy 0ed942d5-6c01-484f-a1c5-6c7fff92b020 update completed,
revision: 12\r\n[2024-12-16T15:42:13.610+01:00][DEBUG][plugins.fleet]
Package policy 6a06d167-e02e-4057-9d71-e1f7e5dd2847 update
completed\r\n```\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"a229d7ab1d98ef9461209356ea2ffe43f920376f","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","v9.0.0","backport:prev-minor"],"title":"[Fleet]
backfill agentless package policies with `supports_agentless`
field","number":204410,"url":"https://github.com/elastic/kibana/pull/204410","mergeCommit":{"message":"[Fleet]
backfill agentless package policies with `supports_agentless` field
(#204410)\n\n## Summary\r\n\r\nCloses
https://github.com/elastic/kibana/issues/203821\r\n\r\nAdded a function
to Fleet setup to query package policies that are\r\nmissing
`supports_agentless` field and backfilling them. Only doing this\r\nfor
`cloud_security_posture` package, to skip other non-related
packages\r\nlike `system`.\r\n\r\nTo verify:\r\n- follow the steps in
the description here to create an agentless agent\r\npolicy with cspm
integration:\r\nhttps://github.com//pull/199567\r\n-
manually update the package policy to
simulate\r\n`supports_agentless:false`\r\n- trigger Fleet setup\r\n-
verify that the cspm package policy has
`supports_agentless:true`\r\n\r\n```\r\nPUT
kbn:/api/fleet/package_policies/<policy_id>\r\n{\r\n
\"supports_agentless\": false\r\n}\r\n\r\nPOST
kbn:/api/fleet/setup\r\n\r\nGET
kbn:/api/fleet/package_policies/<policy_id>\r\n```\r\n\r\nLogs:\r\n```\r\n[2024-12-16T15:42:11.027+01:00][DEBUG][plugins.fleet]
Backfilling package policy supports_agentless
field\r\n[2024-12-16T15:42:11.034+01:00][DEBUG][plugins.fleet]
Backfilling supports_agentless on package policies:
6a06d167-e02e-4057-9d71-e1f7e5dd2847\r\n[2024-12-16T15:42:11.035+01:00][DEBUG][plugins.fleet]
Starting update of package policy
6a06d167-e02e-4057-9d71-e1f7e5dd2847\r\n[2024-12-16T15:42:13.213+01:00][DEBUG][plugins.fleet]
Deploying policies:
0ed942d5-6c01-484f-a1c5-6c7fff92b020:12\r\n[2024-12-16T15:42:13.610+01:00][DEBUG][plugins.fleet]
Agent policy 0ed942d5-6c01-484f-a1c5-6c7fff92b020 update completed,
revision: 12\r\n[2024-12-16T15:42:13.610+01:00][DEBUG][plugins.fleet]
Package policy 6a06d167-e02e-4057-9d71-e1f7e5dd2847 update
completed\r\n```\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"a229d7ab1d98ef9461209356ea2ffe43f920376f"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/204410","number":204410,"mergeCommit":{"message":"[Fleet]
backfill agentless package policies with `supports_agentless` field
(#204410)\n\n## Summary\r\n\r\nCloses
https://github.com/elastic/kibana/issues/203821\r\n\r\nAdded a function
to Fleet setup to query package policies that are\r\nmissing
`supports_agentless` field and backfilling them. Only doing this\r\nfor
`cloud_security_posture` package, to skip other non-related
packages\r\nlike `system`.\r\n\r\nTo verify:\r\n- follow the steps in
the description here to create an agentless agent\r\npolicy with cspm
integration:\r\nhttps://github.com//pull/199567\r\n-
manually update the package policy to
simulate\r\n`supports_agentless:false`\r\n- trigger Fleet setup\r\n-
verify that the cspm package policy has
`supports_agentless:true`\r\n\r\n```\r\nPUT
kbn:/api/fleet/package_policies/<policy_id>\r\n{\r\n
\"supports_agentless\": false\r\n}\r\n\r\nPOST
kbn:/api/fleet/setup\r\n\r\nGET
kbn:/api/fleet/package_policies/<policy_id>\r\n```\r\n\r\nLogs:\r\n```\r\n[2024-12-16T15:42:11.027+01:00][DEBUG][plugins.fleet]
Backfilling package policy supports_agentless
field\r\n[2024-12-16T15:42:11.034+01:00][DEBUG][plugins.fleet]
Backfilling supports_agentless on package policies:
6a06d167-e02e-4057-9d71-e1f7e5dd2847\r\n[2024-12-16T15:42:11.035+01:00][DEBUG][plugins.fleet]
Starting update of package policy
6a06d167-e02e-4057-9d71-e1f7e5dd2847\r\n[2024-12-16T15:42:13.213+01:00][DEBUG][plugins.fleet]
Deploying policies:
0ed942d5-6c01-484f-a1c5-6c7fff92b020:12\r\n[2024-12-16T15:42:13.610+01:00][DEBUG][plugins.fleet]
Agent policy 0ed942d5-6c01-484f-a1c5-6c7fff92b020 update completed,
revision: 12\r\n[2024-12-16T15:42:13.610+01:00][DEBUG][plugins.fleet]
Package policy 6a06d167-e02e-4057-9d71-e1f7e5dd2847 update
completed\r\n```\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"a229d7ab1d98ef9461209356ea2ffe43f920376f"}}]}]
BACKPORT-->

---------

Co-authored-by: Julia Bardi <90178898+juliaElastic@users.noreply.github.com>
JoseLuisGJ pushed a commit to JoseLuisGJ/kibana that referenced this pull request Dec 19, 2024
… field (elastic#204410)

## Summary

Closes elastic#203821

Added a function to Fleet setup to query package policies that are
missing `supports_agentless` field and backfilling them. Only doing this
for `cloud_security_posture` package, to skip other non-related packages
like `system`.

To verify:
- follow the steps in the description here to create an agentless agent
policy with cspm integration:
elastic#199567
- manually update the package policy to simulate
`supports_agentless:false`
- trigger Fleet setup
- verify that the cspm package policy has `supports_agentless:true`

```
PUT kbn:/api/fleet/package_policies/<policy_id>
{
   "supports_agentless": false
}

POST kbn:/api/fleet/setup

GET kbn:/api/fleet/package_policies/<policy_id>
```

Logs:
```
[2024-12-16T15:42:11.027+01:00][DEBUG][plugins.fleet] Backfilling package policy supports_agentless field
[2024-12-16T15:42:11.034+01:00][DEBUG][plugins.fleet] Backfilling supports_agentless on package policies: 6a06d167-e02e-4057-9d71-e1f7e5dd2847
[2024-12-16T15:42:11.035+01:00][DEBUG][plugins.fleet] Starting update of package policy 6a06d167-e02e-4057-9d71-e1f7e5dd2847
[2024-12-16T15:42:13.213+01:00][DEBUG][plugins.fleet] Deploying policies: 0ed942d5-6c01-484f-a1c5-6c7fff92b020:12
[2024-12-16T15:42:13.610+01:00][DEBUG][plugins.fleet] Agent policy 0ed942d5-6c01-484f-a1c5-6c7fff92b020 update completed, revision: 12
[2024-12-16T15:42:13.610+01:00][DEBUG][plugins.fleet] Package policy 6a06d167-e02e-4057-9d71-e1f7e5dd2847 update completed
```

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Jan 13, 2025
… field (elastic#204410)

## Summary

Closes elastic#203821

Added a function to Fleet setup to query package policies that are
missing `supports_agentless` field and backfilling them. Only doing this
for `cloud_security_posture` package, to skip other non-related packages
like `system`.

To verify:
- follow the steps in the description here to create an agentless agent
policy with cspm integration:
elastic#199567
- manually update the package policy to simulate
`supports_agentless:false`
- trigger Fleet setup
- verify that the cspm package policy has `supports_agentless:true`

```
PUT kbn:/api/fleet/package_policies/<policy_id>
{
   "supports_agentless": false
}

POST kbn:/api/fleet/setup

GET kbn:/api/fleet/package_policies/<policy_id>
```

Logs:
```
[2024-12-16T15:42:11.027+01:00][DEBUG][plugins.fleet] Backfilling package policy supports_agentless field
[2024-12-16T15:42:11.034+01:00][DEBUG][plugins.fleet] Backfilling supports_agentless on package policies: 6a06d167-e02e-4057-9d71-e1f7e5dd2847
[2024-12-16T15:42:11.035+01:00][DEBUG][plugins.fleet] Starting update of package policy 6a06d167-e02e-4057-9d71-e1f7e5dd2847
[2024-12-16T15:42:13.213+01:00][DEBUG][plugins.fleet] Deploying policies: 0ed942d5-6c01-484f-a1c5-6c7fff92b020:12
[2024-12-16T15:42:13.610+01:00][DEBUG][plugins.fleet] Agent policy 0ed942d5-6c01-484f-a1c5-6c7fff92b020 update completed, revision: 12
[2024-12-16T15:42:13.610+01:00][DEBUG][plugins.fleet] Package policy 6a06d167-e02e-4057-9d71-e1f7e5dd2847 update completed
```

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
viduni94 pushed a commit to viduni94/kibana that referenced this pull request Jan 23, 2025
… field (elastic#204410)

## Summary

Closes elastic#203821

Added a function to Fleet setup to query package policies that are
missing `supports_agentless` field and backfilling them. Only doing this
for `cloud_security_posture` package, to skip other non-related packages
like `system`.

To verify:
- follow the steps in the description here to create an agentless agent
policy with cspm integration:
elastic#199567
- manually update the package policy to simulate
`supports_agentless:false`
- trigger Fleet setup
- verify that the cspm package policy has `supports_agentless:true`

```
PUT kbn:/api/fleet/package_policies/<policy_id>
{
   "supports_agentless": false
}

POST kbn:/api/fleet/setup

GET kbn:/api/fleet/package_policies/<policy_id>
```

Logs:
```
[2024-12-16T15:42:11.027+01:00][DEBUG][plugins.fleet] Backfilling package policy supports_agentless field
[2024-12-16T15:42:11.034+01:00][DEBUG][plugins.fleet] Backfilling supports_agentless on package policies: 6a06d167-e02e-4057-9d71-e1f7e5dd2847
[2024-12-16T15:42:11.035+01:00][DEBUG][plugins.fleet] Starting update of package policy 6a06d167-e02e-4057-9d71-e1f7e5dd2847
[2024-12-16T15:42:13.213+01:00][DEBUG][plugins.fleet] Deploying policies: 0ed942d5-6c01-484f-a1c5-6c7fff92b020:12
[2024-12-16T15:42:13.610+01:00][DEBUG][plugins.fleet] Agent policy 0ed942d5-6c01-484f-a1c5-6c7fff92b020 update completed, revision: 12
[2024-12-16T15:42:13.610+01:00][DEBUG][plugins.fleet] Package policy 6a06d167-e02e-4057-9d71-e1f7e5dd2847 update completed
```

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (9.0) the previous minor version (i.e. one version back from main) release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Fleet] Add data_backfill migration for supports_agentless field on agent policies + package policies
4 participants