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

remove discovery.zen.ping.unicast.hosts setting on esMajorVersion > 7 #100

Merged
merged 4 commits into from
Apr 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions elasticsearch/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,13 @@ spec:
value: "{{ .Values.minimumMasterNodes }}"
{{- end }}
{{- end }}
{{- if lt (int .Values.esMajorVersion) 7 }}
- name: discovery.zen.ping.unicast.hosts
value: "{{ template "masterService" . }}-headless"
{{- else }}
kuisathaverat marked this conversation as resolved.
Show resolved Hide resolved
- name: discovery.seed_hosts
value: "{{ template "masterService" . }}-headless"
{{- end }}
- name: cluster.name
value: "{{ .Values.clusterName }}"
- name: network.host
Expand Down
26 changes: 25 additions & 1 deletion elasticsearch/tests/elasticsearch_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def test_defaults():
uname + '-2,'
},
{
'name': 'discovery.zen.ping.unicast.hosts',
'name': 'discovery.seed_hosts',
'value': uname + '-headless'

},
Expand Down Expand Up @@ -200,24 +200,29 @@ def test_overriding_the_image_and_tag():

def test_set_discovery_hosts_to_custom_master_service():
config = '''
esMajorVersion: 6
masterService: "elasticsearch-custommaster"
'''
r = helm_template(config)
env = r['statefulset'][uname]['spec']['template']['spec']['containers'][0]['env']
assert {'name': 'discovery.zen.ping.unicast.hosts',
'value': 'elasticsearch-custommaster-headless'} in env


def test_set_master_service_to_default_nodegroup_name_if_not_set():
config = '''
esMajorVersion: 6
nodeGroup: "data"
'''
r = helm_template(config)
env = r['statefulset']['elasticsearch-data']['spec']['template']['spec']['containers'][0]['env']
assert {'name': 'discovery.zen.ping.unicast.hosts',
'value': 'elasticsearch-master-headless'} in env


def test_set_master_service_to_default_nodegroup_name_with_custom_cluster_name():
config = '''
esMajorVersion: 6
clusterName: "custom"
nodeGroup: "data"
'''
Expand Down Expand Up @@ -245,6 +250,7 @@ def test_set_initial_master_nodes_when_using_v_7():
for e in env:
assert e['name'] != 'discovery.zen.minimum_master_nodes'


def test_dont_set_initial_master_nodes_if_not_master_when_using_es_version_7():
config = '''
esMajorVersion: 7
Expand All @@ -256,6 +262,24 @@ def test_dont_set_initial_master_nodes_if_not_master_when_using_es_version_7():
for e in env:
assert e['name'] != 'cluster.initial_master_nodes'


def test_set_discovery_seed_host_when_using_v_7():
config = '''
esMajorVersion: 7
roles:
master: "true"
'''
r = helm_template(config)
env = r['statefulset'][uname]['spec']['template']['spec']['containers'][0]['env']
assert {
'name': 'discovery.seed_hosts',
'value': 'elasticsearch-master-headless'
} in env

for e in env:
assert e['name'] != 'discovery.zen.ping.unicast.hosts'


def test_enabling_machine_learning_role():
config = '''
roles:
Expand Down