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.
17 {{ $role := "master" -}}
18 {{ $suffix := $role -}}
19 {{ $labels := (dict "role" $role "discovery" (include "elasticsearch.clustername" .)) -}}
20 metadata: {{- include "common.resourceMetadata" (dict "suffix" $suffix "labels" $labels "dot" . )| nindent 2 }}
23 type: {{ .Values.updateStrategy.type }}
24 {{- if (eq "OnDelete" .Values.updateStrategy.type) }}
27 selector: {{- include "common.selectors" (dict "matchLabels" $labels "dot" .)| nindent 4 }}
28 serviceName: {{ include "common.fullname" . }}-master
29 replicas: {{ .Values.replicaCount }}
31 metadata: {{- include "common.templateMetadata" (dict "labels" $labels "dot" .) | nindent 6 }}
33 {{- include "elasticsearch.imagePullSecrets" . | nindent 6 }}
34 {{- if .Values.affinity }}
35 affinity: {{- include "common.tplValue" (dict "value" .Values.affinity "context" $) | nindent 8 }}
37 {{- if .Values.nodeSelector }}
38 nodeSelector: {{- include "common.tplValue" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }}
40 {{- if .Values.tolerations }}
41 tolerations: {{- include "common.tplValue" (dict "value" .Values.tolerations "context" $) | nindent 8 }}
43 serviceAccountName: {{ template "elasticsearch.serviceAccountName" . }}
44 {{- if .Values.securityContext.enabled }}
46 fsGroup: {{ .Values.securityContext.fsGroup }}
48 {{- if or .Values.sysctlImage.enabled (and .Values.volumePermissions.enabled .Values.persistence.enabled) }}
50 {{- if .Values.sysctlImage.enabled }}
51 ## Image that performs the sysctl operation to modify Kernel settings (needed sometimes to avoid boot errors)
53 image: {{ .Values.global.busyboxRepository | default .Values.busyboxRepository }}/{{ .Values.global.busyboxImage | default .Values.busyboxImage }}
54 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
62 sysctl -w vm.max_map_count=262144 && sysctl -w fs.file-max=65536
66 {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }}
67 - name: volume-permissions
68 image: {{ .Values.global.busyboxRepository | default .Values.busyboxRepository }}/{{ .Values.global.busyboxImage | default .Values.busyboxImage }}
69 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
74 chown -R {{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }} //bitnami/elasticsearch/data
77 {{- if .Values.volumePermissions.resource }}
78 resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }}
82 mountPath: "/bitnami/elasticsearch/data"
86 - name: {{ include "common.name" . }}-elasticsearch
87 image: {{ printf "%s/%s:%s" (include "common.repository" .) .Values.image.imageName .Values.image.tag }}
88 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
89 {{- if .Values.securityContext.enabled }}
91 runAsUser: {{ .Values.securityContext.runAsUser }}
95 value: {{ ternary "true" "false" .Values.image.debug | quote }}
96 - name: ELASTICSEARCH_CLUSTER_NAME
97 value: {{ include "elasticsearch.clustername" . }}
98 - name: ELASTICSEARCH_CLUSTER_HOSTS
99 value: {{ include "common.name" . }}-discovery
100 - name: ELASTICSEARCH_CLUSTER_MASTER_HOSTS
101 {{- $elasticsearchMasterFullname := printf "%s-%s" (include "common.fullname" . ) "master" }}
102 {{- $replicas := int .Values.replicaCount }}
103 value: {{range $i, $e := until $replicas }}{{ $elasticsearchMasterFullname }}-{{ $e }} {{ end }}
104 - name: ELASTICSEARCH_MINIMUM_MASTER_NODES
105 value: {{ add (div .Values.replicaCount 2) 1 | quote }}
106 {{- if .Values.plugins }}
107 - name: ELASTICSEARCH_PLUGINS
108 value: {{ .Values.plugins | quote }}
110 - name: ELASTICSEARCH_HEAP_SIZE
111 value: {{ .Values.heapSize | quote }}
112 - name: ELASTICSEARCH_IS_DEDICATED_NODE
113 value: {{ .Values.dedicatednode | quote }}
114 - name: ELASTICSEARCH_NODE_TYPE
116 ports: {{- include "common.containerPorts" . |indent 12 }}
117 {{- if .Values.livenessProbe.enabled }}
119 initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
120 periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
121 timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
122 successThreshold: {{ .Values.livenessProbe.successThreshold }}
123 failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
125 path: /_cluster/health?local=true
128 {{- if .Values.readinessProbe.enabled }}
130 initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
131 periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
132 timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
133 successThreshold: {{ .Values.livenessProbe.successThreshold }}
134 failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
136 path: /_cluster/health?local=true
139 {{- if .Values.resources }}
140 resources: {{- toYaml .Values.resources | nindent 12 }}
143 {{- if .Values.config }}
144 - mountPath: /opt/bitnami/elasticsearch/config/elasticsearch.yml
146 subPath: elasticsearch.yml
149 mountPath: /bitnami/elasticsearch/data
150 {{- if .Values.extraVolumeMounts }}
151 {{- toYaml .Values.extraVolumeMounts | nindent 12 }}
154 {{- if .Values.config }}
157 name: {{ include "common.fullname" . }}
159 {{- if .Values.extraVolumes }}
160 {{- toYaml .Values.extraVolumes | nindent 8 }}
162 {{- if not .Values.persistence.enabled }}
166 volumeClaimTemplates:
169 {{- if .Values.persistence.annotations }}
170 annotations: {{- toYaml .Values.persistence.annotations | nindent 10 }}
174 - {{ .Values.persistence.accessMode }}
175 storageClassName: {{ include "common.storageClass" (dict "dot" . "suffix" .Values.persistence.suffix) }}
178 storage: {{ .Values.persistence.size | quote }}