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

Commit

Permalink
Merge pull request #31 from elastic/rolly_polly
Browse files Browse the repository at this point in the history
Generate node roles instead of hard coding them
  • Loading branch information
Crazybus authored Jan 9, 2019
2 parents eafa425 + e740c08 commit 5f8dd70
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
10 changes: 4 additions & 6 deletions elasticsearch/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,10 @@ spec:
value: "{{ .Values.networkHost }}"
- name: ES_JAVA_OPTS
value: "{{ .Values.esJavaOpts }}"
- name: node.master
value: "{{ .Values.roles.master }}"
- name: node.data
value: "{{ .Values.roles.data }}"
- name: node.ingest
value: "{{ .Values.roles.ingest }}"
{{- range $role, $enabled := .Values.roles }}
- name: node.{{ $role }}
value: "{{ $enabled }}"
{{- end }}
{{- if .Values.extraEnvs }}
{{ toYaml .Values.extraEnvs | indent 10 }}
{{- end }}
Expand Down
11 changes: 11 additions & 0 deletions elasticsearch/tests/elasticsearch_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,17 @@ 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_enabling_machine_learning_role():
config = '''
roles:
ml: "true"
'''
r = helm_template(config)
env = r['statefulset'][uname]['spec']['template']['spec']['containers'][0]['env']

assert {'name': 'node.ml',
'value': 'true'} in env


def test_adding_extra_env_vars():
config = '''
Expand Down

0 comments on commit 5f8dd70

Please sign in to comment.