1 # Copyright © 2020 Bitnami, AT&T, Amdocs, Bell Canada, highstreet technologies
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
16 {{ $role := "data" -}}
17 {{ $suffix := $role -}}
18 {{ $labels := (dict "role" $role "discovery" (include "elasticsearch.clustername" .)) -}}
19 metadata: {{- include "common.resourceMetadata" (dict "suffix" $suffix "labels" $labels "dot" . )| nindent 2 }}
22 type: {{ .Values.updateStrategy.type }}
23 {{- if (eq "OnDelete" .Values.updateStrategy.type) }}
25 {{- else if .Values.updateStrategy.rollingUpdatePartition }}
27 partition: {{ .Values.updateStrategy.rollingUpdatePartition }}
29 selector: {{- include "common.selectors" (dict "matchLabels" $labels "dot" .) | nindent 4 }}
30 serviceName: {{ include "common.fullname" . }}-data
31 replicas: {{ .Values.replicaCount }}
33 metadata: {{- include "common.templateMetadata" (dict "labels" $labels "dot" .) | nindent 6 }}
35 {{- include "elasticsearch.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 serviceAccountName: {{ template "elasticsearch.data.serviceAccountName" . }}
46 {{- if .Values.securityContext.enabled }}
48 fsGroup: {{ .Values.securityContext.fsGroup }}
50 {{- if or .Values.sysctlImage.enabled (and .Values.volumePermissions.enabled .Values.persistence.enabled) }}
52 {{- if .Values.sysctlImage.enabled }}
53 ## Image that performs the sysctl operation to modify Kernel settings (needed sometimes to avoid boot errors)
55 image: {{ .Values.global.busyboxRepository | default .Values.busyboxRepository }}/{{ .Values.global.busyboxImage | default .Values.busyboxImage }}
56 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
64 sysctl -w vm.max_map_count=262144 && sysctl -w fs.file-max=65536
68 {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }}
69 - name: volume-permissions
70 image: {{ .Values.global.busyboxRepository | default .Values.busyboxRepository }}/{{ .Values.global.busyboxImage | default .Values.busyboxImage }}
71 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
76 chown -R {{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }} //bitnami/elasticsearch/data
79 {{- if .Values.volumePermissions.resource }}
80 resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }}
84 mountPath: "/bitnami/elasticsearch/data"
88 - name: {{ include "common.name" . }}-data
89 image: {{ printf "%s/%s" (include "common.repository" .) .Values.image }}
90 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
91 {{- if .Values.securityContext.enabled }}
93 runAsUser: {{ .Values.securityContext.runAsUser }}
97 value: {{ ternary "true" "false" .Values.debug | quote }}
98 - name: ELASTICSEARCH_CLUSTER_NAME
99 value: {{include "elasticsearch.clustername" .}}
100 - name: ELASTICSEARCH_CLUSTER_HOSTS
101 value: {{ include "common.name" . }}-discovery
102 {{- if .Values.plugins }}
103 - name: ELASTICSEARCH_PLUGINS
104 value: {{ .Values.plugins | quote }}
106 - name: ELASTICSEARCH_HEAP_SIZE
107 value: {{ .Values.heapSize | quote }}
108 - name: ELASTICSEARCH_IS_DEDICATED_NODE
110 - name: ELASTICSEARCH_NODE_TYPE
112 ports: {{- include "common.containerPorts" . |indent 12 }}
113 {{- if .Values.livenessProbe.enabled }}
115 initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
116 periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
117 timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
118 successThreshold: {{ .Values.livenessProbe.successThreshold }}
119 failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
121 path: /_cluster/health?local=true
124 {{- if .Values.readinessProbe.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.resources }}
136 resources: {{- toYaml .Values.resources | nindent 12 }}
139 {{- if .Values.config }}
140 - mountPath: /opt/bitnami/elasticsearch/config/elasticsearch.yml
142 subPath: elasticsearch.yml
145 mountPath: "/bitnami/elasticsearch/data"
146 {{- if .Values.extraVolumeMounts }}
147 {{- toYaml .Values.extraVolumeMounts | nindent 12 }}
150 {{- if .Values.config }}
153 name: {{ template "common.fullname" . }}
155 {{- if .Values.extraVolumes }}
156 {{- toYaml .Values.extraVolumes | nindent 8 }}
158 {{- if not .Values.persistence.enabled }}
162 volumeClaimTemplates:
165 {{- if .Values.persistence.annotations }}
166 annotations: {{- toYaml .Values.persistence.annotations | nindent 10 }}
170 - {{ .Values.persistence.accessMode }}
171 storageClassName: {{ include "common.storageClass" (dict "dot" . "suffix" .Values.persistence.suffix) }}
174 storage: {{ .Values.persistence.size | quote }}