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

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

Merged
merged 5 commits into from
Jan 27, 2021
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
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,
});
};