blob: cf9ef73e522925cc2a29c52cfc791284635837d3 [file] [log] [blame]
Jakub Latusek3659d9f2020-09-14 16:21:55 +02001{{/*
Alexander Dehnab86ec12020-02-05 14:38:54 +00002# Copyright © 2020 Bitnami, AT&T, Amdocs, Bell Canada, highstreet technologies
3#
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
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
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.
Jakub Latusek3659d9f2020-09-14 16:21:55 +020015*/}}
Alexander Dehnab86ec12020-02-05 14:38:54 +000016apiVersion: apps/v1
17kind: Deployment
18{{ $role := "coordinating-only" -}}
19{{ $suffix := $role -}}
20{{ $labels := (dict "role" $role "discovery" (include "elasticsearch.clustername" .)) -}}
21metadata: {{- include "common.resourceMetadata" (dict "suffix" $suffix "labels" $labels "dot" . )| nindent 2 }}
22spec:
23 strategy:
24 type: {{ .Values.updateStrategy.type }}
25 {{- if (eq "Recreate" .Values.updateStrategy.type) }}
26 rollingUpdate: null
27 {{- end }}
28 selector: {{- include "common.selectors" (dict "matchLabels" $labels "dot" .) | nindent 4 }}
29 replicas: {{ .Values.replicaCount }}
30 template:
31 metadata: {{- include "common.templateMetadata" (dict "labels" $labels "dot" .) | nindent 6 }}
32 spec:
33{{- include "elasticsearch.imagePullSecrets" . | nindent 6 }}
34 {{- if .Values.affinity }}
35 affinity: {{- include "common.tplValue" (dict "value" .Values.affinity "context" $) | nindent 8 }}
36 {{- end }}
37 {{- if .Values.nodeSelector }}
38 nodeSelector: {{- include "common.tplValue" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }}
39 {{- end }}
40 {{- if .Values.tolerations }}
41 tolerations: {{- include "common.tplValue" (dict "value" .Values.tolerations "context" $) | nindent 8 }}
42 {{- end }}
43 serviceAccountName: {{ template "elasticsearch.serviceAccountName" . }}
44 {{- if .Values.securityContext.enabled }}
45 securityContext:
46 fsGroup: {{ .Values.securityContext.fsGroup }}
47 {{- end }}
48
49 ## Image that performs the sysctl operation to modify Kernel settings (needed sometimes to avoid boot errors)
50 initContainers:
51 {{- if .Values.sysctlImage.enabled }}
52 - name: sysctl
53 image: {{ .Values.global.busyboxRepository | default .Values.busyboxRepository }}/{{ .Values.global.busyboxImage | default .Values.busyboxImage }}
54 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
55 command:
56 - /bin/sh
57 - -c
58 - |
59 set -o errexit
60 set -o pipefail
61 set -o nounset
62 sysctl -w vm.max_map_count=262144 && sysctl -w fs.file-max=65536
63 securityContext:
64 privileged: true
65 {{- end }}
Krzysztof Opasiakc6152ce2020-05-09 01:43:08 +020066 {{ include "common.certInitializer.initContainer" . | nindent 8 }}
Alexander Dehnab86ec12020-02-05 14:38:54 +000067
68 containers:
69 - name: {{ include "common.name" . }}-nginx
70 image: {{printf "%s/%s:%s" (include "common.repository" .) .Values.nginx.imageName .Values.nginx.tag }}
71 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.nginx.pullPolicy | quote }}
72 ports: {{- include "common.containerPorts" . | indent 12 -}}
73 {{- if .Values.nginx.livenessProbe }}
74 livenessProbe: {{- toYaml .Values.nginx.livenessProbe | nindent 12 }}
75 {{- end }}
76 {{- if .Values.nginx.readinessProbe }}
77 readinessProbe: {{- toYaml .Values.nginx.readinessProbe | nindent 12 }}
78 {{- end }}
79 {{- if .Values.nginx.resources }}
80 resources: {{- toYaml .Values.nginx.resources | nindent 12 }}
81 {{- end }}
82 volumeMounts:
83 {{- if .Values.nginx.serverBlock }}
84 - name: nginx-server-block
85 mountPath: /opt/bitnami/nginx/conf/server_blocks
86 {{- end }}
Krzysztof Opasiakc6152ce2020-05-09 01:43:08 +020087 {{- include "common.certInitializer.volumeMount" . | nindent 10 }}
Alexander Dehnab86ec12020-02-05 14:38:54 +000088
89 - name: {{ include "common.name" . }}-elasticsearch
Alexander Dehnc2a36862020-09-02 11:48:20 +000090 image: {{ printf "%s/%s" (include "common.repository" .) .Values.image }}
Alexander Dehnab86ec12020-02-05 14:38:54 +000091 {{- if .Values.securityContext.enabled }}
92 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
93 securityContext:
94 runAsUser: {{ .Values.securityContext.runAsUser }}
95 {{- end }}
96 env:
97 - name: BITNAMI_DEBUG
Alexander Dehnc2a36862020-09-02 11:48:20 +000098 value: {{ ternary "true" "false" .Values.debug | quote }}
Alexander Dehnab86ec12020-02-05 14:38:54 +000099 - name: ELASTICSEARCH_CLUSTER_NAME
100 value: {{ include "elasticsearch.clustername" .}}
101 - name: ELASTICSEARCH_CLUSTER_HOSTS
102 value: {{ include "common.name" . }}-discovery
103 {{- if .Values.plugins }}
104 - name: ELASTICSEARCH_PLUGINS
105 value: {{ .Values.plugins | quote }}
106 {{- end }}
107 - name: ELASTICSEARCH_HEAP_SIZE
108 value: {{ .Values.heapSize | quote }}
109 - name: ELASTICSEARCH_IS_DEDICATED_NODE
110 value: "yes"
111 - name: ELASTICSEARCH_NODE_TYPE
112 value: "coordinating"
113 - name: ELASTICSEARCH_PORT_NUMBER
114 value: "9000"
115 {{/*ports: {{- include "common.containerPorts" . | indent 12 -}} */}}
116 {{- if .Values.livenessProbe.enabled }}
117 livenessProbe:
118 initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
119 periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
120 timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
121 successThreshold: {{ .Values.livenessProbe.successThreshold }}
122 failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
123 httpGet:
124 path: /_cluster/health?local=true
125 port: http
126 {{- end }}
127 {{- if .Values.readinessProbe.enabled}}
128 readinessProbe:
129 initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
130 periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
131 timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
132 successThreshold: {{ .Values.readinessProbe.successThreshold }}
133 failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
134 httpGet:
135 path: /_cluster/health?local=true
136 port: http
137 {{- end }}
138 {{- if .Values.resources }}
139 resources: {{- toYaml .Values.resources | nindent 12 }}
140 {{- end}}
141 volumeMounts:
142 {{- if .Values.config }}
143 - mountPath: /opt/bitnami/elasticsearch/config/elasticsearch.yml
144 name: config
145 subPath: elasticsearch.yml
146 {{- end }}
147 - name: data
148 mountPath: "/bitnami/elasticsearch/data/"
149 {{- if .Values.extraVolumeMounts }}
150 {{- toYaml .Values.extraVolumeMounts | nindent 12 }}
151 {{- end }}
152 volumes:
153 {{- if .Values.config }}
154 - name: config
155 configMap:
156 name: {{ include "common.fullname" . }}
157 {{- end }}
158 - name: data
159 emptyDir: {}
160 {{- if .Values.extraVolumes }}
161 {{- toYaml .Values.extraVolumes | nindent 8 }}
162 {{- end }}
163 {{- if .Values.nginx.serverBlock }}
164 - name: nginx-server-block
165 configMap:
166 name: {{ include "common.fullname" . }}-nginx-server-block
167 {{- end }}
Krzysztof Opasiakc6152ce2020-05-09 01:43:08 +0200168 {{ include "common.certInitializer.volumes" . | nindent 8 }}