-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Fleet] Add create/delete agentless policies API #241712
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
Conversation
|
@Omolola-Akinleye @seanrathier For info we are working on having a dedicated API for agentless policies, to hide the complexity of the fleet structure behind, and to make things a little more robust, I may need to check with you later to be sure this work as expected with cloud connectors |
811ff17 to
1a8ea7a
Compare
d9054bb to
35bc539
Compare
…atus --include-path /api/alerting/rule/ --include-path /api/alerting/rules --include-path /api/actions --include-path /api/security/role --include-path /api/spaces --include-path /api/streams --include-path /api/fleet --include-path /api/saved_objects/_import --include-path /api/saved_objects/_export --include-path /api/maintenance_window --include-path /api/agent_builder --update
…to feature-agentless-apis
…atus --include-path /api/alerting/rule/ --include-path /api/alerting/rules --include-path /api/actions --include-path /api/security/role --include-path /api/spaces --include-path /api/streams --include-path /api/fleet --include-path /api/saved_objects/_import --include-path /api/saved_objects/_export --include-path /api/maintenance_window --include-path /api/agent_builder --update
…to feature-agentless-apis
|
@seanrathier @Omolola-Akinleye thanks for the zoom on that, correct me if I am wrong.
And in second time adapt #241210 to use that API instead of a new internal one to add proper support for cloud connector |
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That file is only moved (and added a few meta description) from server so we can have get the request type from schema instead of duplicating it.
|
Pinging @elastic/fleet (Team:Fleet) |
jbudz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.buildkite/ftr_platform_stateful_configs.yml LGTM
…atus --include-path /api/alerting/rule/ --include-path /api/alerting/rules --include-path /api/actions --include-path /api/security/role --include-path /api/spaces --include-path /api/streams --include-path /api/fleet --include-path /api/saved_objects/_import --include-path /api/saved_objects/_export --include-path /api/maintenance_window --include-path /api/agent_builder --update
…to feature-agentless-apis
|
@elasticmachine merge upstream |
…to feature-agentless-apis
…atus --include-path /api/alerting/rule/ --include-path /api/alerting/rules --include-path /api/actions --include-path /api/security/role --include-path /api/spaces --include-path /api/streams --include-path /api/fleet --include-path /api/saved_objects/_import --include-path /api/saved_objects/_export --include-path /api/maintenance_window --include-path /api/agent_builder --update
…to feature-agentless-apis
MichelLosier
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great so far! Just a few minor things to look at. I still need to run this and smoke test it a bit.
| }, | ||
| }; | ||
|
|
||
| export const agentlesPolicyRouteService = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| export const agentlesPolicyRouteService = { | |
| export const agentlessPolicyRouteService = { |
| body: CreateAgentlessPolicyRequest['body'], | ||
| query?: CreateAgentlessPolicyRequest['query'] | ||
| ) => { | ||
| return sendRequestForRq<any>({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| return sendRequestForRq<any>({ | |
| return sendRequestForRq<CreateAgentlessPolicyResponse>({ |
Lets swap these any types with the response types
| }) | ||
| ) | ||
| ), | ||
| supports_cloud_connector: schema.maybe( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would be the role of the supports_cloud_connector field? Is the presence of a cloud_connector_id enough to suggest as much or is there an intermediate state where an agentless policy can support cloud connectors, but not have a relationship yet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes cloud_connector_id should be sufficient, also we are not going to support cloud connector yet (there is so work to refacto the cloud connector API that will be done once that PR is merged), so I am just going to clean those
| }), | ||
| }), | ||
| body: SimplifiedCreatePackagePolicyRequestBodySchema.extends({ | ||
| cloud_connector_id: schema.maybe( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see we are first classing the relationship with cloud connectors with cloud_connector_id and we have the other field supports_cloud_connector below. Is there an option to namespace these fields together like:
cloud_connector: {
isSupported: boolean,
id: string
}
I suggest this from a place where if we view agentless as a platform, and if we expect there to be growth in the kinds of entities, or even the types of values other entities need to provide to this policy, I wonder if we should look at namespacing these fields into their own objects instead of a flat structure. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes having that kind of namespaced structure totally make sense, and we should probably suggest it for the following PR that will add support for cloud connector, in addition we will support inline cloud connector creation so we should probably support something like
could_conector: { id: ..} cloud_connector: {name: "", vars: ....}
…atus --include-path /api/alerting/rule/ --include-path /api/alerting/rules --include-path /api/actions --include-path /api/security/role --include-path /api/spaces --include-path /api/streams --include-path /api/fleet --include-path /api/saved_objects/_import --include-path /api/saved_objects/_export --include-path /api/maintenance_window --include-path /api/agent_builder --update
…to feature-agentless-apis
MichelLosier
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good as well running locally 🚀
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Page load bundle
History
|
Summary
Related to #240879
That PR introduce a new agentless policies API to hide our complex data model to end users and avoid going in a inconsistent state where we created the agent policy but not the package policy or we did not call the agentless API.
Add a new
POST /fleet/agentless_policiesAPI andDELETE /fleet/agentless_policies/{policyId}Note that API do not support cloud connectors yet, (it's why we keep the flag off for now), there is a process to improve cloud connector API here, they will plug into that new API once ready.
Details
New feature flags
agentlessPoliciesAPIto enable the new API will be turned onuseAgentlessAPIInUIto use new API in the package policy form off untill we support cloud connectorsdisabledAgentlessLegacyAPInot implemented yet to stop allowing agentless policies to be created through regular * agent /package policy endpointsThat PR
What/How to test
Try to create a bunch of agentless policies (without cloud connector) it should work as before
API
Example request to create a cspm integration