[Search Connectors] : Unregister Kibana background task (#211091)

## Summary

Since Agentless Connectors will not be released in 9.0 anymore, this PR
should unregister and stop the background kibana task from creating new
policies for elastic-managed connectors.

### Closes https://github.com/elastic/search-team/issues/9283

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] 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/src/platform/packages/shared/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
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Identify risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

- [ ] [See some risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
- [ ] ...

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Meghan Murphy 2025-02-18 10:22:51 -05:00 committed by GitHub
parent f5c9529e37
commit 8f3a45fb2c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 59 deletions

View file

@ -26,6 +26,9 @@ export const REMOVED_TYPES: string[] = [
// deprecated in https://github.com/elastic/kibana/pull/121442
'alerting:siem.signals',
// deprecated in https://github.com/elastic/kibana/pull/211091
'search:agentless-connectors-manager',
'search_sessions_monitor',
'search_sessions_cleanup',
'search_sessions_expire',

View file

@ -5,15 +5,8 @@
* 2.0.
*/
import type {
PluginInitializerContext,
Plugin,
CoreStart,
CoreSetup,
Logger,
} from '@kbn/core/server';
import type { PluginInitializerContext, Plugin, CoreSetup } from '@kbn/core/server';
import { ConnectorServerSideDefinition } from '@kbn/search-connectors';
import { isAgentlessEnabled } from '@kbn/fleet-plugin/server/services/utils/agentless';
import { getConnectorTypes } from '../common/lib/connector_types';
import type {
SearchConnectorsPluginSetup as SearchConnectorsPluginSetup,
@ -22,9 +15,6 @@ import type {
SearchConnectorsPluginStartDependencies,
} from './types';
import { AgentlessConnectorDeploymentsSyncService } from './task';
import { SearchConnectorsConfig } from './config';
export class SearchConnectorsPlugin
implements
Plugin<
@ -35,19 +25,9 @@ export class SearchConnectorsPlugin
>
{
private connectors: ConnectorServerSideDefinition[];
private log: Logger;
private readonly config: SearchConnectorsConfig;
private agentlessConnectorDeploymentsSyncService: AgentlessConnectorDeploymentsSyncService;
private isServerless: boolean;
constructor(initializerContext: PluginInitializerContext) {
this.connectors = [];
this.log = initializerContext.logger.get();
this.config = initializerContext.config.get();
this.agentlessConnectorDeploymentsSyncService = new AgentlessConnectorDeploymentsSyncService(
this.log
);
this.isServerless = false;
}
public setup(
@ -57,49 +37,13 @@ export class SearchConnectorsPlugin
const http = coreSetup.http;
this.connectors = getConnectorTypes(http.staticAssets);
this.isServerless = plugins.cloud && plugins.cloud.isServerlessEnabled;
const coreStartServices = coreSetup.getStartServices();
// There seems to be no way to check for agentless here
// So we register a task, but do not execute it in `start` method
this.log.debug('Registering agentless connectors infra sync task');
coreStartServices
.then(([coreStart, searchConnectorsPluginStartDependencies]) => {
this.agentlessConnectorDeploymentsSyncService.registerInfraSyncTask(
plugins,
coreStart,
searchConnectorsPluginStartDependencies
);
})
.catch((err) => {
this.log.error(`Error registering agentless connectors infra sync task`, err);
});
return {
getConnectorTypes: () => this.connectors,
};
}
public start(coreStart: CoreStart, plugins: SearchConnectorsPluginStartDependencies) {
if (this.isServerless) {
this.log.info(
'Serverless is not supported, skipping agentless connectors infrastructure watcher task'
);
} else if (isAgentlessEnabled()) {
this.log.info(
'Agentless is supported, scheduling initial agentless connectors infrastructure watcher task'
);
this.agentlessConnectorDeploymentsSyncService
.scheduleInfraSyncTask(this.config, plugins.taskManager)
.catch((err) => {
this.log.error(`Error scheduling agentless connectors infra sync task`, err);
});
} else {
this.log.info(
'Agentless is not supported, skipping scheduling initial agentless connectors infrastructure watcher task'
);
}
public start() {
return {
getConnectors: () => this.connectors,
};

View file

@ -163,7 +163,6 @@ export default function ({ getService }: FtrProviderContext) {
'osquery:telemetry-saved-queries',
'report:execute',
'risk_engine:risk_scoring',
'search:agentless-connectors-manager',
'security-solution-ea-asset-criticality-ecs-migration',
'security:endpoint-diagnostics',
'security:endpoint-meta-telemetry',