Kibana: Remove legacy plugin discovery

Created on 15 Jul 2020  路  20Comments  路  Source: elastic/kibana

Related to #56205

Once all 1st party legacy plugins have been removed or migrated, we should disable legacy plugin discovery altogether, even for 3rd party plugins.

When we make this change, we also need to add a note to the "breaking changes" doc for 7.10

Blockers by team

@elastic/stack-monitoring-ui

@elastic/kibana-app-arch

@elastic/kibana-core-ui

@elastic/es-ui

@elastic/logs-metrics-ui

@elastic/kibana-gis

@elastic/kibana-security

@elastic/kibana-platform

New Platform ReleaseStatus Core breaking

Most helpful comment

@joshdover seems like the issue in the kibana app section is actually on core UI, can you confirm?

All 20 comments

Pinging @elastic/kibana-platform (Team:Platform)

We are very close to being able to remove the legacy optimizer, however we still got some work to do before we will be able to totally drop legacy plugin discovery, as there are some remaining.

oss

apm-oss

Done in https://github.com/elastic/kibana/pull/73016

console_legacy

This is used to expose elasticsearchUrl to the ui

https://github.com/elastic/kibana/blob/6c62c686cf28f76dba2248be7382c1ad9a342162/src/legacy/core_plugins/console_legacy/index.ts#L35-L46

I thought it could be done by exposing an endpoint that would access elasticsearch.legacy.config$, but I was wrong, as this property is only exposed on the internal / legacy contract. I moved https://github.com/elastic/kibana/issues/68497 back to 7.10, this removal is blocked by it.

cc @elastic/es-ui

elasticsearch

It's exposing things like createCluster and getCluster, which may be removed if no more legacy plugins are using them (did not check usages in the legacy server code itself), but it's also exposing waitUntilReady which is tightly coupled with the legacy server itself. I guess this plugin will have to stay until the end of legacy.

EDIT: it seems it is also registering proxy routes to ES

https://github.com/elastic/kibana/blob/bf04235dae35452061cc7ea3d86d96c19a58206c/src/legacy/core_plugins/elasticsearch/server/lib/create_proxy.js#L26-L33

Not sure who is consuming these, does anyone have an idea?

kibana

Still doing a few things:

https://github.com/elastic/kibana/blob/d1a6fa26b88ff6ddb557fca70b17ba58243760e6/src/legacy/core_plugins/kibana/index.js#L42-L45

Not sure if related to https://github.com/elastic/kibana/issues/22779 or https://github.com/elastic/kibana/issues/59755

  • Registering the csp usage collector

https://github.com/elastic/kibana/blob/d1a6fa26b88ff6ddb557fca70b17ba58243760e6/src/legacy/core_plugins/kibana/index.js#L59-L62

Not sure I saw this one listed anywhere. csp config is now in core, so I guess this should probably be moved there, but we need a way to access usageCollection plugin from within core. Seems related to https://github.com/elastic/kibana/issues/56762#issuecomment-654423343

  • create the data folder

created https://github.com/elastic/kibana/issues/73002

status_page

Done in https://github.com/elastic/kibana/pull/72017.

The empty app plugin left should safely be removed once the legacy optimizer is no more.

tests_bundle

I have no idea what this is for. I see some karma references, is this only used for karma testing @elastic/kibana-operations?

x-pack

beats_management

Covered by https://github.com/elastic/kibana/pull/70930

Monitoring

Used to bridge the legacy status API to the KP plugin

https://github.com/elastic/kibana/blob/06b1820df71632d5ce30d0b5c60201e6d8c72063/x-pack/legacy/plugins/monitoring/index.ts#L21-L34

Depends on https://github.com/elastic/kibana/issues/41983

security

Only here to expose some hacks (x-pack/legacy/plugins/security/public/hacks/legacy.ts) for the legacy apps. Should be good to remove as we no longer have any legacy apps? Or is this still used for management tabs @elastic/kibana-security

spaces

  • Used to register some redirection routes

https://github.com/elastic/kibana/blob/7ab38ff6de6213ba743d7cc002e7ba916c6da8c8/x-pack/legacy/plugins/spaces/public/legacy.ts#L8-L18

Not sure if these are still really used now that we don't have any app running in legacy mode? @elastic/kibana-security

  • expose the replaceInjectedVars in uiExports.

Seems to be used to add the activeSpace var. Not sure if this is still relevant @elastic/kibana-security?

  • expose things such as getSpaceId and getActiveSpace on the server

This seems fine to remove once we no longer have any other xpack server-side legacy plugin.

xpack_main

This one is doing quite a few things. I guess this will be the last xpack plugin to be removed.

@elastic/apm-ui Is this still used anywhere, or can the legacy apm_oss plugin be removed?

apm_oss is a dependency of xpack.apm so cannot be removed now or in the future. However, looking closer I see there are two apm_oss plugins:

I think that legacy/core_plugins/apm_oss can be merged into plugins/apm_oss.

From what I see, the remains are only used to expose indexPatterns to the server

I'm not sure if server.expose is still used for anything. it was added by @tylersmalley in https://github.com/elastic/kibana/pull/29845 so maybe he knows.

apm_oss is a dependency of xpack.apm so cannot be removed now or in the future. However, looking closer I see there are two apm_oss plugins:

Yea, we are only talking about legacy removal here (src/legacy/core_plugins/apm_oss)

Exporting some uiSettingDefaults

That's #59755 and https://github.com/elastic/kibana/issues/63459 not sure it's a real blocker. we can register them manually

Security
Only here to expose some hacks (x-pack/legacy/plugins/security/public/hacks/legacy.ts) for the legacy apps. Should be good to remove as we no longer have any legacy apps? Or is this still used for management tabs @elastic/kibana-security

Once we don't have any Angular based plugins then we can get rid of this completely. Maintaining /account ---> /security/account redirect isn't critical.

Spaces
Used to register some redirection routes
Not sure if these are still really used now that we don't have any app running in legacy mode? @elastic/kibana-security

Since these redirects don't seem to work right now anyway (likely because Management plugin migrated away from ui/routes, I think it's reasonable to drop legacy links (@legrego can keep me honest here).

expose the replaceInjectedVars in uiExports.
Seems to be used to add the activeSpace var. Not sure if this is still relevant @elastic/kibana-security?

It seems Infra is still using this. I believe they can switch to the contract Spaces KP plugins exposes now.

expose things such as getSpaceId and getActiveSpace on the server
This seems fine to remove once we no longer have any other xpack server-side legacy plugin.

Sounds good to me.

It seems Infra is still using this. I believe they can switch to the contract Spaces KP plugins exposes now.

@elastic/logs-metrics-ui do you have an issue to replace these space injectedVars with the spaces plugin API?

tests_bundle

I have no idea what this is for. I see some karma references, is this only used for karma testing @elastic/kibana-operations?

That's my understanding. @spalger is there anything else this is used for? Can we remove once all Karma test are removed (related: https://github.com/elastic/kibana/issues/71002)?

Yeah, this will go along with karma and the legacy optimizer

elasticsearch

@pgayvallet It looks like https://github.com/elastic/kibana/blob/master/src/plugins/home/public/application/components/tutorial/tutorial.js#L206 makes a request to /elasticsearch/_msearch.

@elastic/logs-metrics-ui do you have an issue to replace these space injectedVars with the spaces plugin API?

Yes, we track it in #68142

Not sure I saw this one listed anywhere. csp config is now in core, so I guess this should probably be moved there, but we need a way to access usageCollection plugin from within core. Seems related to #56762 (comment)

@elastic/kibana-telemetry any problems with us moving the CSP usage collector directly to the telemetry plugin for the time being?

EDIT: it seems it is also registering proxy routes to ES

https://github.com/elastic/kibana/blob/bf04235dae35452061cc7ea3d86d96c19a58206c/src/legacy/core_plugins/elasticsearch/server/lib/create_proxy.js#L26-L33
Not sure who is consuming these, does anyone have an idea?

I have opened new issues for each usage of these:
https://github.com/elastic/kibana/issues/73992
https://github.com/elastic/kibana/issues/73993

@joshdover seems like the issue in the kibana app section is actually on core UI, can you confirm?

Not sure I saw this one listed anywhere. csp config is now in core, so I guess this should probably be moved there, but we need a way to access usageCollection plugin from within core. Seems related to #56762 (comment)

@elastic/kibana-telemetry any problems with us moving the CSP usage collector directly to the telemetry plugin for the time being?

@joshdover after reviewing the collector, it looks like it only accesses to core public values. No problem on my end to move it to the _core-but-outside-core_ collectors in the plugin kibana_usage_collection. Or any other plugin owned by the platform team :)

Not sure I saw this one listed anywhere. csp config is now in core, so I guess this should probably be moved there, but we need a way to access usageCollection plugin from within core. Seems related to #56762 (comment)

@elastic/kibana-telemetry any problems with us moving the CSP usage collector directly to the telemetry plugin for the time being?

No objections here either. I wasn't aware that CSP even had a usage collector :)

@elastic/logs-metrics-ui do you have an issue to replace these space injectedVars with the spaces plugin API?

I removed the getInjectedVars() usage from the infra plugin in #74280, which closes #68142. Is there anything else in the plugin that blocks you in this effort?

@weltenwort Not that I am aware of, thanks Felix

Added #76416 to the list of blockers.

All blockers have been addressed. https://github.com/elastic/kibana/pull/77599 is the final PR that is going to close this issue.

Was this page helpful?
0 / 5 - 0 ratings