Merge "[AAI] Add model-loader tracing config"
[oom.git] / kubernetes / common / elasticsearch / templates / coordinating-deploy.yaml
1 {{/*
2 # 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.
15 */}}
16 apiVersion: apps/v1
17 kind: Deployment
18 {{ $role := "coordinating-only" -}}
19 {{ $suffix := $role -}}
20 {{ $labels := (dict "role" $role "discovery" (include "elasticsearch.clustername" .)) -}}
21 metadata: {{- include "common.resourceMetadata" (dict "suffix" $suffix "labels" $labels "dot" . )| nindent 2 }}
22 spec:
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 "common.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: {{ include "repositoryGenerator.image.busybox" . }}
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 }}
66
67       containers:
68         - name: {{ include "common.name" . }}-nginx
69           image: {{ include "repositoryGenerator.image.nginx" . }}
70           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.nginx.pullPolicy | quote }}
71           ports: {{- include "common.containerPorts" . | indent 12 -}}
72           {{- if .Values.nginx.livenessProbe }}
73           livenessProbe: {{- toYaml .Values.nginx.livenessProbe | nindent 12 }}
74           {{- end }}
75           {{- if .Values.nginx.readinessProbe }}
76           readinessProbe: {{- toYaml .Values.nginx.readinessProbe | nindent 12 }}
77           {{- end }}
78           {{- if .Values.nginx.resources }}
79           resources: {{- toYaml .Values.nginx.resources | nindent 12 }}
80           {{- end }}
81           volumeMounts:
82           {{- if .Values.nginx.serverBlock }}
83           - name: nginx-server-block
84             mountPath: /opt/bitnami/nginx/conf/server_blocks
85           {{- end }}
86
87         - name: {{ include "common.name" . }}-elasticsearch
88           image: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.image }}
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.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             - name: network.bind_host
114               value: 127.0.0.1
115             - name: network.publish_host
116               valueFrom:
117                 fieldRef:
118                   fieldPath: status.podIP
119           {{/*ports: {{- include "common.containerPorts" . | indent 12 -}} */}}
120           {{- if .Values.livenessProbe.enabled }}
121           livenessProbe:
122             initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
123             periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
124             timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
125             successThreshold: {{ .Values.livenessProbe.successThreshold }}
126             failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
127             httpGet:
128               path: /_cluster/health?local=true
129               port: http
130           {{- end }}
131           {{- if .Values.readinessProbe.enabled}}
132           readinessProbe:
133             initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
134             periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
135             timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
136             successThreshold: {{ .Values.readinessProbe.successThreshold }}
137             failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
138             httpGet:
139               path: /_cluster/health?local=true
140               port: http
141           {{- end }}
142           {{- if .Values.resources }}
143           resources: {{- toYaml .Values.resources | nindent 12 }}
144           {{- end}}
145           volumeMounts:
146             {{- if .Values.config }}
147             - mountPath: /opt/bitnami/elasticsearch/config/elasticsearch.yml
148               name: config
149               subPath: elasticsearch.yml
150             {{- end }}
151             - name: data
152               mountPath: "/bitnami/elasticsearch/data/"
153             {{- if .Values.extraVolumeMounts }}
154             {{- toYaml .Values.extraVolumeMounts | nindent 12 }}
155             {{- end }}
156       volumes:
157         {{- if .Values.config }}
158         - name: config
159           configMap:
160             name: {{ include "common.fullname" . }}
161         {{- end }}
162         - name: data
163           emptyDir: {}
164         {{- if .Values.extraVolumes }}
165         {{- toYaml .Values.extraVolumes | nindent 8 }}
166         {{- end }}
167         {{- if .Values.nginx.serverBlock }}
168         - name: nginx-server-block
169           configMap:
170             name: {{ include "common.fullname" . }}-nginx-server-block
171         {{- end }}