github.com/microsoft/fabrikate@v1.0.0-alpha.1.0.20210115014322-dc09194d0885/testdata/generate/infra/fabrikate-jaeger/helm_repos/jaeger/charts/elasticsearch/templates/configmap.yaml (about) 1 {{ $minorAppVersion := regexFind "[0-9]*.[0-9]*" .Values.appVersion | float64 -}} 2 apiVersion: v1 3 kind: ConfigMap 4 metadata: 5 name: {{ template "elasticsearch.fullname" . }} 6 labels: 7 app: {{ template "elasticsearch.fullname" . }} 8 chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" 9 release: "{{ .Release.Name }}" 10 heritage: "{{ .Release.Service }}" 11 data: 12 elasticsearch.yml: |- 13 cluster.name: {{ .Values.cluster.name }} 14 15 node.data: ${NODE_DATA:true} 16 node.master: ${NODE_MASTER:true} 17 {{- if hasPrefix "5." .Values.appVersion }} 18 node.ingest: ${NODE_INGEST:true} 19 {{- else if hasPrefix "6." .Values.appVersion }} 20 node.ingest: ${NODE_INGEST:true} 21 {{- end }} 22 node.name: ${HOSTNAME} 23 24 {{- if .Values.forceIpv6 }} 25 network.host: "::" 26 {{- else }} 27 network.host: 0.0.0.0 28 {{- end }} 29 30 {{- if hasPrefix "2." .Values.appVersion }} 31 # see https://github.com/kubernetes/kubernetes/issues/3595 32 bootstrap.mlockall: ${BOOTSTRAP_MLOCKALL:false} 33 34 discovery: 35 zen: 36 ping.unicast.hosts: ${DISCOVERY_SERVICE:} 37 minimum_master_nodes: ${MINIMUM_MASTER_NODES:2} 38 {{- else if hasPrefix "5." .Values.appVersion }} 39 # see https://github.com/kubernetes/kubernetes/issues/3595 40 bootstrap.memory_lock: ${BOOTSTRAP_MEMORY_LOCK:false} 41 42 discovery: 43 zen: 44 ping.unicast.hosts: ${DISCOVERY_SERVICE:} 45 minimum_master_nodes: ${MINIMUM_MASTER_NODES:2} 46 47 {{- if .Values.cluster.xpackEnable }} 48 # see https://www.elastic.co/guide/en/x-pack/current/xpack-settings.html 49 {{- if or ( gt $minorAppVersion 5.4 ) ( eq $minorAppVersion 5.4 ) }} 50 xpack.ml.enabled: ${XPACK_ML_ENABLED:false} 51 {{- end }} 52 xpack.monitoring.enabled: ${XPACK_MONITORING_ENABLED:false} 53 xpack.security.enabled: ${XPACK_SECURITY_ENABLED:false} 54 xpack.watcher.enabled: ${XPACK_WATCHER_ENABLED:false} 55 {{- else }} 56 {{- if or ( gt $minorAppVersion 5.4 ) ( eq $minorAppVersion 5.4 ) }} 57 xpack.ml.enabled: false 58 {{- end }} 59 xpack.monitoring.enabled: false 60 xpack.security.enabled: false 61 xpack.watcher.enabled: false 62 {{- end }} 63 {{- else if hasPrefix "6." .Values.appVersion }} 64 # see https://github.com/kubernetes/kubernetes/issues/3595 65 bootstrap.memory_lock: ${BOOTSTRAP_MEMORY_LOCK:false} 66 67 discovery: 68 zen: 69 ping.unicast.hosts: ${DISCOVERY_SERVICE:} 70 minimum_master_nodes: ${MINIMUM_MASTER_NODES:2} 71 72 {{- if and ( .Values.cluster.xpackEnable ) ( gt $minorAppVersion 6.3 ) }} 73 # see https://www.elastic.co/guide/en/x-pack/current/xpack-settings.html 74 # After 6.3 xpack systems changed and are enabled by default and different configs manage them this enables monitoring 75 xpack.monitoring.collection.enabled: ${XPACK_MONITORING_ENABLED:false} 76 {{- else if .Values.cluster.xpackEnable }} 77 # see https://www.elastic.co/guide/en/x-pack/current/xpack-settings.html 78 xpack.ml.enabled: ${XPACK_ML_ENABLED:false} 79 xpack.monitoring.enabled: ${XPACK_MONITORING_ENABLED:false} 80 xpack.security.enabled: ${XPACK_SECURITY_ENABLED:false} 81 xpack.watcher.enabled: ${XPACK_WATCHER_ENABLED:false} 82 {{- end }} 83 {{- end }} 84 85 # see https://github.com/elastic/elasticsearch-definitive-guide/pull/679 86 processors: ${PROCESSORS:} 87 88 # avoid split-brain w/ a minimum consensus of two masters plus a data node 89 gateway.expected_master_nodes: ${EXPECTED_MASTER_NODES:2} 90 gateway.expected_data_nodes: ${EXPECTED_DATA_NODES:1} 91 gateway.recover_after_time: ${RECOVER_AFTER_TIME:5m} 92 gateway.recover_after_master_nodes: ${RECOVER_AFTER_MASTER_NODES:2} 93 gateway.recover_after_data_nodes: ${RECOVER_AFTER_DATA_NODES:1} 94 {{- with .Values.cluster.config }} 95 {{ toYaml . | indent 4 }} 96 {{- end }} 97 {{- if hasPrefix "2." .Values.appVersion }} 98 logging.yml: |- 99 {{ toYaml .Values.cluster.loggingYml | indent 4 }} 100 {{- else }} 101 log4j2.properties: |- 102 {{ tpl .Values.cluster.log4j2Properties . | indent 4 }} 103 {{- end }} 104 {{- if .Values.data.hooks.drain.enabled }} 105 data-pre-stop-hook.sh: |- 106 #!/bin/bash 107 exec &> >(tee -a "/var/log/elasticsearch-hooks.log") 108 NODE_NAME=${HOSTNAME} 109 echo "Prepare to migrate data of the node ${NODE_NAME}" 110 echo "Move all data from node ${NODE_NAME}" 111 curl -s -XPUT -H 'Content-Type: application/json' '{{ template "elasticsearch.client.fullname" . }}:9200/_cluster/settings' -d "{ 112 \"transient\" :{ 113 \"cluster.routing.allocation.exclude._name\" : \"${NODE_NAME}\" 114 } 115 }" 116 echo "" 117 118 while true ; do 119 echo -e "Wait for node ${NODE_NAME} to become empty" 120 SHARDS_ALLOCATION=$(curl -s -XGET 'http://{{ template "elasticsearch.client.fullname" . }}:9200/_cat/shards') 121 if ! echo "${SHARDS_ALLOCATION}" | grep -E "${NODE_NAME}"; then 122 break 123 fi 124 sleep 1 125 done 126 echo "Node ${NODE_NAME} is ready to shutdown" 127 data-post-start-hook.sh: |- 128 #!/bin/bash 129 exec &> >(tee -a "/var/log/elasticsearch-hooks.log") 130 NODE_NAME=${HOSTNAME} 131 CLUSTER_SETTINGS=$(curl -s -XGET "http://{{ template "elasticsearch.client.fullname" . }}:9200/_cluster/settings") 132 if echo "${CLUSTER_SETTINGS}" | grep -E "${NODE_NAME}"; then 133 echo "Activate node ${NODE_NAME}" 134 curl -s -XPUT -H 'Content-Type: application/json' "http://{{ template "elasticsearch.client.fullname" . }}:9200/_cluster/settings" -d "{ 135 \"transient\" :{ 136 \"cluster.routing.allocation.exclude._name\" : null 137 } 138 }" 139 fi 140 echo "Node ${NODE_NAME} is ready to be used" 141 {{- else }} 142 {{- if .Values.data.hooks.preStop }} 143 data-pre-stop-hook.sh: |- 144 {{ tpl .Values.data.hooks.preStop . | indent 4 }} 145 {{- end }} 146 {{- if .Values.data.hooks.postStart }} 147 data-post-start-hook.sh: |- 148 {{ tpl .Values.data.hooks.postStart . | indent 4 }} 149 {{- end }} 150 {{- end }} 151 152 {{- if .Values.client.hooks.preStop }} 153 client-pre-stop-hook.sh: |- 154 {{ tpl .Values.client.hooks.preStop . | indent 4 }} 155 {{- end }} 156 {{- if .Values.client.hooks.postStart }} 157 client-post-start-hook.sh: |- 158 {{ tpl .Values.client.hooks.postStart . | indent 4 }} 159 {{- end }} 160 161 {{- if .Values.master.hooks.preStop }} 162 master-pre-stop-hook.sh: |- 163 {{ tpl .Values.master.hooks.preStop . | indent 4 }} 164 {{- end }} 165 {{- if .Values.master.hooks.postStart }} 166 master-post-start-hook.sh: |- 167 {{ tpl .Values.master.hooks.postStart . | indent 4 }} 168 {{- end }}