Don't run agentless connectors task on Serverless for now (#206609)

## Summary

This PR makes it so that Agentless Connectors task would not be running
on Serverless environments.

### 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
- [ ] 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)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Artem Shelkovnikov 2025-01-15 13:25:39 +04:00 committed by GitHub
parent 93b7c950ef
commit 4462b48939
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 15 additions and 3 deletions

View file

@ -22,6 +22,8 @@
"taskManager",
"fleet"
],
"optionalPlugins": []
"optionalPlugins": [
"cloud"
]
}
}
}

View file

@ -38,6 +38,7 @@ export class SearchConnectorsPlugin
private log: Logger;
private readonly config: SearchConnectorsConfig;
private agentlessConnectorDeploymentsSyncService: AgentlessConnectorDeploymentsSyncService;
private isServerless: boolean;
constructor(initializerContext: PluginInitializerContext) {
this.connectors = [];
@ -46,6 +47,7 @@ export class SearchConnectorsPlugin
this.agentlessConnectorDeploymentsSyncService = new AgentlessConnectorDeploymentsSyncService(
this.log
);
this.isServerless = false;
}
public setup(
@ -55,6 +57,7 @@ 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
@ -79,7 +82,11 @@ export class SearchConnectorsPlugin
}
public start(coreStart: CoreStart, plugins: SearchConnectorsPluginStartDependencies) {
if (isAgentlessEnabled()) {
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'
);

View file

@ -13,6 +13,7 @@ import {
} from '@kbn/task-manager-plugin/server';
import { SavedObjectsServiceSetup, SavedObjectsServiceStart } from '@kbn/core-saved-objects-server';
import { LicensingPluginStart } from '@kbn/licensing-plugin/server';
import { CloudSetup } from '@kbn/cloud-plugin/server';
/* eslint-disable @typescript-eslint/no-empty-interface */
@ -32,4 +33,5 @@ export interface SearchConnectorsPluginSetupDependencies {
fleet: FleetSetupContract;
taskManager: TaskManagerSetupContract;
soClient: SavedObjectsServiceSetup;
cloud: CloudSetup;
}

View file

@ -27,5 +27,6 @@
"@kbn/core-elasticsearch-server",
"@kbn/licensing-plugin",
"@kbn/core-saved-objects-server",
"@kbn/cloud-plugin",
]
}