Closed
Description
Summary
Spaces is currently a hard dependency on multiple of our plugins and solutions.
In order to better support future offerings we need to turn it into an optional dependency.
The purpose of this meta issue is to track our progress in converting all hard dependencies of spaces into optional dependencies.
Status
Link to PRs:
x-pack/plugins/alerting
- Make spaces plugin optional #149044x-pack/plugins/security
- Make spaces plugin optional #149044x-pack/plugins/spaces
- Make spaces plugin optional #149044x-pack/plugins/cases
- [Cases] Make spaces plugin optional #150252x-pack/plugins/enterprise_search
- https://github.com/elastic/enterprise-search-team/issues/3941x-pack/plugins/fleet
- [Fleet] Make spaces plugin optional #151897x-pack/plugins/infra
- [Logs and Metrics UI] Make spaces plugin optional #149973x-pack/plugins/lens
- Mark spaces as optional on the contracts #150021x-pack/plugins/ml
- [ML] Changes for optional spaces plugin #151170x-pack/plugins/observability
- Makes spaces optional in observability plugin #151147x-pack/plugins/osquery
- [Osquery] Cleanup spaces dependency #151059x-pack/plugins/synthetics
- [Synthetics] Make spaces plugin an optional dependency #150003
How to disable spaces
#149044 has reintroduced a config option to disable spaces:
xpack.spaces.enabled: false
This config option is only available in development mode while we are in the process of updating our plugins.
How to make spaces optional
- Move spaces from
requiredPlugins
tooptionalPlugins
in yourkibana.json
file:
{
"requiredPlugins": [
- "spaces"
],
"optionalPlugins": [
+ "spaces"
]
}
- Update setup and start contracts making spaces optional (both server and public):
export interface AlertingPluginsStart {
- spaces: SpacesPluginStart;
+ spaces?: SpacesPluginStart;
}
- If your plugin requires a space ID to construct saved object IDs or for other purposes use
DEFAULT_SPACE_ID
constant from@kbn/spaces-plugin/common
package when spaces isn't available:
+ import { DEFAULT_SPACE_ID } from '@kbn/spaces-plugin/common';
function getSpaceId(request: KibanaRequest) {
- return plugins.spaces.spacesService.getSpaceId(request);
+ return plugins.spaces?.spacesService.getSpaceId(request) ?? DEFAULT_SPACE_ID;
}
An example of these changes can be found in the alerting plugin here: https://github.com/elastic/kibana/pull/149044/files#diff-6e9c0cbc28a51ad0bc9251d157a956f612df837a853cff661edc204d9bde8e14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
Platform Security - AuthorizationTeam label for Observability Data Collection Fleet teamDEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_servicesTeam label for ML (also use :ml)Team label for Observability Team (for things that are handled across all of observability)Label for the ResponseOps team (formerly the Cases and Alerting teams)Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more!Synthetics & RUM sub-team of Application ObservabilityVisualization editors, elastic-charts and infrastructureAddressing this issue will have a high level of impact on the quality/strength of our product.