mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
[Search] Fix: serverless search connector types (#218842)
## Summary Fixes bug introduced by: https://github.com/elastic/kibana/pull/213509 where serverless search & enterprise search could not load list of available connector types from the connectors plugin. This was caused by 2 things in serverless, 1) the entire plugin was disabled and 2) the plugin id was renamed. Updated the `contentConnectors` plugin to have a `ui.enabled` config value to override just disabling the management UI from being registered for Serverless Search, while still allowing the plugin to be enabled. And updated the usages of the `searchConnectors` plugin in `enteprise_search` & `serverless_search` to account for it being renamed to `contentConnectors` Of note this bug would have been caught by FTRs, but they have been skipped for being [flakey](https://github.com/elastic/kibana/issues/203462) for some time, and have proven [hard fix](https://github.com/elastic/kibana/pull/205971) given the current UX 😔 ### Checklist - [x] [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 - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed
This commit is contained in:
parent
f15c96d6e8
commit
e04e974134
15 changed files with 34 additions and 14 deletions
|
@ -139,4 +139,4 @@ xpack.searchSynonyms.enabled: true
|
||||||
xpack.searchQueryRules.enabled: false
|
xpack.searchQueryRules.enabled: false
|
||||||
|
|
||||||
## Search Connectors in stack management
|
## Search Connectors in stack management
|
||||||
xpack.contentConnectors.enabled: false
|
xpack.contentConnectors.ui.enabled: false
|
||||||
|
|
|
@ -256,6 +256,7 @@ export default function ({ getService }: PluginFunctionalProviderContext) {
|
||||||
'xpack.cloud.serverless.project_type (string?)',
|
'xpack.cloud.serverless.project_type (string?)',
|
||||||
'xpack.cloud.serverless.orchestrator_target (string?)',
|
'xpack.cloud.serverless.orchestrator_target (string?)',
|
||||||
'xpack.cloud.onboarding.default_solution (string?)',
|
'xpack.cloud.onboarding.default_solution (string?)',
|
||||||
|
'xpack.contentConnectors.ui.enabled (boolean?)',
|
||||||
'xpack.discoverEnhanced.actions.exploreDataInChart.enabled (boolean?)',
|
'xpack.discoverEnhanced.actions.exploreDataInChart.enabled (boolean?)',
|
||||||
'xpack.discoverEnhanced.actions.exploreDataInContextMenu.enabled (boolean?)',
|
'xpack.discoverEnhanced.actions.exploreDataInContextMenu.enabled (boolean?)',
|
||||||
'xpack.fleet.agents.enabled (boolean?)',
|
'xpack.fleet.agents.enabled (boolean?)',
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
/*
|
||||||
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||||
|
* or more contributor license agreements. Licensed under the Elastic License
|
||||||
|
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||||
|
* 2.0.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export interface ClientConfigType {
|
||||||
|
ui: { enabled: boolean };
|
||||||
|
}
|
|
@ -8,6 +8,7 @@
|
||||||
import { CoreSetup, CoreStart, Plugin, PluginInitializerContext } from '@kbn/core/public';
|
import { CoreSetup, CoreStart, Plugin, PluginInitializerContext } from '@kbn/core/public';
|
||||||
import { docLinks } from '@kbn/search-connectors/constants/doc_links';
|
import { docLinks } from '@kbn/search-connectors/constants/doc_links';
|
||||||
import { ManagementAppMountParams } from '@kbn/management-plugin/public';
|
import { ManagementAppMountParams } from '@kbn/management-plugin/public';
|
||||||
|
import { type ClientConfigType } from '../common/types/config';
|
||||||
import { getConnectorFullTypes, getConnectorTypes } from '../common/lib/connector_types';
|
import { getConnectorFullTypes, getConnectorTypes } from '../common/lib/connector_types';
|
||||||
import {
|
import {
|
||||||
SearchConnectorsPluginSetup,
|
SearchConnectorsPluginSetup,
|
||||||
|
@ -29,10 +30,12 @@ export class SearchConnectorsPlugin
|
||||||
{
|
{
|
||||||
private readonly isServerless: boolean;
|
private readonly isServerless: boolean;
|
||||||
private readonly kibanaVersion: string;
|
private readonly kibanaVersion: string;
|
||||||
|
private readonly config: ClientConfigType;
|
||||||
|
|
||||||
constructor(initializerContext: PluginInitializerContext) {
|
constructor(initializerContext: PluginInitializerContext) {
|
||||||
this.isServerless = initializerContext.env.packageInfo.buildFlavor === 'serverless';
|
this.isServerless = initializerContext.env.packageInfo.buildFlavor === 'serverless';
|
||||||
this.kibanaVersion = initializerContext.env.packageInfo.version;
|
this.kibanaVersion = initializerContext.env.packageInfo.version;
|
||||||
|
this.config = initializerContext.config.get<ClientConfigType>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public setup(
|
public setup(
|
||||||
|
@ -43,7 +46,7 @@ export class SearchConnectorsPlugin
|
||||||
const connectorTypes = getConnectorTypes(core.http.staticAssets);
|
const connectorTypes = getConnectorTypes(core.http.staticAssets);
|
||||||
const kibanaVersion = this.kibanaVersion;
|
const kibanaVersion = this.kibanaVersion;
|
||||||
|
|
||||||
if (this.isServerless === true) {
|
if (this.config.ui.enabled && this.isServerless === true) {
|
||||||
management.sections.section.data.registerApp({
|
management.sections.section.data.registerApp({
|
||||||
id: PLUGIN_ID,
|
id: PLUGIN_ID,
|
||||||
title: PLUGIN_NAME,
|
title: PLUGIN_NAME,
|
||||||
|
|
|
@ -12,11 +12,17 @@ export * from './types';
|
||||||
|
|
||||||
const configSchema = schema.object({
|
const configSchema = schema.object({
|
||||||
enabled: schema.boolean({ defaultValue: true }),
|
enabled: schema.boolean({ defaultValue: true }),
|
||||||
|
ui: schema.object({
|
||||||
|
enabled: schema.boolean({ defaultValue: true }),
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
type ConfigType = TypeOf<typeof configSchema>;
|
type ConfigType = TypeOf<typeof configSchema>;
|
||||||
|
|
||||||
export const config: PluginConfigDescriptor<ConfigType> = {
|
export const config: PluginConfigDescriptor<ConfigType> = {
|
||||||
|
exposeToBrowser: {
|
||||||
|
ui: true,
|
||||||
|
},
|
||||||
schema: configSchema,
|
schema: configSchema,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
"usageCollection",
|
"usageCollection",
|
||||||
"guidedOnboarding",
|
"guidedOnboarding",
|
||||||
"console",
|
"console",
|
||||||
"searchConnectors",
|
"contentConnectors",
|
||||||
"searchNavigation",
|
"searchNavigation",
|
||||||
"searchPlayground",
|
"searchPlayground",
|
||||||
"embeddable",
|
"embeddable",
|
||||||
|
|
|
@ -39,6 +39,7 @@ describe('renderApp', () => {
|
||||||
params: coreMock.createAppMountParameters(),
|
params: coreMock.createAppMountParameters(),
|
||||||
plugins: {
|
plugins: {
|
||||||
charts: chartPluginMock.createStartContract(),
|
charts: chartPluginMock.createStartContract(),
|
||||||
|
contentConnectors: searchConnectorsMock.createStart(),
|
||||||
data: dataPluginMock.createStartContract(),
|
data: dataPluginMock.createStartContract(),
|
||||||
guidedOnboarding: guidedOnboardingMock.createStart(),
|
guidedOnboarding: guidedOnboardingMock.createStart(),
|
||||||
indexManagement: {
|
indexManagement: {
|
||||||
|
@ -47,7 +48,6 @@ describe('renderApp', () => {
|
||||||
lens: lensPluginMock.createStartContract(),
|
lens: lensPluginMock.createStartContract(),
|
||||||
licensing: licensingMock.createStart(),
|
licensing: licensingMock.createStart(),
|
||||||
navigation: navigationPluginMock.createStartContract(),
|
navigation: navigationPluginMock.createStartContract(),
|
||||||
searchConnectors: searchConnectorsMock.createStart(),
|
|
||||||
security: securityMock.createStart(),
|
security: securityMock.createStart(),
|
||||||
share: sharePluginMock.createStartContract(),
|
share: sharePluginMock.createStartContract(),
|
||||||
ml: mlPluginMock.createStartContract(),
|
ml: mlPluginMock.createStartContract(),
|
||||||
|
|
|
@ -82,7 +82,7 @@ export const renderApp = (
|
||||||
const store = getContext().store;
|
const store = getContext().store;
|
||||||
const indexMappingComponent = indexManagementPlugin?.getIndexMappingComponent({ history });
|
const indexMappingComponent = indexManagementPlugin?.getIndexMappingComponent({ history });
|
||||||
|
|
||||||
const connectorTypes = plugins.searchConnectors?.getConnectorTypes() || [];
|
const connectorTypes = plugins.contentConnectors?.getConnectorTypes() || [];
|
||||||
|
|
||||||
const unmountKibanaLogic = mountKibanaLogic({
|
const unmountKibanaLogic = mountKibanaLogic({
|
||||||
application,
|
application,
|
||||||
|
|
|
@ -82,6 +82,7 @@ export interface PluginsStart {
|
||||||
charts?: ChartsPluginStart;
|
charts?: ChartsPluginStart;
|
||||||
cloud?: CloudSetup & CloudStart;
|
cloud?: CloudSetup & CloudStart;
|
||||||
console?: ConsolePluginStart;
|
console?: ConsolePluginStart;
|
||||||
|
contentConnectors?: SearchConnectorsPluginStart;
|
||||||
data?: DataPublicPluginStart;
|
data?: DataPublicPluginStart;
|
||||||
fleet?: FleetStart;
|
fleet?: FleetStart;
|
||||||
guidedOnboarding?: GuidedOnboardingPluginStart;
|
guidedOnboarding?: GuidedOnboardingPluginStart;
|
||||||
|
@ -90,7 +91,6 @@ export interface PluginsStart {
|
||||||
licensing?: LicensingPluginStart;
|
licensing?: LicensingPluginStart;
|
||||||
ml?: MlPluginStart;
|
ml?: MlPluginStart;
|
||||||
navigation: NavigationPublicPluginStart;
|
navigation: NavigationPublicPluginStart;
|
||||||
searchConnectors?: SearchConnectorsPluginStart;
|
|
||||||
searchNavigation?: SearchNavigationPluginStart;
|
searchNavigation?: SearchNavigationPluginStart;
|
||||||
searchPlayground?: SearchPlaygroundPluginStart;
|
searchPlayground?: SearchPlaygroundPluginStart;
|
||||||
security?: SecurityPluginStart;
|
security?: SecurityPluginStart;
|
||||||
|
|
|
@ -100,7 +100,7 @@ export class EnterpriseSearchPlugin implements Plugin<void, void, PluginsSetup,
|
||||||
licensing,
|
licensing,
|
||||||
guidedOnboarding,
|
guidedOnboarding,
|
||||||
cloud,
|
cloud,
|
||||||
searchConnectors,
|
contentConnectors,
|
||||||
}: PluginsSetup
|
}: PluginsSetup
|
||||||
) {
|
) {
|
||||||
this.globalConfigService.setup(elasticsearch.legacy.config$, cloud);
|
this.globalConfigService.setup(elasticsearch.legacy.config$, cloud);
|
||||||
|
@ -317,7 +317,7 @@ export class EnterpriseSearchPlugin implements Plugin<void, void, PluginsSetup,
|
||||||
|
|
||||||
if (globalSearch) {
|
if (globalSearch) {
|
||||||
globalSearch.registerResultProvider(
|
globalSearch.registerResultProvider(
|
||||||
getSearchResultProvider(config, searchConnectors?.getConnectorTypes() || [])
|
getSearchResultProvider(config, contentConnectors?.getConnectorTypes() || [])
|
||||||
);
|
);
|
||||||
globalSearch.registerResultProvider(getIndicesSearchResultProvider(http.staticAssets));
|
globalSearch.registerResultProvider(getIndicesSearchResultProvider(http.staticAssets));
|
||||||
globalSearch.registerResultProvider(getConnectorsSearchResultProvider(http.staticAssets));
|
globalSearch.registerResultProvider(getConnectorsSearchResultProvider(http.staticAssets));
|
||||||
|
|
|
@ -33,6 +33,7 @@ import type { ConfigType } from '.';
|
||||||
|
|
||||||
export interface PluginsSetup {
|
export interface PluginsSetup {
|
||||||
cloud?: CloudSetup;
|
cloud?: CloudSetup;
|
||||||
|
contentConnectors?: SearchConnectorsPluginSetup;
|
||||||
customIntegrations?: CustomIntegrationsPluginSetup;
|
customIntegrations?: CustomIntegrationsPluginSetup;
|
||||||
features: FeaturesPluginSetup;
|
features: FeaturesPluginSetup;
|
||||||
globalSearch: GlobalSearchPluginSetup;
|
globalSearch: GlobalSearchPluginSetup;
|
||||||
|
@ -40,7 +41,6 @@ export interface PluginsSetup {
|
||||||
licensing: LicensingPluginStart;
|
licensing: LicensingPluginStart;
|
||||||
logsShared: LogsSharedPluginSetup;
|
logsShared: LogsSharedPluginSetup;
|
||||||
ml?: MlPluginSetup;
|
ml?: MlPluginSetup;
|
||||||
searchConnectors?: SearchConnectorsPluginSetup;
|
|
||||||
security: SecurityPluginSetup;
|
security: SecurityPluginSetup;
|
||||||
usageCollection?: UsageCollectionSetup;
|
usageCollection?: UsageCollectionSetup;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
],
|
],
|
||||||
"optionalPlugins": [
|
"optionalPlugins": [
|
||||||
"indexManagement",
|
"indexManagement",
|
||||||
"searchConnectors",
|
"contentConnectors",
|
||||||
"searchInferenceEndpoints",
|
"searchInferenceEndpoints",
|
||||||
"searchPlayground",
|
"searchPlayground",
|
||||||
"usageCollection"
|
"usageCollection"
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import { useKibanaServices } from '../use_kibana';
|
import { useKibanaServices } from '../use_kibana';
|
||||||
|
|
||||||
export const useConnectorTypes = () => {
|
export const useConnectorTypes = () => {
|
||||||
const { searchConnectors } = useKibanaServices();
|
const { contentConnectors } = useKibanaServices();
|
||||||
|
|
||||||
return searchConnectors?.getConnectorTypes() || [];
|
return contentConnectors?.getConnectorTypes() || [];
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,7 +18,7 @@ export interface ServerlessSearchContext {
|
||||||
cloud: CloudStart;
|
cloud: CloudStart;
|
||||||
console: ConsolePluginStart;
|
console: ConsolePluginStart;
|
||||||
history: AppMountParameters['history'];
|
history: AppMountParameters['history'];
|
||||||
searchConnectors?: SearchConnectorsPluginStart;
|
contentConnectors?: SearchConnectorsPluginStart;
|
||||||
security: SecurityPluginStart;
|
security: SecurityPluginStart;
|
||||||
share: SharePluginStart;
|
share: SharePluginStart;
|
||||||
user?: AuthenticatedUser;
|
user?: AuthenticatedUser;
|
||||||
|
|
|
@ -21,7 +21,7 @@ import { searchConnectorsMock } from '@kbn/content-connectors-plugin/public/plug
|
||||||
export const core = coreMock.createStart();
|
export const core = coreMock.createStart();
|
||||||
export const services = {
|
export const services = {
|
||||||
cloud: cloudMock.createStart(),
|
cloud: cloudMock.createStart(),
|
||||||
searchConnectors: searchConnectorsMock.createStart(),
|
contentConnectors: searchConnectorsMock.createStart(),
|
||||||
share: sharePluginMock.createStartContract(),
|
share: sharePluginMock.createStartContract(),
|
||||||
userProfile: userProfileMock.createWithSecurity(),
|
userProfile: userProfileMock.createWithSecurity(),
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue