Skip to content

Commit

Permalink
[kbn-es] Always use bundled JDK when starting Elasticsearch (#89437)
Browse files Browse the repository at this point in the history
  • Loading branch information
brianseeders authored Jan 27, 2021
1 parent 8f3e1cf commit 5ce916b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 18 deletions.
2 changes: 0 additions & 2 deletions packages/kbn-es/src/cli_commands/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ exports.run = async (defaults = {}) => {
await cluster.extractDataDirectory(installPath, options.dataArchive);
}

options.bundledJDK = true;

await cluster.run(installPath, options);
}
};
2 changes: 1 addition & 1 deletion packages/kbn-es/src/cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ exports.Cluster = class Cluster {
env: {
...(installPath ? { ES_TMPDIR: path.resolve(installPath, 'ES_TMPDIR') } : {}),
...process.env,
...(options.bundledJDK ? { JAVA_HOME: '' } : {}),
JAVA_HOME: '', // By default, we want to always unset JAVA_HOME so that the bundled JDK will be used
...(options.esEnvVars || {}),
},
stdio: ['ignore', 'pipe', 'pipe'],
Expand Down
16 changes: 3 additions & 13 deletions packages/kbn-es/src/install/archive.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ exports.installArchive = async function installArchive(archive, options = {}) {
basePath = BASE_PATH,
installPath = path.resolve(basePath, path.basename(archive, '.tar.gz')),
log = defaultLog,
bundledJDK = false,
esArgs = [],
} = options;

Expand Down Expand Up @@ -64,7 +63,7 @@ exports.installArchive = async function installArchive(archive, options = {}) {
await appendToConfig(installPath, 'xpack.security.enabled', 'true');

await appendToConfig(installPath, 'xpack.license.self_generated.type', license);
await configureKeystore(installPath, log, bundledJDK, [
await configureKeystore(installPath, log, [
['bootstrap.password', password],
...parseSettings(esArgs, { filter: SettingsFilter.SecureOnly }),
]);
Expand All @@ -89,20 +88,11 @@ async function appendToConfig(installPath, key, value) {
*
* @param {String} installPath
* @param {ToolingLog} log
* @param {boolean} bundledJDK
* @param {Array<[string, string]>} secureSettings List of custom Elasticsearch secure settings to
* add into the keystore.
*/
async function configureKeystore(
installPath,
log = defaultLog,
bundledJDK = false,
secureSettings
) {
const env = {};
if (bundledJDK) {
env.JAVA_HOME = '';
}
async function configureKeystore(installPath, log = defaultLog, secureSettings) {
const env = { JAVA_HOME: '' };
await execa(ES_KEYSTORE_BIN, ['create'], { cwd: installPath, env });

for (const [secureSettingName, secureSettingValue] of secureSettings) {
Expand Down
2 changes: 0 additions & 2 deletions packages/kbn-es/src/install/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ exports.installSnapshot = async function installSnapshot({
basePath = BASE_PATH,
installPath = path.resolve(basePath, version),
log = defaultLog,
bundledJDK = true,
esArgs,
}) {
const { downloadPath } = await exports.downloadSnapshot({
Expand All @@ -78,7 +77,6 @@ exports.installSnapshot = async function installSnapshot({
basePath,
installPath,
log,
bundledJDK,
esArgs,
});
};

0 comments on commit 5ce916b

Please sign in to comment.