Skip to content

Commit

Permalink
[Fleet] Make the encryptedSavedObject plugin optionnal (#87470)
Browse files Browse the repository at this point in the history
  • Loading branch information
nchaulet authored Jan 6, 2021
1 parent 6df7498 commit 3b602f8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
11 changes: 9 additions & 2 deletions x-pack/plugins/fleet/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,15 @@
"server": true,
"ui": true,
"configPath": ["xpack", "fleet"],
"requiredPlugins": ["licensing", "data", "encryptedSavedObjects"],
"optionalPlugins": ["security", "features", "cloud", "usageCollection", "home"],
"requiredPlugins": ["licensing", "data"],
"optionalPlugins": [
"security",
"features",
"cloud",
"usageCollection",
"home",
"encryptedSavedObjects"
],
"extraPublicDirs": ["common"],
"requiredBundles": ["kibanaReact", "esUiShared", "home", "infra", "kibanaUtils"]
}
7 changes: 3 additions & 4 deletions x-pack/plugins/fleet/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ export interface FleetSetupDeps {
}

export interface FleetStartDeps {
encryptedSavedObjects: EncryptedSavedObjectsPluginStart;
encryptedSavedObjects?: EncryptedSavedObjectsPluginStart;
security?: SecurityPluginStart;
}

export interface FleetAppContext {
encryptedSavedObjectsStart: EncryptedSavedObjectsPluginStart;
encryptedSavedObjectsStart?: EncryptedSavedObjectsPluginStart;
encryptedSavedObjectsSetup?: EncryptedSavedObjectsPluginSetup;
security?: SecurityPluginStart;
config$?: Observable<FleetConfigType>;
Expand Down Expand Up @@ -250,8 +250,7 @@ export class FleetPlugin

// Conditional config routes
if (config.agents.enabled) {
const isESOUsingEphemeralEncryptionKey =
deps.encryptedSavedObjects.usingEphemeralEncryptionKey;
const isESOUsingEphemeralEncryptionKey = !deps.encryptedSavedObjects;
if (isESOUsingEphemeralEncryptionKey) {
if (this.logger) {
this.logger.warn(
Expand Down
3 changes: 1 addition & 2 deletions x-pack/plugins/fleet/server/routes/setup/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ export const getFleetStatusHandler: RequestHandler = async (context, request, re
const isProductionMode = appContextService.getIsProductionMode();
const isCloud = appContextService.getCloud()?.isCloudEnabled ?? false;
const isTLSCheckDisabled = appContextService.getConfig()?.agents?.tlsCheckDisabled ?? false;
const isUsingEphemeralEncryptionKey = appContextService.getEncryptedSavedObjectsSetup()
.usingEphemeralEncryptionKey;
const isUsingEphemeralEncryptionKey = !appContextService.getEncryptedSavedObjectsSetup();

const missingRequirements: GetFleetStatusResponse['missing_requirements'] = [];
if (!isAdminUserSetup) {
Expand Down
4 changes: 0 additions & 4 deletions x-pack/plugins/fleet/server/services/app_context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,6 @@ class AppContextService {
}

public getEncryptedSavedObjectsSetup() {
if (!this.encryptedSavedObjectsSetup) {
throw new Error('encryptedSavedObjectsSetup is not set');
}

return this.encryptedSavedObjectsSetup;
}

Expand Down

0 comments on commit 3b602f8

Please sign in to comment.