blob: 05e09cb696ebd3d309291bcfcc0ee14919f29c11 [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"
Radoslaw Chmiel13a93682022-06-02 19:06:16 +0200116 - name: network.bind_host
117 value: 127.0.0.1
118 - name: network.publish_host
119 valueFrom:
120 fieldRef:
121 fieldPath: status.podIP
Alexander Dehnab86ec12020-02-05 14:38:54 +0000122 {{/*ports: {{- include "common.containerPorts" . | indent 12 -}} */}}
123 {{- if .Values.livenessProbe.enabled }}
124 livenessProbe:
125 initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
126 periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
127 timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
128 successThreshold: {{ .Values.livenessProbe.successThreshold }}
129 failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
130 httpGet:
131 path: /_cluster/health?local=true
132 port: http
133 {{- end }}
134 {{- if .Values.readinessProbe.enabled}}
135 readinessProbe:
136 initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
137 periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
138 timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
139 successThreshold: {{ .Values.readinessProbe.successThreshold }}
140 failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
141 httpGet:
142 path: /_cluster/health?local=true
143 port: http
144 {{- end }}
145 {{- if .Values.resources }}
146 resources: {{- toYaml .Values.resources | nindent 12 }}
147 {{- end}}
148 volumeMounts:
149 {{- if .Values.config }}
150 - mountPath: /opt/bitnami/elasticsearch/config/elasticsearch.yml
151 name: config
152 subPath: elasticsearch.yml
153 {{- end }}
154 - name: data
155 mountPath: "/bitnami/elasticsearch/data/"
156 {{- if .Values.extraVolumeMounts }}
157 {{- toYaml .Values.extraVolumeMounts | nindent 12 }}
158 {{- end }}
159 volumes:
160 {{- if .Values.config }}
161 - name: config
162 configMap:
163 name: {{ include "common.fullname" . }}
164 {{- end }}
165 - name: data
166 emptyDir: {}
167 {{- if .Values.extraVolumes }}
168 {{- toYaml .Values.extraVolumes | nindent 8 }}
169 {{- end }}
170 {{- if .Values.nginx.serverBlock }}
171 - name: nginx-server-block
172 configMap:
173 name: {{ include "common.fullname" . }}-nginx-server-block
174 {{- end }}
Krzysztof Opasiakc6152ce2020-05-09 01:43:08 +0200175 {{ include "common.certInitializer.volumes" . | nindent 8 }}