opensearch-project / helm-charts

:wheel_of_dharma: A community repository for Helm Charts of OpenSearch Project.
https://opensearch.org/docs/latest/opensearch/install/helm/
Apache License 2.0
170 stars 228 forks source link

[BUG][opensearch] failed to resolve host [opensearch-cluster-master-headless] #478

Closed BCantos17 closed 1 year ago

BCantos17 commented 1 year ago

Describe the bug When creating a cluster with a name other than the default name opensearch-cluster-master, opensearch tries to connect to the opensearch-cluster-master-headless To Reproduce Steps to reproduce the behavior: Create an opensearch.yml configuration and change the fields clusterName and nodeGroup to something other than opensearch-cluster and master and then try running the chart. The services will throw an exception. In my case, the yaml file is

clusterName: "opensearch-next-cluster"
nodeGroup: "manager"
roles:
  - cluster_manager
config:
  opensearch.yml: |-
    cluster.name: opensearch-next-cluster
    network.host: 0.0.0.0
    plugins:
      security:
        disabled: true

Expected behavior Should try to connect to the host opensearch-next-cluster-manager-headless instead or perhaps include a field to override the hostname. I could not find anything in the documentation that looks like I can override the host

Chart Name opensearch Chart Version 2.15.0

Host/Environment (please complete the following information):

Additional context full stack trace

{"type": "server", "timestamp": "2023-09-29T20:51:16,382Z", "level": "WARN", "component": "o.o.d.SeedHostsResolver", "cluster.name": "opensearch-next-cluster", "node.name": "opensearch-next-cluster-manager-0", "message": "failed to resolve host [opensearch-cluster-master-headless]",
"stacktrace": ["java.net.UnknownHostException: opensearch-cluster-master-headless",
"at java.net.InetAddress$CachedAddresses.get(InetAddress.java:801) ~[?:?]",
"at java.net.InetAddress.getAllByName0(InetAddress.java:1533) ~[?:?]",
"at java.net.InetAddress.getAllByName(InetAddress.java:1385) ~[?:?]",
"at java.net.InetAddress.getAllByName(InetAddress.java:1306) ~[?:?]",
"at org.opensearch.transport.TcpTransport.parse(TcpTransport.java:613) ~[opensearch-2.10.0.jar:2.10.0]",
"at org.opensearch.transport.TcpTransport.addressesFromString(TcpTransport.java:555) ~[opensearch-2.10.0.jar:2.10.0]",
"at org.opensearch.transport.TransportService.addressesFromString(TransportService.java:1143) ~[opensearch-2.10.0.jar:2.10.0]",
"at org.opensearch.discovery.SeedHostsResolver.lambda$resolveHostsLists$0(SeedHostsResolver.java:182) ~[opensearch-2.10.0.jar:2.10.0]",
"at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]",
"at org.opensearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:849) ~[opensearch-2.10.0.jar:2.10.0]",
"at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]",
"at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]",
"at java.lang.Thread.run(Thread.java:833) [?:?]"] }
BCantos17 commented 1 year ago

So i was passing in the opensearch.yml as a template variable like so

config:
  opensearch.yml: |-
    ${opensearch.yml}

and in that template I was trying to pass in a variable within the template cluster.name: ${clustername} but this didn't pass in the variable, instead passing in the string "${clustername}". Fixed the issue but just changing it from a variable to a string