diff --git a/packages/osd-config/src/__mocks__/env.ts b/packages/osd-config/src/__mocks__/env.ts index e74fdbe0792e..3e14d928fa7f 100644 --- a/packages/osd-config/src/__mocks__/env.ts +++ b/packages/osd-config/src/__mocks__/env.ts @@ -52,7 +52,7 @@ export function getEnvOptions(options: DeepPartial = {}): EnvOptions runExamples: false, ...(options.cliArgs || {}), }, - isDevClusterMaster: - options.isDevClusterMaster !== undefined ? options.isDevClusterMaster : false, + isDevClusterManager: + options.isDevClusterManager !== undefined ? options.isDevClusterManager : false, }; } diff --git a/packages/osd-config/src/__snapshots__/env.test.ts.snap b/packages/osd-config/src/__snapshots__/env.test.ts.snap index 74a59904411e..9fdc3f4d0a00 100644 --- a/packages/osd-config/src/__snapshots__/env.test.ts.snap +++ b/packages/osd-config/src/__snapshots__/env.test.ts.snap @@ -21,7 +21,7 @@ Env { "/some/other/path/some-opensearch-dashboards.yml", ], "homeDir": "/test/opensearchDashboardsRoot", - "isDevClusterMaster": false, + "isDevClusterManager": false, "logDir": "/test/opensearchDashboardsRoot/log", "mode": Object { "dev": true, @@ -64,7 +64,7 @@ Env { "/some/other/path/some-opensearch-dashboards.yml", ], "homeDir": "/test/opensearchDashboardsRoot", - "isDevClusterMaster": false, + "isDevClusterManager": false, "logDir": "/test/opensearchDashboardsRoot/log", "mode": Object { "dev": false, @@ -106,7 +106,7 @@ Env { "/test/cwd/config/opensearch_dashboards.yml", ], "homeDir": "/test/opensearchDashboardsRoot", - "isDevClusterMaster": true, + "isDevClusterManager": true, "logDir": "/test/opensearchDashboardsRoot/log", "mode": Object { "dev": true, @@ -148,7 +148,7 @@ Env { "/some/other/path/some-opensearch-dashboards.yml", ], "homeDir": "/test/opensearchDashboardsRoot", - "isDevClusterMaster": false, + "isDevClusterManager": false, "logDir": "/test/opensearchDashboardsRoot/log", "mode": Object { "dev": false, @@ -190,7 +190,7 @@ Env { "/some/other/path/some-opensearch-dashboards.yml", ], "homeDir": "/test/opensearchDashboardsRoot", - "isDevClusterMaster": false, + "isDevClusterManager": false, "logDir": "/test/opensearchDashboardsRoot/log", "mode": Object { "dev": false, @@ -232,7 +232,7 @@ Env { "/some/other/path/some-opensearch-dashboards.yml", ], "homeDir": "/some/home/dir", - "isDevClusterMaster": false, + "isDevClusterManager": false, "logDir": "/some/home/dir/log", "mode": Object { "dev": false, diff --git a/packages/osd-config/src/env.test.ts b/packages/osd-config/src/env.test.ts index 65f44fef1feb..c0ec0d2d6ab3 100644 --- a/packages/osd-config/src/env.test.ts +++ b/packages/osd-config/src/env.test.ts @@ -58,7 +58,7 @@ test('correctly creates default environment in dev mode.', () => { REPO_ROOT, getEnvOptions({ configs: ['/test/cwd/config/opensearch_dashboards.yml'], - isDevClusterMaster: true, + isDevClusterManager: true, }) ); diff --git a/packages/osd-config/src/env.ts b/packages/osd-config/src/env.ts index 913abe3b3c96..0b5b08be5f15 100644 --- a/packages/osd-config/src/env.ts +++ b/packages/osd-config/src/env.ts @@ -36,7 +36,7 @@ import { PackageInfo, EnvironmentMode } from './types'; export interface EnvOptions { configs: string[]; cliArgs: CliArgs; - isDevClusterMaster: boolean; + isDevClusterManager: boolean; } /** @internal */ @@ -110,10 +110,10 @@ export class Env { public readonly configs: readonly string[]; /** - * Indicates that this OpenSearch Dashboards instance is run as development Node Cluster master. + * Indicates that this OpenSearch Dashboards instance is run as development Node Cluster manager. * @internal */ - public readonly isDevClusterMaster: boolean; + public readonly isDevClusterManager: boolean; /** * @internal @@ -137,7 +137,7 @@ export class Env { this.cliArgs = Object.freeze(options.cliArgs); this.configs = Object.freeze(options.configs); - this.isDevClusterMaster = options.isDevClusterMaster; + this.isDevClusterManager = options.isDevClusterManager; const isDevMode = this.cliArgs.dev || this.cliArgs.envName === 'development'; this.mode = Object.freeze({ diff --git a/src/core/server/bootstrap.ts b/src/core/server/bootstrap.ts index b16d59683043..e8e98112efd1 100644 --- a/src/core/server/bootstrap.ts +++ b/src/core/server/bootstrap.ts @@ -29,7 +29,7 @@ */ import chalk from 'chalk'; -import { isMaster } from 'cluster'; +import { isMaster as isClusterManager } from 'cluster'; import { CliArgs, Env, RawConfigService } from './config'; import { Root } from './root'; import { CriticalError } from './errors'; @@ -82,7 +82,7 @@ export async function bootstrap({ const env = Env.createDefault(REPO_ROOT, { configs, cliArgs, - isDevClusterMaster: isMaster && cliArgs.dev && features.isClusterModeSupported, + isDevClusterManager: isClusterManager && cliArgs.dev && features.isClusterModeSupported, }); const rawConfigService = new RawConfigService(env.configs, applyConfigOverrides); diff --git a/src/core/server/http/http_service.test.ts b/src/core/server/http/http_service.test.ts index a261cd7bd3de..46cecb29e4e6 100644 --- a/src/core/server/http/http_service.test.ts +++ b/src/core/server/http/http_service.test.ts @@ -275,7 +275,7 @@ test('does not start http server if process is dev cluster master', async () => const service = new HttpService({ coreId, configService, - env: Env.createDefault(REPO_ROOT, getEnvOptions({ isDevClusterMaster: true })), + env: Env.createDefault(REPO_ROOT, getEnvOptions({ isDevClusterManager: true })), logger, }); diff --git a/src/core/server/http/http_service.ts b/src/core/server/http/http_service.ts index 6fd900b51363..fa6842a9f064 100644 --- a/src/core/server/http/http_service.ts +++ b/src/core/server/http/http_service.ts @@ -169,7 +169,7 @@ export class HttpService * @internal * */ private shouldListen(config: HttpConfig) { - return !this.coreContext.env.isDevClusterMaster && config.autoListen; + return !this.coreContext.env.isDevClusterManager && config.autoListen; } public async stop() { diff --git a/src/core/server/legacy/legacy_service.test.ts b/src/core/server/legacy/legacy_service.test.ts index 9b67542e5571..489f7f117b33 100644 --- a/src/core/server/legacy/legacy_service.test.ts +++ b/src/core/server/legacy/legacy_service.test.ts @@ -373,7 +373,7 @@ describe('once LegacyService is set up in `devClusterMaster` mode', () => { REPO_ROOT, getEnvOptions({ cliArgs: { silent: true, basePath: false }, - isDevClusterMaster: true, + isDevClusterManager: true, }) ), logger, @@ -402,7 +402,7 @@ describe('once LegacyService is set up in `devClusterMaster` mode', () => { REPO_ROOT, getEnvOptions({ cliArgs: { quiet: true, basePath: true }, - isDevClusterMaster: true, + isDevClusterManager: true, }) ), logger, diff --git a/src/core/server/legacy/legacy_service.ts b/src/core/server/legacy/legacy_service.ts index 574734d18fef..ae7e85b98d67 100644 --- a/src/core/server/legacy/legacy_service.ts +++ b/src/core/server/legacy/legacy_service.ts @@ -155,7 +155,7 @@ export class LegacyService implements CoreService { this.log.debug('starting legacy service'); // Receive initial config and create osdServer/ClusterManager. - if (this.coreContext.env.isDevClusterMaster) { + if (this.coreContext.env.isDevClusterManager) { await this.createClusterManager(this.legacyRawConfig!); } else { this.osdServer = await this.createOsdServer( diff --git a/src/core/server/plugins/plugins_service.ts b/src/core/server/plugins/plugins_service.ts index 3039cae7d9f7..a85c649e65ee 100644 --- a/src/core/server/plugins/plugins_service.ts +++ b/src/core/server/plugins/plugins_service.ts @@ -137,7 +137,7 @@ export class PluginsService implements CoreService(); - const initialize = config.initialize && !this.coreContext.env.isDevClusterMaster; + const initialize = config.initialize && !this.coreContext.env.isDevClusterManager; if (initialize) { contracts = await this.pluginsSystem.setupPlugins(deps); this.registerPluginStaticDirs(deps); diff --git a/src/core/test_helpers/osd_server.ts b/src/core/test_helpers/osd_server.ts index d8ffe3b0824d..331b48d6a5f9 100644 --- a/src/core/test_helpers/osd_server.ts +++ b/src/core/test_helpers/osd_server.ts @@ -90,7 +90,7 @@ export function createRootWithSettings( dist: false, ...cliArgs, }, - isDevClusterMaster: false, + isDevClusterManager: false, }); return new Root( diff --git a/src/legacy/server/logging/rotate/index.ts b/src/legacy/server/logging/rotate/index.ts index b2820f1c8f85..f323d8c6b526 100644 --- a/src/legacy/server/logging/rotate/index.ts +++ b/src/legacy/server/logging/rotate/index.ts @@ -28,7 +28,7 @@ * under the License. */ -import { isMaster, isWorker } from 'cluster'; +import { isMaster as isClusterManager, isWorker } from 'cluster'; import { Server } from '@hapi/hapi'; import { LogRotator } from './log_rotator'; import { OpenSearchDashboardsConfig } from '../../osd_server'; @@ -43,7 +43,7 @@ export async function setupLoggingRotate(server: Server, config: OpenSearchDashb // We just want to start the logging rotate service once // and we choose to use the master (prod) or the worker server (dev) - if (!isMaster && isWorker && process.env.osdWorkerType !== 'server') { + if (!isClusterManager && isWorker && process.env.osdWorkerType !== 'server') { return; } diff --git a/src/legacy/server/logging/rotate/log_rotator.ts b/src/legacy/server/logging/rotate/log_rotator.ts index f1710cb5775e..7502631d22dd 100644 --- a/src/legacy/server/logging/rotate/log_rotator.ts +++ b/src/legacy/server/logging/rotate/log_rotator.ts @@ -29,7 +29,7 @@ */ import * as chokidar from 'chokidar'; -import { isMaster } from 'cluster'; +import { isMaster as isClusterManager } from 'cluster'; import fs from 'fs'; import { Server } from '@hapi/hapi'; import { throttle } from 'lodash'; @@ -359,7 +359,7 @@ export class LogRotator { } _sendReloadLogConfigSignal() { - if (isMaster) { + if (isClusterManager) { (process as NodeJS.EventEmitter).emit('SIGHUP'); return; }