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

Commit

Permalink
refactor configmap
Browse files Browse the repository at this point in the history
Signed-off-by: Taehyun Kim <[email protected]>
  • Loading branch information
kimxogus committed May 2, 2019
1 parent 5064328 commit 2100d14
Showing 1 changed file with 22 additions and 59 deletions.
81 changes: 22 additions & 59 deletions stable/elasticsearch/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ $majorAppVersion := regexFind "[0-9]*" .Values.appVersion | int -}}
{{ $minorAppVersion := regexFind "[0-9]*.[0-9]*" .Values.appVersion | float64 -}}
apiVersion: v1
kind: ConfigMap
Expand All @@ -14,90 +15,51 @@ data:
node.data: ${NODE_DATA:true}
node.master: ${NODE_MASTER:true}
{{- if hasPrefix "5." .Values.appVersion }}
node.ingest: ${NODE_INGEST:true}
{{- else if hasPrefix "6." .Values.appVersion }}
node.ingest: ${NODE_INGEST:true}
{{- else if hasPrefix "7." .Values.appVersion }}
{{- if not (lt $majorAppVersion 5) }}
node.ingest: ${NODE_INGEST:true}
{{- end }}
node.name: ${HOSTNAME}

network.host: 0.0.0.0

{{- if hasPrefix "2." .Values.appVersion }}
# see https://github.com/kubernetes/kubernetes/issues/3595
bootstrap.mlockall: ${BOOTSTRAP_MLOCKALL:false}

discovery:
zen:
ping.unicast.hosts: ${DISCOVERY_SERVICE:}
minimum_master_nodes: ${MINIMUM_MASTER_NODES:2}
{{- else if hasPrefix "5." .Values.appVersion }}
# see https://github.com/kubernetes/kubernetes/issues/3595
bootstrap.memory_lock: ${BOOTSTRAP_MEMORY_LOCK:false}

discovery:
zen:
ping.unicast.hosts: ${DISCOVERY_SERVICE:}
minimum_master_nodes: ${MINIMUM_MASTER_NODES:2}

{{- if .Values.cluster.xpackEnable }}
{{- if and (not (lt $majorAppVersion 5)) .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 ) }}
# or https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-xpack.html
{{- if not ( lt $minorAppVersion 5.4 ) }}
xpack.ml.enabled: ${XPACK_ML_ENABLED:false}
{{- 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 ) }}
xpack.ml.enabled: false
{{- if gt $minorAppVersion 6.3 }}
xpack.monitoring.collection.enabled: ${XPACK_MONITORING_ENABLED:false}
{{- end }}
xpack.monitoring.enabled: false
xpack.security.enabled: false
xpack.watcher.enabled: false
{{- end }}
{{- else if hasPrefix "6." .Values.appVersion }}
# see https://github.com/kubernetes/kubernetes/issues/3595
bootstrap.memory_lock: ${BOOTSTRAP_MEMORY_LOCK:false}

discovery:
zen:
ping.unicast.hosts: ${DISCOVERY_SERVICE:}
minimum_master_nodes: ${MINIMUM_MASTER_NODES:2}

{{- 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 }}
# 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 }}
{{- else if hasPrefix "7." .Values.appVersion }}


{{- if not (lt $majorAppVersion 5) }}
# see https://github.com/kubernetes/kubernetes/issues/3595
bootstrap.memory_lock: ${BOOTSTRAP_MEMORY_LOCK:false}
{{- else if not (lt $majorAppVersion 2) }}
# see https://github.com/kubernetes/kubernetes/issues/3595
bootstrap.mlockall: ${BOOTSTRAP_MLOCKALL:false}
{{- end }}

{{- if not (lt $majorAppVersion 7) }}
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 }}
{{- else if not (lt $majorAppVersion 2) }}
discovery:
zen:
ping.unicast.hosts: ${DISCOVERY_SERVICE:}
minimum_master_nodes: ${MINIMUM_MASTER_NODES:2}
{{- end }}

# see https://github.com/elastic/elasticsearch-definitive-guide/pull/679
Expand All @@ -112,6 +74,7 @@ data:
{{- with .Values.cluster.config }}
{{ toYaml . | indent 4 }}
{{- end }}

{{- if hasPrefix "2." .Values.appVersion }}
logging.yml: |-
# you can override this using by setting a system property, for example -Des.logger.level=DEBUG
Expand Down

0 comments on commit 2100d14

Please sign in to comment.