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" .Values.cluster_name) -}}
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 "common.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 {{- if .Values.securityContext.enabled }}
49 fsGroup: {{ .Values.securityContext.fsGroup }}
51 {{- if or .Values.sysctlImage.enabled (and .Values.volumePermissions.enabled .Values.persistence.enabled) }}
53 {{- if .Values.sysctlImage.enabled }}
54 ## Image that performs the sysctl operation to modify Kernel settings (needed sometimes to avoid boot errors)
56 image: {{ include "repositoryGenerator.image.busybox" . }}
57 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
65 sysctl -w vm.max_map_count=262144 && sysctl -w fs.file-max=65536
69 {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }}
70 - name: volume-permissions
71 image: {{ include "repositoryGenerator.image.busybox" . }}
72 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
77 chown -R {{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }} //bitnami/elasticsearch/data
80 {{- if .Values.volumePermissions.resource }}
81 resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }}
85 mountPath: "/bitnami/elasticsearch/data"
89 - name: {{ include "common.name" . }}-data
90 image: {{ printf "%s/%s" (include "repositoryGenerator.dockerHubRepository" .) .Values.image }}
91 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
92 {{- if .Values.securityContext.enabled }}
94 runAsUser: {{ .Values.securityContext.runAsUser }}
98 value: {{ ternary "true" "false" .Values.debug | quote }}
99 - name: ELASTICSEARCH_CLUSTER_NAME
100 value: {{ .Values.cluster_name }}
101 - name: ELASTICSEARCH_CLUSTER_HOSTS
102 value: {{ include "common.name" . }}-discovery
103 {{- if .Values.plugins }}
104 - name: ELASTICSEARCH_PLUGINS
105 value: {{ .Values.plugins | quote }}
107 - name: ELASTICSEARCH_HEAP_SIZE
108 value: {{ .Values.heapSize | quote }}
109 - name: ELASTICSEARCH_IS_DEDICATED_NODE
111 - name: ELASTICSEARCH_NODE_TYPE
113 - name: network.bind_host
115 - name: network.publish_host
118 fieldPath: status.podIP
119 ports: {{- include "common.containerPorts" . |indent 12 }}
120 {{- if .Values.livenessProbe.enabled }}
122 initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
123 periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
124 timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
125 successThreshold: {{ .Values.livenessProbe.successThreshold }}
126 failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
128 path: /_cluster/health?local=true
131 {{- if .Values.readinessProbe.enabled }}
133 initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
134 periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
135 timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
136 successThreshold: {{ .Values.livenessProbe.successThreshold }}
137 failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
139 path: /_cluster/health?local=true
142 {{- if .Values.resources }}
143 resources: {{- toYaml .Values.resources | nindent 12 }}
146 {{- if .Values.config }}
147 - mountPath: /opt/bitnami/elasticsearch/config/elasticsearch.yml
149 subPath: elasticsearch.yml
152 mountPath: "/bitnami/elasticsearch/data"
153 {{- if .Values.extraVolumeMounts }}
154 {{- toYaml .Values.extraVolumeMounts | nindent 12 }}
157 {{- if .Values.config }}
160 name: {{ template "common.fullname" . }}
162 {{- if .Values.extraVolumes }}
163 {{- toYaml .Values.extraVolumes | nindent 8 }}
165 {{- if not .Values.persistence.enabled }}
169 volumeClaimTemplates:
172 {{- if .Values.persistence.annotations }}
173 annotations: {{- toYaml .Values.persistence.annotations | nindent 10 }}
177 - {{ .Values.persistence.accessMode }}
178 storageClassName: {{ include "common.storageClass" (dict "dot" . "suffix" .Values.persistence.suffix) }}
181 storage: {{ .Values.persistence.size | quote }}