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.
18 {{ $role := "data" -}}
19 {{ $suffix := $role -}}
20 {{ $labels := (dict "role" $role "discovery" (include "elasticsearch.clustername" .)) -}}
21 metadata: {{- include "common.resourceMetadata" (dict "suffix" $suffix "labels" $labels "dot" . )| nindent 2 }}
24 type: {{ .Values.updateStrategy.type }}
25 {{- if (eq "OnDelete" .Values.updateStrategy.type) }}
27 {{- else if .Values.updateStrategy.rollingUpdatePartition }}
29 partition: {{ .Values.updateStrategy.rollingUpdatePartition }}
31 selector: {{- include "common.selectors" (dict "matchLabels" $labels "dot" .) | nindent 4 }}
32 serviceName: {{ include "common.fullname" . }}-data
33 replicas: {{ .Values.replicaCount }}
35 metadata: {{- include "common.templateMetadata" (dict "labels" $labels "dot" .) | nindent 6 }}
37 {{- include "elasticsearch.imagePullSecrets" . | nindent 6 }}
38 {{- if .Values.affinity }}
39 affinity: {{- include "common.tplValue" (dict "value" .Values.affinity "context" $) | nindent 8 }}
41 {{- if .Values.nodeSelector }}
42 nodeSelector: {{- include "common.tplValue" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }}
44 {{- if .Values.tolerations }}
45 tolerations: {{- include "common.tplValue" (dict "value" .Values.tolerations "context" $) | nindent 8 }}
47 serviceAccountName: {{ template "elasticsearch.data.serviceAccountName" . }}
48 {{- if .Values.securityContext.enabled }}
50 fsGroup: {{ .Values.securityContext.fsGroup }}
52 {{- if or .Values.sysctlImage.enabled (and .Values.volumePermissions.enabled .Values.persistence.enabled) }}
54 {{- if .Values.sysctlImage.enabled }}
55 ## Image that performs the sysctl operation to modify Kernel settings (needed sometimes to avoid boot errors)
57 image: {{ .Values.global.busyboxRepository | default .Values.busyboxRepository }}/{{ .Values.global.busyboxImage | default .Values.busyboxImage }}
58 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
66 sysctl -w vm.max_map_count=262144 && sysctl -w fs.file-max=65536
70 {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }}
71 - name: volume-permissions
72 image: {{ .Values.global.busyboxRepository | default .Values.busyboxRepository }}/{{ .Values.global.busyboxImage | default .Values.busyboxImage }}
73 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
78 chown -R {{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }} //bitnami/elasticsearch/data
81 {{- if .Values.volumePermissions.resource }}
82 resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }}
86 mountPath: "/bitnami/elasticsearch/data"
90 - name: {{ include "common.name" . }}-data
91 image: {{ printf "%s/%s" (include "common.repository" .) .Values.image }}
92 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
93 {{- if .Values.securityContext.enabled }}
95 runAsUser: {{ .Values.securityContext.runAsUser }}
99 value: {{ ternary "true" "false" .Values.debug | quote }}
100 - name: ELASTICSEARCH_CLUSTER_NAME
101 value: {{include "elasticsearch.clustername" .}}
102 - name: ELASTICSEARCH_CLUSTER_HOSTS
103 value: {{ include "common.name" . }}-discovery
104 {{- if .Values.plugins }}
105 - name: ELASTICSEARCH_PLUGINS
106 value: {{ .Values.plugins | quote }}
108 - name: ELASTICSEARCH_HEAP_SIZE
109 value: {{ .Values.heapSize | quote }}
110 - name: ELASTICSEARCH_IS_DEDICATED_NODE
112 - name: ELASTICSEARCH_NODE_TYPE
114 ports: {{- include "common.containerPorts" . |indent 12 }}
115 {{- if .Values.livenessProbe.enabled }}
117 initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
118 periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
119 timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
120 successThreshold: {{ .Values.livenessProbe.successThreshold }}
121 failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
123 path: /_cluster/health?local=true
126 {{- if .Values.readinessProbe.enabled }}
128 initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
129 periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
130 timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
131 successThreshold: {{ .Values.livenessProbe.successThreshold }}
132 failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
134 path: /_cluster/health?local=true
137 {{- if .Values.resources }}
138 resources: {{- toYaml .Values.resources | nindent 12 }}
141 {{- if .Values.config }}
142 - mountPath: /opt/bitnami/elasticsearch/config/elasticsearch.yml
144 subPath: elasticsearch.yml
147 mountPath: "/bitnami/elasticsearch/data"
148 {{- if .Values.extraVolumeMounts }}
149 {{- toYaml .Values.extraVolumeMounts | nindent 12 }}
152 {{- if .Values.config }}
155 name: {{ template "common.fullname" . }}
157 {{- if .Values.extraVolumes }}
158 {{- toYaml .Values.extraVolumes | nindent 8 }}
160 {{- if not .Values.persistence.enabled }}
164 volumeClaimTemplates:
167 {{- if .Values.persistence.annotations }}
168 annotations: {{- toYaml .Values.persistence.annotations | nindent 10 }}
172 - {{ .Values.persistence.accessMode }}
173 storageClassName: {{ include "common.storageClass" (dict "dot" . "suffix" .Values.persistence.suffix) }}
176 storage: {{ .Values.persistence.size | quote }}