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

Support integration policies without agent policy references #182220

Closed
2 tasks done
Tracked by #188708
juliaElastic opened this issue May 1, 2024 · 7 comments · Fixed by #190649
Closed
2 tasks done
Tracked by #188708

Support integration policies without agent policy references #182220

juliaElastic opened this issue May 1, 2024 · 7 comments · Fixed by #190649
Assignees
Labels
QA:Needs Validation Issue needs to be validated by QA Team:Fleet Team label for Observability Data Collection Fleet team

Comments

@juliaElastic
Copy link
Contributor

juliaElastic commented May 1, 2024

Part of reusable integration policies work (phase 2).

With the integration policies becoming shareable, there is a use case to support integration policies without referencing any agent policies. This is useful when users want to keep a configuration without having an agent policy that uses it.

  • Allow removing the last agent policy linkage in Reuse integration action
  • Adjust the UI/API to handle missing agent policy ids gracefully
    • Show empty value in Agent policy column on the UI
    • Allow saving/reading integration policy without agent policy ids in the API
@botelastic botelastic bot added the needs-team Issues missing a team label label May 1, 2024
@juliaElastic juliaElastic added the Team:Fleet Team label for Observability Data Collection Fleet team label May 1, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@jen-huang
Copy link
Contributor

It can be hard to discover integration policies that are no longer attached to any agent policies. I guess the only way would be to look at the list on the Integration details > Integration policies page, right?

cc @nimarezainia

@nimarezainia
Copy link
Contributor

It can be hard to discover integration policies that are no longer attached to any agent policies. I guess the only way would be to look at the list on the Integration details > Integration policies page, right?

cc @nimarezainia

Yes that's what I was thinking also. The table of Agent Policies would just be empty in that case.

@jen-huang
Copy link
Contributor

@nimarezainia @juliaElastic Currently when an agent policy is deleted, we delete all of its integration policies (unless they are used by another agent policy). I assume we should keep this behavior rather than "only" deleting the agent policy and leaving all of its integration policies orphaned. WDYT?

@nimarezainia
Copy link
Contributor

@jen-huang yes I don;t think we should change the current behavior in that regard.

@kpollich kpollich added the QA:Needs Validation Issue needs to be validated by QA label Aug 13, 2024
@jen-huang
Copy link
Contributor

@nimarezainia @juliaElastic Should user also be allowed to edit an integration and clear all agent policies this way? In a similar vein, should they be able to create an integration policy and not link it to any initial agent policies?

Image

The description of this issue seems to imply only unlinking from the Manage agent policies modal so wanted to double check:

Image

@juliaElastic
Copy link
Contributor Author

Should user also be allowed to edit an integration and clear all agent policies this way? In a similar vein, should they be able to create an integration policy and not link it to any initial agent policies?

I think we should allow both for consistency, unless there is a good reason not to.

jen-huang added a commit that referenced this issue Aug 28, 2024
…ka orphaned integration policies) (#190649)

## Summary

Resolves #182220.

This PR allows integration polices to be saved without being added to
any agent policies. These integration policies can be considered
"orphaned." Through the API, an empty `policy_ids: []` array can be
passed during create operations to add it to no agent policies. The same
empty array can be passed during update operations to clear it from all
previous agent policies. Clearing agent policies references this way
will also set the deprecated `policy_id` field to `null`.

Clearing agent policy references requires the same licensing as the
general reusable integration policies feature.

I spotted a bug where removing one or more agent policy references does
not bump their revision. Revision was only bumped for only newly added
references This has been fixed in this PR as well.

On the UI side, orphaned integration policies can only be discovered on
the Integrations details > Policies table:

<img width="1388" alt="image"
src="https://github.com/user-attachments/assets/bcaeb4e7-629a-4ce6-81df-a48a997ed85d">


Agent policies can be unattached in the manage agent policies modal:

<img width="1068" alt="image"
src="https://github.com/user-attachments/assets/7efd48a8-1466-48ee-a48d-18cfbcc4a9a6">


Integration policy create/edit form allows agent policies field to be
cleared, with a confirmation modal as a heads up to the user. If the
user previously had agent policies attached, and is now clearing it, the
normal `This action will update the selected agent policies` will be
shown:

<img width="1108" alt="image"
src="https://github.com/user-attachments/assets/1eade1d1-a456-4d2d-a85f-65801ec55857">


### Checklist

- ~~Consider interaction with space aware policies~~ Will be done in
#190727
- [x] Test with integrations that register custom policy editors
- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
  - Will be done in elastic/ingest-docs#1261
- [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
QA:Needs Validation Issue needs to be validated by QA Team:Fleet Team label for Observability Data Collection Fleet team
Projects
None yet
5 participants