Skip to content

[Meta] Make spaces plugin optional #149687

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:

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

  1. Move spaces from requiredPlugins to optionalPlugins in your kibana.json file:
{
  "requiredPlugins": [
-    "spaces"
  ],
  "optionalPlugins": [
+    "spaces"
  ]
}
  1. Update setup and start contracts making spaces optional (both server and public):
export interface AlertingPluginsStart {
-  spaces: SpacesPluginStart;
+  spaces?: SpacesPluginStart;
}
  1. 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

:mlFeature:Security/AuthorizationPlatform Security - AuthorizationTeam:EnterpriseSearchTeam:FleetTeam label for Observability Data Collection Fleet teamTeam:Infra Monitoring UI - DEPRECATEDDEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_servicesTeam:MLTeam label for ML (also use :ml)Team:ObservabilityTeam label for Observability Team (for things that are handled across all of observability)Team:ResponseOpsLabel for the ResponseOps team (formerly the Cases and Alerting teams)Team:SecurityTeam focused on: Auth, Users, Roles, Spaces, Audit Logging, and more!Team:Uptime - DEPRECATEDSynthetics & RUM sub-team of Application ObservabilityTeam:VisualizationsVisualization editors, elastic-charts and infrastructureimpact:highAddressing this issue will have a high level of impact on the quality/strength of our product.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions