From 84300609596b68da0e0d2dda12e02f60327c546e Mon Sep 17 00:00:00 2001 From: Andreas Date: Mon, 13 Jul 2020 18:23:38 +0200 Subject: [PATCH] [elasticsearch] _helpers.tpl - elasticsearch.endpoints to use elasticsearch.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. --- elasticsearch/templates/_helpers.tpl | 2 +- elasticsearch/tests/elasticsearch_test.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/elasticsearch/templates/_helpers.tpl b/elasticsearch/templates/_helpers.tpl index f7f212893..87783dae9 100755 --- a/elasticsearch/templates/_helpers.tpl +++ b/elasticsearch/templates/_helpers.tpl @@ -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 -}} diff --git a/elasticsearch/tests/elasticsearch_test.py b/elasticsearch/tests/elasticsearch_test.py index dfbff9033..063757362 100755 --- a/elasticsearch/tests/elasticsearch_test.py +++ b/elasticsearch/tests/elasticsearch_test.py @@ -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