Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove native realm from code base #1307

Merged
merged 1 commit into from
Mar 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/osd-opensearch/src/cli_commands/archive.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ exports.help = (defaults = {}) => {
--base-path Path containing cache/installations [default: ${basePath}]
--install-path Installation path, defaults to 'source' within base-path
--password Sets password for opensearch user [default: ${password}]
--password.[user] Sets password for native realm user [default: ${password}]
--ssl Sets up SSL on OpenSearch
-E Additional key=value settings to pass to OpenSearch

Expand Down
1 change: 0 additions & 1 deletion packages/osd-opensearch/src/cli_commands/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ exports.help = (defaults = {}) => {
--install-path Installation path, defaults to 'source' within base-path
--data-archive Path to zip or tarball containing an OpenSearch data directory to seed the cluster with.
--password Sets password for opensearch user [default: ${password}]
--password.[user] Sets password for native realm user [default: ${password}]
-E Additional key=value settings to pass to OpenSearch
--download-only Download the snapshot but don't actually start it
--ssl Sets up SSL on OpenSearch
Expand Down
1 change: 0 additions & 1 deletion packages/osd-opensearch/src/cli_commands/source.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ exports.help = (defaults = {}) => {
--install-path Installation path, defaults to 'source' within base-path
--data-archive Path to zip or tarball containing an OpenSearch data directory to seed the cluster with.
--password Sets password for opensearch user [default: ${password}]
--password.[user] Sets password for native realm user [default: ${password}]
--ssl Sets up SSL on OpenSearch
-E Additional key=value settings to pass to OpenSearch

Expand Down
39 changes: 2 additions & 37 deletions packages/osd-opensearch/src/cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,7 @@ const chalk = require('chalk');
const path = require('path');
const { downloadSnapshot, installSnapshot, installSource, installArchive } = require('./install');
const { OPENSEARCH_BIN } = require('./paths');
const {
log: defaultLog,
parseOpenSearchLog,
extractConfigFiles,
decompress,
NativeRealm,
} = require('./utils');
const { log: defaultLog, parseOpenSearchLog, extractConfigFiles, decompress } = require('./utils');
const { createCliError } = require('./errors');
const { promisify } = require('util');
const treeKillAsync = promisify(require('tree-kill'));
Expand Down Expand Up @@ -191,14 +185,13 @@ exports.Cluster = class Cluster {
this._exec(installPath, options);

await Promise.race([
// wait for native realm to be setup and opensearch to be started
// wait for opensearch to be started
Promise.all([
first(this._process.stdout, (data) => {
if (/started/.test(data)) {
return true;
}
}),
this._nativeRealmSetup,
]),

// await the outcome of the process in case it exits before starting
Expand All @@ -219,12 +212,6 @@ exports.Cluster = class Cluster {
async run(installPath, options = {}) {
this._exec(installPath, options);

// log native realm setup errors so they aren't uncaught
this._nativeRealmSetup.catch((error) => {
this._log.error(error);
this.stop();
});

// await the final outcome of the process
await this._outcome;
}
Expand Down Expand Up @@ -314,28 +301,6 @@ exports.Cluster = class Cluster {
stdio: ['ignore', 'pipe', 'pipe'],
});

// parse log output to find http port
const httpPort = first(this._process.stdout, (data) => {
const match = data.toString('utf8').match(/HttpServer.+publish_address {[0-9.]+:([0-9]+)/);

if (match) {
return match[1];
}
});

// once the http port is available setup the native realm
this._nativeRealmSetup = httpPort.then(async (port) => {
const caCert = await this._caCertPromise;
const nativeRealm = new NativeRealm({
port,
caCert,
log: this._log,
opensearchPassword: options.password,
ssl: this._ssl,
});
await nativeRealm.setPasswords(options);
});

// parse and forward opensearch stdout to the log
this._process.stdout.on('data', (data) => {
const lines = parseOpenSearchLog(data.toString());
Expand Down
1 change: 0 additions & 1 deletion packages/osd-opensearch/src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,5 @@ exports.parseOpenSearchLog = require('./parse_opensearch_log').parseOpenSearchLo
exports.findMostRecentlyChanged = require('./find_most_recently_changed').findMostRecentlyChanged;
exports.extractConfigFiles = require('./extract_config_files').extractConfigFiles;
exports.decompress = require('./decompress').decompress;
exports.NativeRealm = require('./native_realm').NativeRealm;
exports.buildSnapshot = require('./build_snapshot').buildSnapshot;
exports.archiveForPlatform = require('./build_snapshot').archiveForPlatform;
149 changes: 0 additions & 149 deletions packages/osd-opensearch/src/utils/native_realm.js

This file was deleted.

Loading