-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Environment variable substitution not substituted as expected #90823
Comments
Pinging @elastic/es-delivery (Team:Delivery) |
Pinging @elastic/es-core-infra (Team:Core/Infra) |
So it looks like what you're doing is substituting a setting set as an environment variable with another environment variable. It's definitely possible this is a regression related to the PR you mention. Variable substitution is specifically documented around YAML-based settings. If it used to work in environment variables as well that might have been purely coincidence as I don't think we have any specific coverage there. Perhaps someone from @elastic/es-core-infra could elaborate here. |
I've reproduced the issue without Kubernetes.
Then, in
Elasticsearch 8.1.1 starts up with a node named
We didn't have any previous coverage of the test case, and only documented the "single substitution" case, rather than the double-substitution in this example. I'd regard the previous behavior as a coincidence as well, but I'll raise it with the team to see if there's a way to handle it more gracefully or improve the error message. |
@dadez73 FWIW, kubernetes supports this natively via the env:
- name: WORKER_NODE_NAME
valueFrom:
fieldRef:
fieldPath: "spec.nodeName"
- name: node.name
value: master-$(WORKER_NODE_NAME) |
hi @mark-vieira , it worked for me! Thank you! |
Elasticsearch Version
8.2.0
Installed Plugins
No response
Java Version
bundled
OS Version
Linux elasticsearch-es-elk-data-nodes-0 5.4.0-113-generic #127-Ubuntu SMP Wed May 18 14:30:56 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Problem Description
We are tring to upgrade from version 8.1.3 to 8.2.3 Elasticsearch cluster in Kubernetes. During the start, the container hangs with :
Exception in thread "main" java.lang.IllegalArgumentException: Could not resolve placeholder 'WORKER_NODE_NAME'
Where the configuration is set with environment variable:
env:
valueFrom:
fieldRef:
fieldPath: "spec.nodeName"
value: master-${WORKER_NODE_NAME}
The variable is pushed in the container correctly
My suspect is that this commit changed the behavior
Allow yaml values for dynamic node settings
Steps to Reproduce
Perform a rolling update of the Elasticsearch nodes from version <=8.1.3 to >=8.2.0
Logs (if relevant)
Wed, Oct 12 2022 10:26:23 am | Exception in thread "main" java.lang.IllegalArgumentException: Could not resolve placeholder 'WORKER_NODE_NAME'
Wed, Oct 12 2022 10:26:23 am | at org.elasticsearch.common.settings.PropertyPlaceholder.parseStringValue(PropertyPlaceholder.java:102)
Wed, Oct 12 2022 10:26:23 am | at org.elasticsearch.common.settings.PropertyPlaceholder.replacePlaceholders(PropertyPlaceholder.java:57)
Wed, Oct 12 2022 10:26:23 am | at org.elasticsearch.common.settings.Settings$Builder.replacePropertyPlaceholders(Settings.java:1259)
Wed, Oct 12 2022 10:26:23 am | at org.elasticsearch.node.InternalSettingsPreparer.prepareEnvironment(InternalSettingsPreparer.java:56)
Wed, Oct 12 2022 10:26:23 am | at org.elasticsearch.common.cli.EnvironmentAwareCommand.createEnv(EnvironmentAwareCommand.java:110)
Wed, Oct 12 2022 10:26:23 am | at org.elasticsearch.common.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:54)
Wed, Oct 12 2022 10:26:23 am | at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:85)
Wed, Oct 12 2022 10:26:23 am | at org.elasticsearch.cli.Command.main(Command.java:50)
Wed, Oct 12 2022 10:26:23 am | at org.elasticsearch.launcher.CliToolLauncher.main(CliToolLauncher.java:64)
The text was updated successfully, but these errors were encountered: