Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Commit

Permalink
support elasticsearch 7
Browse files Browse the repository at this point in the history
Signed-off-by: Taehyun Kim <kgyoo8232@gmail.com>
  • Loading branch information
kimxogus committed Apr 25, 2019
1 parent 4edbe97 commit d959d7b
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 15 deletions.
2 changes: 1 addition & 1 deletion stable/elasticsearch/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: elasticsearch
home: https://www.elastic.co/products/elasticsearch
version: 1.26.0
version: 1.27.0
appVersion: 6.7.0
description: Flexible and powerful open source, distributed real-time search and analytics
engine.
Expand Down
70 changes: 58 additions & 12 deletions stable/elasticsearch/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ data:
node.ingest: ${NODE_INGEST:true}
{{- else if hasPrefix "6." .Values.appVersion }}
node.ingest: ${NODE_INGEST:true}
{{- else if hasPrefix "7." .Values.appVersion }}
node.ingest: ${NODE_INGEST:true}
{{- end }}
node.name: ${HOSTNAME}

Expand All @@ -40,22 +42,22 @@ data:
ping.unicast.hosts: ${DISCOVERY_SERVICE:}
minimum_master_nodes: ${MINIMUM_MASTER_NODES:2}

{{- if .Values.cluster.xpackEnable }}
{{- if .Values.cluster.xpackEnable }}
# see https://www.elastic.co/guide/en/x-pack/current/xpack-settings.html
{{- if or ( gt $minorAppVersion 5.4 ) ( eq $minorAppVersion 5.4 ) }}
{{- if or ( gt $minorAppVersion 5.4 ) ( eq $minorAppVersion 5.4 ) }}
xpack.ml.enabled: ${XPACK_ML_ENABLED:false}
{{- end }}
{{- end }}
xpack.monitoring.enabled: ${XPACK_MONITORING_ENABLED:false}
xpack.security.enabled: ${XPACK_SECURITY_ENABLED:false}
xpack.watcher.enabled: ${XPACK_WATCHER_ENABLED:false}
{{- else }}
{{- if or ( gt $minorAppVersion 5.4 ) ( eq $minorAppVersion 5.4 ) }}
{{- else }}
{{- if or ( gt $minorAppVersion 5.4 ) ( eq $minorAppVersion 5.4 ) }}
xpack.ml.enabled: false
{{- end }}
{{- end }}
xpack.monitoring.enabled: false
xpack.security.enabled: false
xpack.watcher.enabled: false
{{- end }}
{{- end }}
{{- else if hasPrefix "6." .Values.appVersion }}
# see https://github.com/kubernetes/kubernetes/issues/3595
bootstrap.memory_lock: ${BOOTSTRAP_MEMORY_LOCK:false}
Expand All @@ -65,17 +67,37 @@ data:
ping.unicast.hosts: ${DISCOVERY_SERVICE:}
minimum_master_nodes: ${MINIMUM_MASTER_NODES:2}

{{- if and ( .Values.cluster.xpackEnable ) ( gt $minorAppVersion 6.3 ) }}
{{- if and ( .Values.cluster.xpackEnable ) ( gt $minorAppVersion 6.3 ) }}
# see https://www.elastic.co/guide/en/x-pack/current/xpack-settings.html
# After 6.3 xpack systems changed and are enabled by default and different configs manage them this enables monitoring
xpack.monitoring.collection.enabled: ${XPACK_MONITORING_ENABLED:false}
{{- else if .Values.cluster.xpackEnable }}
{{- else if .Values.cluster.xpackEnable }}
# see https://www.elastic.co/guide/en/x-pack/current/xpack-settings.html
xpack.ml.enabled: ${XPACK_ML_ENABLED:false}
xpack.monitoring.enabled: ${XPACK_MONITORING_ENABLED:false}
xpack.security.enabled: ${XPACK_SECURITY_ENABLED:false}
xpack.watcher.enabled: ${XPACK_WATCHER_ENABLED:false}
{{- end }}
{{- end }}
{{- else if hasPrefix "7." .Values.appVersion }}
# see https://github.com/kubernetes/kubernetes/issues/3595
bootstrap.memory_lock: ${BOOTSTRAP_MEMORY_LOCK:false}

discovery.seed_hosts:
- ${DISCOVERY_SERVICE:}
cluster.initial_master_nodes:
{{- $replicas := .Values.master.replicas | int }}
{{- range $i := untilStep 0 $replicas 1 }}
- {{ template "elasticsearch.master.fullname" $ }}-{{ $i }}
{{- end }}

{{- if .Values.cluster.xpackEnable }}
# see https://www.elastic.co/guide/en/x-pack/current/xpack-settings.html
xpack.ml.enabled: ${XPACK_ML_ENABLED:false}
xpack.monitoring.enabled: ${XPACK_MONITORING_ENABLED:false}
xpack.monitoring.collection.enabled: ${XPACK_MONITORING_ENABLED:false}
xpack.security.enabled: ${XPACK_SECURITY_ENABLED:false}
xpack.watcher.enabled: ${XPACK_WATCHER_ENABLED:false}
{{- end }}
{{- end }}

# see https://github.com/elastic/elasticsearch-definitive-guide/pull/679
Expand Down Expand Up @@ -128,9 +150,20 @@ data:
rootLogger.appenderRef.console.ref = console
logger.searchguard.name = com.floragunn
logger.searchguard.level = info
{{- else if hasPrefix "7." .Values.appVersion }}
log4j2.properties: |-
status = error
appender.console.type = Console
appender.console.name = console
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%m%n
rootLogger.level = info
rootLogger.appenderRef.console.ref = console
logger.searchguard.name = com.floragunn
logger.searchguard.level = info
{{- end }}
{{- if .Values.data.hooks.drain.enabled }}
pre-stop-hook.sh: |-
data-pre-stop-hook.sh: |-
#!/bin/bash
exec &> >(tee -a "/var/log/elasticsearch-hooks.log")
NODE_NAME=${HOSTNAME}
Expand All @@ -152,7 +185,7 @@ data:
sleep 1
done
echo "Node ${NODE_NAME} is ready to shutdown"
post-start-hook.sh: |-
data-post-start-hook.sh: |-
#!/bin/bash
exec &> >(tee -a "/var/log/elasticsearch-hooks.log")
NODE_NAME=${HOSTNAME}
Expand All @@ -167,3 +200,16 @@ data:
fi
echo "Node ${NODE_NAME} is ready to be used"
{{- end }}

{{- if hasPrefix "7." .Values.appVersion }}
master-pre-stop-hook.sh: |-
#!/bin/bash
exec &> >(tee -a "/var/log/elasticsearch-hooks.log")
NODE_NAME=${HOSTNAME}
echo "Exclude the node ${NODE_NAME} from voting config"
curl -s -XPOST -H 'Content-Type: application/json' "{{ template "elasticsearch.client.fullname" . }}:9200/_cluster/voting_config_exclusions/${NODE_NAME}"
echo ""
echo "Node ${NODE_NAME} is ready to shutdown"
{{- end }}
4 changes: 2 additions & 2 deletions stable/elasticsearch/templates/data-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ spec:
{{- if .Values.data.hooks.drain.enabled }}
- name: config
mountPath: /pre-stop-hook.sh
subPath: pre-stop-hook.sh
subPath: data-pre-stop-hook.sh
- name: config
mountPath: /post-start-hook.sh
subPath: post-start-hook.sh
subPath: data-post-start-hook.sh
lifecycle:
preStop:
exec:
Expand Down
10 changes: 10 additions & 0 deletions stable/elasticsearch/templates/master-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ spec:
{{ toYaml .Values.master.podAnnotations | indent 8 }}
{{- end }}
spec:
serviceName: {{ template "elasticsearch.master.fullname" . }}
serviceAccountName: {{ template "elasticsearch.serviceAccountName.master" . }}
{{- if .Values.master.priorityClassName }}
priorityClassName: "{{ .Values.master.priorityClassName }}"
Expand Down Expand Up @@ -168,6 +169,15 @@ spec:
subPath: elasticsearch.keystore
readOnly: true
{{- end }}
{{- if hasPrefix "7." .Values.appVersion }}
- name: config
mountPath: /pre-stop-hook.sh
subPath: master-pre-stop-hook.sh
lifecycle:
preStop:
exec:
command: ["/bin/bash","/pre-stop-hook.sh"]
{{- end }}
{{- if .Values.image.pullSecrets }}
imagePullSecrets:
{{- range $pullSecret := .Values.image.pullSecrets }}
Expand Down

0 comments on commit d959d7b

Please sign in to comment.