From de6ac86afa190d584708033bc061d3b48bce2065 Mon Sep 17 00:00:00 2001 From: akh Date: Thu, 18 Jun 2020 00:29:52 +0200 Subject: [PATCH 1/3] [elasticsearch] the elasticsearch.endpoints template now uses the elasticsearch.uname template, in order to enable the cluster bootstrap, when fullnameOverride is configured. --- elasticsearch/templates/_helpers.tpl | 2 +- 1 file changed, 1 insertion(+), 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 -}} From 2a528c0e75ae1f914dfb1e4f81e2bccb3fdfad6f Mon Sep 17 00:00:00 2001 From: akh Date: Fri, 19 Jun 2020 13:25:20 +0200 Subject: [PATCH 2/3] [elasticsearch] added testcase to cover the case where 'fullnameOverride' is used and the 'initial_master_nodes', should be 'customfullName-{1-3}', not 'customfullName-master-{1-3}' --- elasticsearch/tests/elasticsearch_test.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/elasticsearch/tests/elasticsearch_test.py b/elasticsearch/tests/elasticsearch_test.py index 87b598e0d..d6fc78aca 100755 --- a/elasticsearch/tests/elasticsearch_test.py +++ b/elasticsearch/tests/elasticsearch_test.py @@ -1298,3 +1298,16 @@ 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 \ No newline at end of file From 4bcc1c882fe1ab9993b6bf6c31530bb2921f5bb9 Mon Sep 17 00:00:00 2001 From: akh Date: Thu, 2 Jul 2020 11:59:15 +0200 Subject: [PATCH 3/3] [elasticsearch] testcases formated using black --- elasticsearch/tests/elasticsearch_test.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/elasticsearch/tests/elasticsearch_test.py b/elasticsearch/tests/elasticsearch_test.py index d6fc78aca..feb7f3633 100755 --- a/elasticsearch/tests/elasticsearch_test.py +++ b/elasticsearch/tests/elasticsearch_test.py @@ -1299,15 +1299,16 @@ 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"] + 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 \ No newline at end of file + "name": "cluster.initial_master_nodes", + "value": "customfullName-0," + "customfullName-1," + "customfullName-2,", + } in env