2 # Copyright © 2020 Bitnami, AT&T, Amdocs, Bell Canada, highstreet technologies
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
19 {{ $role := "master" -}}
20 {{ $suffix := $role -}}
21 {{ $labels := (dict "role" $role "discovery" .Values.cluster_name) -}}
22 metadata: {{- include "common.resourceMetadata" (dict "suffix" $suffix "labels" $labels "dot" . )| nindent 2 }}
25 type: {{ .Values.updateStrategy.type }}
26 {{- if (eq "OnDelete" .Values.updateStrategy.type) }}
29 selector: {{- include "common.selectors" (dict "matchLabels" $labels "dot" .)| nindent 4 }}
30 serviceName: {{ include "common.fullname" . }}-master
31 replicas: {{ .Values.replicaCount }}
33 metadata: {{- include "common.templateMetadata" (dict "labels" $labels "dot" .) | nindent 6 }}
35 {{- include "common.imagePullSecrets" . | nindent 6 }}
36 {{- if .Values.affinity }}
37 affinity: {{- include "common.tplValue" (dict "value" .Values.affinity "context" $) | nindent 8 }}
39 {{- if .Values.nodeSelector }}
40 nodeSelector: {{- include "common.tplValue" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }}
42 {{- if .Values.tolerations }}
43 tolerations: {{- include "common.tplValue" (dict "value" .Values.tolerations "context" $) | nindent 8 }}
45 {{- if .Values.securityContext.enabled }}
47 fsGroup: {{ .Values.securityContext.fsGroup }}
49 {{- if or .Values.sysctlImage.enabled (and .Values.volumePermissions.enabled .Values.persistence.enabled) }}
51 {{- if .Values.sysctlImage.enabled }}
52 ## Image that performs the sysctl operation to modify Kernel settings (needed sometimes to avoid boot errors)
54 image: {{ include "repositoryGenerator.image.busybox" . }}
55 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
63 sysctl -w vm.max_map_count=262144 && sysctl -w fs.file-max=65536
67 {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }}
68 - name: volume-permissions
69 image: {{ include "repositoryGenerator.image.busybox" . }}
70 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
75 chown -R {{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }} //bitnami/elasticsearch/data
78 {{- if .Values.volumePermissions.resource }}
79 resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }}
83 mountPath: "/bitnami/elasticsearch/data"
87 - name: {{ include "common.name" . }}-master
88 image: {{ printf "%s/%s" (include "repositoryGenerator.dockerHubRepository" .) .Values.image }}
89 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
90 {{- if .Values.securityContext.enabled }}
92 runAsUser: {{ .Values.securityContext.runAsUser }}
96 value: {{ ternary "true" "false" .Values.debug | quote }}
97 - name: ELASTICSEARCH_CLUSTER_NAME
98 value: {{ .Values.cluster_name }}
99 - name: ELASTICSEARCH_CLUSTER_HOSTS
100 value: {{ include "common.name" . }}-discovery
101 - name: ELASTICSEARCH_CLUSTER_MASTER_HOSTS
102 {{- $elasticsearchMasterFullname := printf "%s-%s" (include "common.fullname" . ) "master" }}
103 {{- $replicas := int .Values.replicaCount }}
104 value: {{range $i, $e := until $replicas }}{{ $elasticsearchMasterFullname }}-{{ $e }} {{ end }}
105 - name: ELASTICSEARCH_MINIMUM_MASTER_NODES
106 value: {{ add (div .Values.replicaCount 2) 1 | quote }}
107 {{- if .Values.plugins }}
108 - name: ELASTICSEARCH_PLUGINS
109 value: {{ .Values.plugins | quote }}
111 - name: ELASTICSEARCH_HEAP_SIZE
112 value: {{ .Values.heapSize | quote }}
113 - name: ELASTICSEARCH_IS_DEDICATED_NODE
114 value: {{ .Values.dedicatednode | quote }}
115 - name: ELASTICSEARCH_NODE_TYPE
117 - name: network.bind_host
119 - name: network.publish_host
122 fieldPath: status.podIP
123 ports: {{- include "common.containerPorts" . |indent 12 }}
124 {{- if .Values.livenessProbe.enabled }}
126 initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
127 periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
128 timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
129 successThreshold: {{ .Values.livenessProbe.successThreshold }}
130 failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
132 path: /_cluster/health?local=true
135 {{- if .Values.readinessProbe.enabled }}
137 initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
138 periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
139 timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
140 successThreshold: {{ .Values.livenessProbe.successThreshold }}
141 failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
143 path: /_cluster/health?local=true
146 {{- if .Values.resources }}
147 resources: {{- toYaml .Values.resources | nindent 12 }}
150 {{- if .Values.config }}
151 - mountPath: /opt/bitnami/elasticsearch/config/elasticsearch.yml
153 subPath: elasticsearch.yml
156 mountPath: /bitnami/elasticsearch/data
157 {{- if .Values.extraVolumeMounts }}
158 {{- toYaml .Values.extraVolumeMounts | nindent 12 }}
161 {{- if .Values.config }}
164 name: {{ include "common.fullname" . }}
166 {{- if .Values.extraVolumes }}
167 {{- toYaml .Values.extraVolumes | nindent 8 }}
169 {{- if not .Values.persistence.enabled }}
173 volumeClaimTemplates:
176 {{- if .Values.persistence.annotations }}
177 annotations: {{- toYaml .Values.persistence.annotations | nindent 10 }}
181 - {{ .Values.persistence.accessMode }}
182 storageClassName: {{ include "common.storageClass" (dict "dot" . "suffix" .Values.persistence.suffix) }}
185 storage: {{ .Values.persistence.size | quote }}