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

Allow yaml values for dynamic node settings #85186

Merged
merged 5 commits into from
Mar 22, 2022

Conversation

rjernst
Copy link
Member

@rjernst rjernst commented Mar 21, 2022

Environment variables are allowed as substitutions within
elasticsearch.yml. Additionally, command line settings are added into
the parsed settings. However, both of these are raw strings applied
after the node yml file has been parsed.

This commit moves environment substitution to occur before parsing
elasticsearch.yml, and override processing to happen with a separate
yaml parser so that both can allow yaml parsing. Note that environment
substitution is not the only type of substitution (there is also setting
substitution, which needs parsed setting keys), so the existing
replacement mechanism is not touched here except to remove environment
handling.

closes #65577

Environment variables are allowed as substitutions within
elasticsearch.yml. Additionally, command line settings are added into
the parsed settings. However, both of these are raw strings applied
after the node yml file has been parsed.

This commit moves environment substitution to occur before parsing
elasticsearch.yml, and override processing to happen with a separate
yaml parser so that both can allow yaml parsing. Note that environment
substitution is not the only type of substitution (there is also setting
substitution, which needs parsed setting keys), so the existing
replacement mechanism is not touched here except to remove environment
handling.

closes elastic#65577
@rjernst rjernst added >enhancement :Core/Infra/Core Core issues without another label v8.2.0 labels Mar 21, 2022
@rjernst rjernst requested a review from mark-vieira March 21, 2022 19:53
@elasticmachine elasticmachine added the Team:Core/Infra Meta label for core/infra team label Mar 21, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@elasticsearchmachine
Copy link
Collaborator

Hi @rjernst, I've created a changelog YAML for you.

Copy link
Contributor

@mark-vieira mark-vieira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we have coverage here where we are "directly" setting a property with the value from an environment variable in a Docker context. I think we need a packaging test for something like ES_NODE_ROLES=[] and verifying we get the correct result.

}
var is = new ByteArrayInputStream(builder.toString().getBytes(StandardCharsets.UTF_8));
// fake the resource name so it loads yaml
output.loadFromStream("overrides.yml", is, false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused why this is necessary. Doesn't the later call to initializeSettings take care of replacing any remaining values? How many "passes" are necessary?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, I meant to remove the putProperties in initializeSettings (I've done so now). The idea is that instead of putting the values directly (which may be json), we load them here as if they set in a yaml file.

@rjernst
Copy link
Member Author

rjernst commented Mar 22, 2022

I think we need a packaging test for something like ES_NODE_ROLES=[] and verifying we get the correct result.

Given that this has tests, I'm going to go ahead and merge, and I will followup with a higher level integration test. I'd like to avoid package tests because none of this is different across platforms.

@rjernst rjernst merged commit 55d3750 into elastic:master Mar 22, 2022
@rjernst rjernst deleted the node_substitutions2 branch March 22, 2022 00:28
@mark-vieira
Copy link
Contributor

I'd like to avoid package tests because none of this is different across platforms.

Not across platforms, but environment variable handling is special for Docker packaging.

@piyushkp
Copy link

rjernst was this fix for 8.4.0 as well ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Core Core issues without another label >enhancement Team:Core/Infra Meta label for core/infra team v8.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] ES 7.10 cannot pass environment variable to setup a coordinating only node
5 participants