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