[kbn-es] Always use bundled JDK when starting Elasticsearch (#89437)

This commit is contained in:
Brian Seeders 2021-01-27 16:26:45 -05:00 committed by GitHub
parent 8f3e1cf7fc
commit 5ce916b308
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 18 deletions

View file

@ -62,8 +62,6 @@ exports.run = async (defaults = {}) => {
await cluster.extractDataDirectory(installPath, options.dataArchive);
}
options.bundledJDK = true;
await cluster.run(installPath, options);
}
};

View file

@ -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'],

View file

@ -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;
@ -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 }),
]);
@ -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) {

View file

@ -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({
@ -78,7 +77,6 @@ exports.installSnapshot = async function installSnapshot({
basePath,
installPath,
log,
bundledJDK,
esArgs,
});
};