-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[elasticsearch] use new node.roles settings #1186
Changes from 3 commits
8f8c40c
01ec049
059af50
a217b3b
e1bf227
4d4300a
f66492a
bd5b912
abf9aee
891e512
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,8 @@ | ||
--- | ||
|
||
clusterName: "multi" | ||
nodeGroup: "client" | ||
|
||
roles: | ||
master: "false" | ||
ingest: "false" | ||
data: "false" | ||
ml: "false" | ||
remote_cluster_client: "false" | ||
roles: [] | ||
|
||
persistence: | ||
enabled: false |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,6 @@ | ||
--- | ||
|
||
clusterName: "multi" | ||
nodeGroup: "data" | ||
|
||
roles: | ||
master: "false" | ||
ingest: "true" | ||
data: "true" | ||
ml: "false" | ||
remote_cluster_client: "false" | ||
- data | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe this should have the |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,6 @@ | ||
--- | ||
|
||
clusterName: "multi" | ||
nodeGroup: "master" | ||
|
||
roles: | ||
master: "true" | ||
ingest: "false" | ||
data: "false" | ||
ml: "false" | ||
remote_cluster_client: "false" | ||
- master |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -295,15 +295,12 @@ spec: | |
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.name | ||
{{- if eq .Values.roles.master "true" }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is coming from the Helm template right? Not elasticsearch.yml? So effectively we've changed how you specify roles to only support the new There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes this is coming from the Helm template to define some environment variables into Elasticsearch container.
helm-charts repo is using release branches following the same model as elastic/elasticsearch. We expect to merge this PR only on Currently master branch is using 8.0.0-SNAPSHOT image which is why CI tests is failing, while all [released versions](https://github.com/elastic/helm-charts/releases] are using aligned Elasticsearch versions. Note that anybody can override the |
||
{{- if ge (int (include "elasticsearch.esMajorVersion" .)) 7 }} | ||
{{- if has "master" .Values.roles }} | ||
- name: cluster.initial_master_nodes | ||
value: "{{ template "elasticsearch.endpoints" . }}" | ||
{{- else }} | ||
- name: discovery.zen.minimum_master_nodes | ||
value: "{{ .Values.minimumMasterNodes }}" | ||
{{- end }} | ||
{{- end }} | ||
- name: node.roles | ||
value: "{{ template "elasticsearch.roles" . }}" | ||
{{- if lt (int (include "elasticsearch.esMajorVersion" .)) 7 }} | ||
- name: discovery.zen.ping.unicast.hosts | ||
value: "{{ template "elasticsearch.masterService" . }}-headless" | ||
|
@@ -319,10 +316,6 @@ spec: | |
- name: ES_JAVA_OPTS | ||
value: "{{ .Values.esJavaOpts }}" | ||
{{- end }} | ||
{{- range $role, $enabled := .Values.roles }} | ||
- name: node.{{ $role }} | ||
value: "{{ $enabled }}" | ||
{{- end }} | ||
{{- if .Values.extraEnvs }} | ||
{{ toYaml .Values.extraEnvs | indent 10 }} | ||
{{- end }} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mark-vieira
This configuration doesn't work to set a coordinating node and instead adds all default roles to the node.
I followed https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-node.html#coordinating-only-node, but we define
node.roles
as environment variable is the chart instead of configuring it inelasticsearch.yaml
so this configuration translates tonode.roles=,
environment variable in the Elasticsearch containerI did a few tries but couldn't find the correct syntax for setting client node with environment variable.
Some example reproduced using an Elasticsearch container outside of Helm charts:
Can you help finding the good syntax 🙏🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, so the helm charts don't actually generate an elasticsearch.yaml file? Instead we rely on environment variables exclusively?
@rjernst the
-E
stuff is handled by the core settings stuff isn't it? I don't think that's Docker-specific. How would one denote an empty list via that syntax?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We allow users to define
elasticsearch.yaml
config usingesConfig
value, but for everything that is configured by the chart itself using custom values we have to use environment variables for a few reasons:esConfig.elasticsearch.yml
to detect that role is master and reuse it in Helm logic for exampleesConfig.elasticsearch.yml
is directly mounted as a file inside the container so we can't merge it with some custom config generated by HelmThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems related to elastic/elasticsearch#65577 and elastic/cloud-on-k8s#3718
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, given that issue is still open I'm not sure we have a real solution here for coordinating nodes. My only other though it to just use
voting_only
as that's pretty much functionally equivalent. The only different being that node will also participate in master node elections, which is probably ok. The real purpose of a coordinating node is to ensure it's only workload is handling requests.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jasontedor Might have thoughts. I don't see a way to set an empty list via -E
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found a workaround in e1bf227 by adding empty roles list in both
roles
chart value (to override default value) andnode.roles
settings inelasticsearch.yml
.I think we can use this workaround for now, but it could be great to find a way to define coordinating node properly using environment variable only.