helm charts elastic search values.yaml code example

Example: how to pass elasticsearch.yml inside helm charts

### elasticsearch.yml file as configmap file for helm and k8s resources from below link
## https://github.com/helm/charts/blob/master/incubator/elasticsearch/templates/configmap.yaml

### configmap file

apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ template "elasticsearch.fullname" . }}
  labels:
    app: {{ template "elasticsearch.fullname" . }}
    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
    release: "{{ .Release.Name }}"
    heritage: "{{ .Release.Service }}"
data:
  elasticsearch.yml: |-
    cluster.name: {{ .Values.cluster.name }}
    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}
{{- 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 }}
    # 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 "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}

Tags:

Misc Example