OpenSearch: [BUG] OpenSearch app is not able to pick up empty `node.roles=` environment variable to run as coordinating node.
Describe the bug
Coming from the issue https://github.com/opensearch-project/opensearch-build/issues/2129, OpenSearch app is not able to pick up empty node.roles= environment values, to allow to run as coordinating node. This works fine when added to opensearch.yml as node.roles: [], but not able to pick when passed as environment variable. However when passed a specific role as node.roles=master OpenSearch app is able to pick up and pass the role as master.
docker run -e 'node.roles=master,data' opensearchproject/opensearch:1.3.2 |grep role
[2022-05-20T01:31:30,027][INFO ][o.o.n.Node ] [9a683cb05664] node name [9a683cb05664], node ID [vgu0pnrgQRytmfj2ZC6siw], cluster name [docker-cluster], roles [master, data]
As per the document https://opensearch.org/docs/latest/opensearch/cluster/, passing empty listnode.roles: [] should allow the node to run with coordinating role.
To Reproduce
docker run -e 'node.roles=' opensearchproject/opensearch:1.3.2 |grep role
[2022-05-20T01:26:25,169][INFO ][o.o.n.Node ] [5e7b9fa617b3] node name [5e7b9fa617b3], node ID [pEkc98u4Q-SdZLr4ojZ-QQ], cluster name [docker-cluster], roles [master, remote_cluster_client, data, ingest]
docker run -e 'node.roles=[]' opensearchproject/opensearch:1.3.2 |grep role
uncaught exception in thread [main]
org.opensearch.bootstrap.StartupException: java.lang.IllegalArgumentException: unknown role [[]]
Caused by: java.lang.IllegalArgumentException: unknown role [[]]
java.lang.IllegalArgumentException: unknown role [[]]
docker run -e 'node.roles=" "' opensearchproject/opensearch:1.3.2 |grep role
uncaught exception in thread [main]
org.opensearch.bootstrap.StartupException: java.lang.IllegalArgumentException: unknown role [" "]
Caused by: java.lang.IllegalArgumentException: unknown role [" "]
java.lang.IllegalArgumentException: unknown role [" "]
Expected behavior
docker run -e 'node.roles=' should allow to run the node as coordinating node.
Host/Environment (please complete the following information):
- OS: docker
Additional context N/A
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (11 by maintainers)
@reta ideally since this works
node.roles=master, data(passing as environment variable) and sets right master and data role, settingnode.roles=to empty value should allow to set the coordinating role.May be supporting [] notation to denote empty value would make sense?yes setting environment variablenode.roles=[]should also set as coordinating role, adding this logic would be better