Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Commit

Permalink
[elasticsearch] _helpers.tpl - elasticsearch.endpoints to use elastic…
Browse files Browse the repository at this point in the history
…search.uname (#670)

This addressing an issue where nodes are unable to locate the masters when fullnameOverride is used, due to the cluster.initial_master_nodes having the wrong name of the nodes.
  • Loading branch information
xario authored and jmlrt committed Jul 13, 2020
1 parent f8add3d commit 8430060
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion elasticsearch/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this

{{- define "elasticsearch.endpoints" -}}
{{- $replicas := int (toString (.Values.replicas)) }}
{{- $uname := printf "%s-%s" .Values.clusterName .Values.nodeGroup }}
{{- $uname := (include "elasticsearch.uname" .) }}
{{- range $i, $e := untilStep 0 $replicas 1 -}}
{{ $uname }}-{{ $i }},
{{- end -}}
Expand Down
14 changes: 14 additions & 0 deletions elasticsearch/tests/elasticsearch_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1330,3 +1330,17 @@ def test_full_name_override():

assert "customfullName" in r["statefulset"]
assert "customfullName" in r["service"]


def test_initial_master_nodes_when_using_full_name_override():
config = """
fullnameOverride: "customfullName"
"""
r = helm_template(config)
env = r["statefulset"]["customfullName"]["spec"]["template"]["spec"]["containers"][
0
]["env"]
assert {
"name": "cluster.initial_master_nodes",
"value": "customfullName-0," + "customfullName-1," + "customfullName-2,",
} in env

0 comments on commit 8430060

Please sign in to comment.