From 45e6ab9393f57f0f5d5f79b09a491c04108b5b9e Mon Sep 17 00:00:00 2001 From: Bishoy Boktor Date: Fri, 11 Jun 2021 00:09:00 +0000 Subject: [PATCH] Update healthcheck setting name to optimizedHealthcheckId Signed-off-by: Bishoy Boktor --- config/opensearch_dashboards.yml | 2 +- src/core/server/opensearch/opensearch_config.test.ts | 2 +- src/core/server/opensearch/opensearch_config.ts | 6 +++--- src/core/server/opensearch/opensearch_service.ts | 2 +- .../version_check/ensure_opensearch_version.test.ts | 10 +++++----- .../version_check/ensure_opensearch_version.ts | 8 ++++---- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/config/opensearch_dashboards.yml b/config/opensearch_dashboards.yml index 109a8717564..d281b987ee3 100644 --- a/config/opensearch_dashboards.yml +++ b/config/opensearch_dashboards.yml @@ -42,7 +42,7 @@ # This node attribute should assign all nodes of the same cluster an integer value that increments with each new cluster that is spun up # e.g. in opensearch.yml file you would set the value to a setting using node.attr.cluster_id: # Should only be enabled if there is a corresponding node attribute created in your OpenSearch config that matches the value here -#opensearch.optimizedHealthcheck: "cluster_id" +#opensearch.optimizedHealthcheckId: "cluster_id" # If your OpenSearch is protected with basic authentication, these settings provide # the username and password that the OpenSearch Dashboards server uses to perform maintenance on the OpenSearch Dashboards diff --git a/src/core/server/opensearch/opensearch_config.test.ts b/src/core/server/opensearch/opensearch_config.test.ts index 8b9bde9c74a..729a8bdc2b0 100644 --- a/src/core/server/opensearch/opensearch_config.test.ts +++ b/src/core/server/opensearch/opensearch_config.test.ts @@ -72,7 +72,7 @@ test('set correct defaults', () => { ], "ignoreVersionMismatch": false, "logQueries": false, - "optimizedHealthcheck": undefined, + "optimizedHealthcheckId": undefined, "password": undefined, "pingTimeout": "PT30S", "requestHeadersWhitelist": Array [ diff --git a/src/core/server/opensearch/opensearch_config.ts b/src/core/server/opensearch/opensearch_config.ts index bd5c0693b58..eac35cdf0b1 100644 --- a/src/core/server/opensearch/opensearch_config.ts +++ b/src/core/server/opensearch/opensearch_config.ts @@ -84,7 +84,7 @@ export const configSchema = schema.object({ requestTimeout: schema.duration({ defaultValue: '30s' }), pingTimeout: schema.duration({ defaultValue: schema.siblingRef('requestTimeout') }), logQueries: schema.boolean({ defaultValue: false }), - optimizedHealthcheck: schema.maybe(schema.string()), + optimizedHealthcheckId: schema.maybe(schema.string()), ssl: schema.object( { verificationMode: schema.oneOf( @@ -199,7 +199,7 @@ export class OpenSearchConfig { * Specifies whether Dashboards should only query the local OpenSearch node when * all nodes in the cluster have the same node attribute value */ - public readonly optimizedHealthcheck?: string; + public readonly optimizedHealthcheckId?: string; /** * Hosts that the client will connect to. If sniffing is enabled, this list will @@ -280,7 +280,7 @@ export class OpenSearchConfig { this.ignoreVersionMismatch = rawConfig.ignoreVersionMismatch; this.apiVersion = rawConfig.apiVersion; this.logQueries = rawConfig.logQueries; - this.optimizedHealthcheck = rawConfig.optimizedHealthcheck; + this.optimizedHealthcheckId = rawConfig.optimizedHealthcheckId; this.hosts = Array.isArray(rawConfig.hosts) ? rawConfig.hosts : [rawConfig.hosts]; this.requestHeadersWhitelist = Array.isArray(rawConfig.requestHeadersWhitelist) ? rawConfig.requestHeadersWhitelist diff --git a/src/core/server/opensearch/opensearch_service.ts b/src/core/server/opensearch/opensearch_service.ts index 5d9d2bcf85a..e853dbca6c5 100644 --- a/src/core/server/opensearch/opensearch_service.ts +++ b/src/core/server/opensearch/opensearch_service.ts @@ -95,7 +95,7 @@ export class OpenSearchService const opensearchNodesCompatibility$ = pollOpenSearchNodesVersion({ internalClient: this.client.asInternalUser, - optimizedHealthcheck: config.optimizedHealthcheck, + optimizedHealthcheckId: config.optimizedHealthcheckId, log: this.log, ignoreVersionMismatch: config.ignoreVersionMismatch, opensearchVersionCheckInterval: config.healthCheckDelay.asMilliseconds(), diff --git a/src/core/server/opensearch/version_check/ensure_opensearch_version.test.ts b/src/core/server/opensearch/version_check/ensure_opensearch_version.test.ts index 42155ba8d6d..dbbc0f2236e 100644 --- a/src/core/server/opensearch/version_check/ensure_opensearch_version.test.ts +++ b/src/core/server/opensearch/version_check/ensure_opensearch_version.test.ts @@ -180,7 +180,7 @@ describe('pollOpenSearchNodesVersion', () => { pollOpenSearchNodesVersion({ internalClient, - optimizedHealthcheck: 'cluster_id', + optimizedHealthcheckId: 'cluster_id', opensearchVersionCheckInterval: 1, ignoreVersionMismatch: false, opensearchDashboardsVersion: OPENSEARCH_DASHBOARDS_VERSION, @@ -204,7 +204,7 @@ describe('pollOpenSearchNodesVersion', () => { pollOpenSearchNodesVersion({ internalClient, - optimizedHealthcheck: 'cluster_id', + optimizedHealthcheckId: 'cluster_id', opensearchVersionCheckInterval: 1, ignoreVersionMismatch: false, opensearchDashboardsVersion: OPENSEARCH_DASHBOARDS_VERSION, @@ -233,7 +233,7 @@ describe('pollOpenSearchNodesVersion', () => { pollOpenSearchNodesVersion({ internalClient, - optimizedHealthcheck: 'cluster_id', + optimizedHealthcheckId: 'cluster_id', opensearchVersionCheckInterval: 1, ignoreVersionMismatch: false, opensearchDashboardsVersion: OPENSEARCH_DASHBOARDS_VERSION, @@ -269,7 +269,7 @@ describe('pollOpenSearchNodesVersion', () => { const opensearchNodesCompatibility$ = pollOpenSearchNodesVersion({ internalClient, - optimizedHealthcheck: 'cluster_id', + optimizedHealthcheckId: 'cluster_id', opensearchVersionCheckInterval: 100, ignoreVersionMismatch: false, opensearchDashboardsVersion: OPENSEARCH_DASHBOARDS_VERSION, @@ -309,7 +309,7 @@ describe('pollOpenSearchNodesVersion', () => { const opensearchNodesCompatibility$ = pollOpenSearchNodesVersion({ internalClient, - optimizedHealthcheck: 'cluster_id', + optimizedHealthcheckId: 'cluster_id', opensearchVersionCheckInterval: 10, ignoreVersionMismatch: false, opensearchDashboardsVersion: OPENSEARCH_DASHBOARDS_VERSION, diff --git a/src/core/server/opensearch/version_check/ensure_opensearch_version.ts b/src/core/server/opensearch/version_check/ensure_opensearch_version.ts index a9dfd5900e0..6850f2373b7 100644 --- a/src/core/server/opensearch/version_check/ensure_opensearch_version.ts +++ b/src/core/server/opensearch/version_check/ensure_opensearch_version.ts @@ -87,7 +87,7 @@ export const getNodeId = async ( export interface PollOpenSearchNodesVersionOptions { internalClient: OpenSearchClient; - optimizedHealthcheck?: string; + optimizedHealthcheckId?: string; log: Logger; opensearchDashboardsVersion: string; ignoreVersionMismatch: boolean; @@ -200,7 +200,7 @@ function compareNodes(prev: NodesVersionCompatibility, curr: NodesVersionCompati export const pollOpenSearchNodesVersion = ({ internalClient, - optimizedHealthcheck, + optimizedHealthcheckId, log, opensearchDashboardsVersion, ignoreVersionMismatch, @@ -215,8 +215,8 @@ export const pollOpenSearchNodesVersion = ({ * For better dashboards resilience, the behaviour is changed to only query the local node when all the nodes have the same cluster_id * Using _cluster/state/nodes to retrieve the cluster_id of each node from the master node */ - if (optimizedHealthcheck) { - return from(getNodeId(internalClient, optimizedHealthcheck)).pipe( + if (optimizedHealthcheckId) { + return from(getNodeId(internalClient, optimizedHealthcheckId)).pipe( mergeMap((nodeId: any) => from( internalClient.nodes.info({