Skip to content

Commit

Permalink
[Fleet] Improve support for Agentless in Fleet UI (elastic#183045)
Browse files Browse the repository at this point in the history
Closes elastic#180375

## Summary
Expand support for Agentless in Fleet UI. Implemented on this PR:
- Agent policies created with `supports_agentless` (added in
elastic#182709) are now marked as
`is_managed`
- Added support for `deployment_modes.agentless.enabled` and
`hide_in_deployment_modes` introduced with
elastic/package-spec#684:
- `hide_in_deployment_modes` shows/hides variables in agentless/default
UI
- `deployment_modes.agentless.enabled: true` determines an integration
as enabled for agentless

## Notes
- In this PR, an integration enabled for serverless is still added to
the default `agentless` policy.
- Integrations enabled for agentless don't display any specific
"agentless" form yet. That part is TBD

### Testing
- Run local env for
[agentless](https://docs.elastic.dev/security-solution/cloud-security/agentless)

### Verify that new settings are honoured in integration policy
- Use the compiled package with new properties defined in
elastic/package-spec#738
`agentless_test_package-1.0.1-rc1.zip` (Packages in this
[comment](elastic#183045 (comment)))
- Upload it to Kibana:
  ```sh
curl -k -XPOST -H 'content-type: application/zip' -H 'kbn-xsrf: true'
https://localhost:5601/api/fleet/epm/packages -u
elastic_serverless:changeme --data-binary
@agentless_test_package-0.0.1.zip
  ```
- Check that the variable marked with `hide_in_deployment_modes:
"agentless"` are not visible
- Check that the agent policies selector is not visible

![Screenshot 2024-05-22 at 10 37
42](https://github.com/elastic/kibana/assets/16084106/02f12ebf-f448-4cfa-b9e7-8cb1a1226e5e)


### Verify that agent policies with `supports_agentless` are marked as
managed
- Create a new policy with `supports_agentless`
  ```
  POST kbn:/api/fleet/agent_policies
  {
    "name": "Test - Agentless policy",
    "namespace": "default",
    "supports_agentless": true
  }
  ```
- Check that the created policy has `is_managed = true`
- Try to change the value to false - an error is thrown
  ```
  PUT kbn:/api/fleet/agent_policies/<policy_id>
  {
    "name": "Test - Agentless policy",
    "namespace": "default",
    "supports_agentless": false
  }
  ```


### Checklist

- [ ] 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
- [ ] [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

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
criamico and kibanamachine authored May 24, 2024
1 parent b86039e commit 5cdb132
Show file tree
Hide file tree
Showing 12 changed files with 632 additions and 59 deletions.
12 changes: 12 additions & 0 deletions x-pack/plugins/fleet/common/types/models/epm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,14 @@ export interface RegistryImage extends PackageSpecIcon {
path: string;
}

export interface DeploymentsModesEnablement {
enabled: boolean;
}
export interface DeploymentsModes {
agentless: DeploymentsModesEnablement;
default?: DeploymentsModesEnablement;
}

export enum RegistryPolicyTemplateKeys {
categories = 'categories',
data_streams = 'data_streams',
Expand All @@ -193,6 +201,7 @@ export enum RegistryPolicyTemplateKeys {
description = 'description',
icons = 'icons',
screenshots = 'screenshots',
deployment_modes = 'deployment_modes',
}
interface BaseTemplate {
[RegistryPolicyTemplateKeys.name]: string;
Expand All @@ -201,6 +210,7 @@ interface BaseTemplate {
[RegistryPolicyTemplateKeys.icons]?: RegistryImage[];
[RegistryPolicyTemplateKeys.screenshots]?: RegistryImage[];
[RegistryPolicyTemplateKeys.multiple]?: boolean;
[RegistryPolicyTemplateKeys.deployment_modes]?: DeploymentsModes;
}
export interface RegistryPolicyIntegrationTemplate extends BaseTemplate {
[RegistryPolicyTemplateKeys.categories]?: Array<PackageSpecCategory | undefined>;
Expand Down Expand Up @@ -424,6 +434,7 @@ export enum RegistryVarsEntryKeys {
default = 'default',
os = 'os',
secret = 'secret',
hide_in_deployment_modes = 'hide_in_deployment_modes',
}

// EPR types this as `[]map[string]interface{}`
Expand All @@ -445,6 +456,7 @@ export interface RegistryVarsEntry {
default: string | string[];
};
};
[RegistryVarsEntryKeys.hide_in_deployment_modes]?: string[];
}

// Deprecated as part of the removing public references to saved object schemas
Expand Down
Loading

0 comments on commit 5cdb132

Please sign in to comment.