blob: 22de4dbf370d81987561a004b0722bf608443728 [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:
Sylvain Desbureaux829344b2020-11-19 17:07:26 +010033 imagePullSecrets:
34 - name: "{{ include "common.namespace" . }}-docker-registry-key"
Alexander Dehnab86ec12020-02-05 14:38:54 +000035 {{- if .Values.affinity }}
36 affinity: {{- include "common.tplValue" (dict "value" .Values.affinity "context" $) | nindent 8 }}
37 {{- end }}
38 {{- if .Values.nodeSelector }}
39 nodeSelector: {{- include "common.tplValue" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }}
40 {{- end }}
41 {{- if .Values.tolerations }}
42 tolerations: {{- include "common.tplValue" (dict "value" .Values.tolerations "context" $) | nindent 8 }}
43 {{- end }}
44 serviceAccountName: {{ template "elasticsearch.serviceAccountName" . }}
45 {{- if .Values.securityContext.enabled }}
46 securityContext:
47 fsGroup: {{ .Values.securityContext.fsGroup }}
48 {{- end }}
49
50 ## Image that performs the sysctl operation to modify Kernel settings (needed sometimes to avoid boot errors)
51 initContainers:
52 {{- if .Values.sysctlImage.enabled }}
53 - name: sysctl
Sylvain Desbureaux829344b2020-11-19 17:07:26 +010054 image: {{ include "repositoryGenerator.image.busybox" . }}
Alexander Dehnab86ec12020-02-05 14:38:54 +000055 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
56 command:
57 - /bin/sh
58 - -c
59 - |
60 set -o errexit
61 set -o pipefail
62 set -o nounset
63 sysctl -w vm.max_map_count=262144 && sysctl -w fs.file-max=65536
64 securityContext:
65 privileged: true
66 {{- end }}
Krzysztof Opasiakc6152ce2020-05-09 01:43:08 +020067 {{ include "common.certInitializer.initContainer" . | nindent 8 }}
Alexander Dehnab86ec12020-02-05 14:38:54 +000068
69 containers:
70 - name: {{ include "common.name" . }}-nginx
Sylvain Desbureaux829344b2020-11-19 17:07:26 +010071 image: {{ include "repositoryGenerator.image.nginx" . }}
Alexander Dehnab86ec12020-02-05 14:38:54 +000072 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.nginx.pullPolicy | quote }}
73 ports: {{- include "common.containerPorts" . | indent 12 -}}
74 {{- if .Values.nginx.livenessProbe }}
75 livenessProbe: {{- toYaml .Values.nginx.livenessProbe | nindent 12 }}
76 {{- end }}
77 {{- if .Values.nginx.readinessProbe }}
78 readinessProbe: {{- toYaml .Values.nginx.readinessProbe | nindent 12 }}
79 {{- end }}
80 {{- if .Values.nginx.resources }}
81 resources: {{- toYaml .Values.nginx.resources | nindent 12 }}
82 {{- end }}
83 volumeMounts:
84 {{- if .Values.nginx.serverBlock }}
85 - name: nginx-server-block
86 mountPath: /opt/bitnami/nginx/conf/server_blocks
87 {{- end }}
Krzysztof Opasiakc6152ce2020-05-09 01:43:08 +020088 {{- include "common.certInitializer.volumeMount" . | nindent 10 }}
Alexander Dehnab86ec12020-02-05 14:38:54 +000089
90 - name: {{ include "common.name" . }}-elasticsearch
Sylvain Desbureaux829344b2020-11-19 17:07:26 +010091 image: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.image }}
Alexander Dehnab86ec12020-02-05 14:38:54 +000092 {{- if .Values.securityContext.enabled }}
93 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
94 securityContext:
95 runAsUser: {{ .Values.securityContext.runAsUser }}
96 {{- end }}
97 env:
98 - name: BITNAMI_DEBUG
Alexander Dehnc2a36862020-09-02 11:48:20 +000099 value: {{ ternary "true" "false" .Values.debug | quote }}
Alexander Dehnab86ec12020-02-05 14:38:54 +0000100 - name: ELASTICSEARCH_CLUSTER_NAME
101 value: {{ include "elasticsearch.clustername" .}}
102 - name: ELASTICSEARCH_CLUSTER_HOSTS
103 value: {{ include "common.name" . }}-discovery
104 {{- if .Values.plugins }}
105 - name: ELASTICSEARCH_PLUGINS
106 value: {{ .Values.plugins | quote }}
107 {{- end }}
108 - name: ELASTICSEARCH_HEAP_SIZE
109 value: {{ .Values.heapSize | quote }}
110 - name: ELASTICSEARCH_IS_DEDICATED_NODE
111 value: "yes"
112 - name: ELASTICSEARCH_NODE_TYPE
113 value: "coordinating"
114 - name: ELASTICSEARCH_PORT_NUMBER
115 value: "9000"
116 {{/*ports: {{- include "common.containerPorts" . | indent 12 -}} */}}
117 {{- if .Values.livenessProbe.enabled }}
118 livenessProbe:
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 }}
124 httpGet:
125 path: /_cluster/health?local=true
126 port: http
127 {{- end }}
128 {{- if .Values.readinessProbe.enabled}}
129 readinessProbe:
130 initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
131 periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
132 timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
133 successThreshold: {{ .Values.readinessProbe.successThreshold }}
134 failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
135 httpGet:
136 path: /_cluster/health?local=true
137 port: http
138 {{- end }}
139 {{- if .Values.resources }}
140 resources: {{- toYaml .Values.resources | nindent 12 }}
141 {{- end}}
142 volumeMounts:
143 {{- if .Values.config }}
144 - mountPath: /opt/bitnami/elasticsearch/config/elasticsearch.yml
145 name: config
146 subPath: elasticsearch.yml
147 {{- end }}
148 - name: data
149 mountPath: "/bitnami/elasticsearch/data/"
150 {{- if .Values.extraVolumeMounts }}
151 {{- toYaml .Values.extraVolumeMounts | nindent 12 }}
152 {{- end }}
153 volumes:
154 {{- if .Values.config }}
155 - name: config
156 configMap:
157 name: {{ include "common.fullname" . }}
158 {{- end }}
159 - name: data
160 emptyDir: {}
161 {{- if .Values.extraVolumes }}
162 {{- toYaml .Values.extraVolumes | nindent 8 }}
163 {{- end }}
164 {{- if .Values.nginx.serverBlock }}
165 - name: nginx-server-block
166 configMap:
167 name: {{ include "common.fullname" . }}-nginx-server-block
168 {{- end }}
Krzysztof Opasiakc6152ce2020-05-09 01:43:08 +0200169 {{ include "common.certInitializer.volumes" . | nindent 8 }}