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 }}
36 - name: "{{ include "common.namespace" . }}-docker-registry-key"
37 {{- if .Values.affinity }}
38 affinity: {{- include "common.tplValue" (dict "value" .Values.affinity "context" $) | nindent 8 }}
40 {{- if .Values.nodeSelector }}
41 nodeSelector: {{- include "common.tplValue" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }}
43 {{- if .Values.tolerations }}
44 tolerations: {{- include "common.tplValue" (dict "value" .Values.tolerations "context" $) | nindent 8 }}
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: {{ include "repositoryGenerator.image.busybox" . }}
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: {{ include "repositoryGenerator.image.busybox" . }}
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" . }}-master
89 image: {{ printf "%s/%s" (include "repositoryGenerator.dockerHubRepository" .) .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: {{ .Values.cluster_name }}
100 - name: ELASTICSEARCH_CLUSTER_HOSTS
101 value: {{ include "common.name" . }}-discovery
102 - name: ELASTICSEARCH_CLUSTER_MASTER_HOSTS
103 {{- $elasticsearchMasterFullname := printf "%s-%s" (include "common.fullname" . ) "master" }}
104 {{- $replicas := int .Values.replicaCount }}
105 value: {{range $i, $e := until $replicas }}{{ $elasticsearchMasterFullname }}-{{ $e }} {{ end }}
106 - name: ELASTICSEARCH_MINIMUM_MASTER_NODES
107 value: {{ add (div .Values.replicaCount 2) 1 | quote }}
108 {{- if .Values.plugins }}
109 - name: ELASTICSEARCH_PLUGINS
110 value: {{ .Values.plugins | quote }}
112 - name: ELASTICSEARCH_HEAP_SIZE
113 value: {{ .Values.heapSize | quote }}
114 - name: ELASTICSEARCH_IS_DEDICATED_NODE
115 value: {{ .Values.dedicatednode | quote }}
116 - name: ELASTICSEARCH_NODE_TYPE
118 ports: {{- include "common.containerPorts" . |indent 12 }}
119 {{- if .Values.livenessProbe.enabled }}
121 initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
122 periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
123 timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
124 successThreshold: {{ .Values.livenessProbe.successThreshold }}
125 failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
127 path: /_cluster/health?local=true
130 {{- if .Values.readinessProbe.enabled }}
132 initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
133 periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
134 timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
135 successThreshold: {{ .Values.livenessProbe.successThreshold }}
136 failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
138 path: /_cluster/health?local=true
141 {{- if .Values.resources }}
142 resources: {{- toYaml .Values.resources | nindent 12 }}
145 {{- if .Values.config }}
146 - mountPath: /opt/bitnami/elasticsearch/config/elasticsearch.yml
148 subPath: elasticsearch.yml
151 mountPath: /bitnami/elasticsearch/data
152 {{- if .Values.extraVolumeMounts }}
153 {{- toYaml .Values.extraVolumeMounts | nindent 12 }}
156 {{- if .Values.config }}
159 name: {{ include "common.fullname" . }}
161 {{- if .Values.extraVolumes }}
162 {{- toYaml .Values.extraVolumes | nindent 8 }}
164 {{- if not .Values.persistence.enabled }}
168 volumeClaimTemplates:
171 {{- if .Values.persistence.annotations }}
172 annotations: {{- toYaml .Values.persistence.annotations | nindent 10 }}
176 - {{ .Values.persistence.accessMode }}
177 storageClassName: {{ include "common.storageClass" (dict "dot" . "suffix" .Values.persistence.suffix) }}
180 storage: {{ .Values.persistence.size | quote }}