[AAI] Reintegrate AAI OOM charts in main repo
[oom.git] / kubernetes / aai / components / aai-elasticsearch / templates / deployment.yaml
1 # Copyright © 2018 Amdocs, Bell Canada, AT&T
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.
14
15 apiVersion: apps/v1
16 kind: Deployment
17 metadata:
18   name: {{ include "common.fullname" . }}
19   namespace: {{ include "common.namespace" . }}
20   labels:
21     app: {{ include "common.name" . }}
22     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
23     release: {{ include "common.release" . }}
24     heritage: {{ .Release.Service }}
25 spec:
26   replicas: {{ .Values.replicaCount }}
27   selector:
28     matchLabels:
29       app: {{ include "common.name" . }}
30   template:
31     metadata:
32       labels:
33         app: {{ include "common.name" . }}
34         release: {{ include "common.release" . }}
35       name: {{ include "common.name" . }}
36     spec:
37       hostname: {{ include "common.name" . }}
38       initContainers:
39       - command:
40         - /bin/sh
41         - -c
42         - |
43           sysctl -w vm.max_map_count=262144
44           mkdir -p /logroot/elasticsearch/logs
45           mkdir -p /logroot/elasticsearch/data
46           chmod -R 777 /logroot/elasticsearch
47           chown -R 1000:1000 /logroot
48         env:
49         - name: NAMESPACE
50           valueFrom:
51             fieldRef:
52               apiVersion: v1
53               fieldPath: metadata.namespace
54         securityContext:
55           privileged: true
56         image: {{ .Values.global.dockerhubRepository | default .Values.dockerhubRepository }}/{{ .Values.global.busyboxImage | default .Values.busyboxImage }}
57         imagePullPolicy: {{ .Values.pullPolicy | default .Values.global.pullPolicy }}
58         name: init-sysctl
59         volumeMounts:
60         - name: elasticsearch-data
61           mountPath: /logroot/
62       containers:
63       - name: {{ include "common.name" . }}
64         image: "{{ .Values.global.loggingRepository }}/{{ .Values.image }}"
65         imagePullPolicy: {{ .Values.pullPolicy | default .Values.global.pullPolicy }}
66         ports:
67         - containerPort: {{ .Values.service.internalPort }}
68         - containerPort: {{ .Values.service.internalPort2 }}
69         # disable liveness probe when breakpoints set in debugger
70         # so K8s doesn't restart unresponsive container
71         {{- if eq .Values.liveness.enabled true }}
72         livenessProbe:
73           tcpSocket:
74             port: {{ .Values.service.internalPort }}
75           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
76           periodSeconds: {{ .Values.liveness.periodSeconds }}
77         {{ end -}}
78         readinessProbe:
79           tcpSocket:
80             port: {{ .Values.service.internalPort }}
81           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
82           periodSeconds: {{ .Values.readiness.periodSeconds }}
83         volumeMounts:
84           - name: localtime
85             mountPath: /etc/localtime
86             readOnly: true
87           - name: elasticsearch-config
88             subPath: elasticsearch.yml
89             mountPath: /usr/share/elasticsearch/config/elasticsearch.yml
90           - name: elasticsearch-config
91             subPath: jvm.options
92             mountPath: /usr/share/elasticsearch/config/jvm.options
93           - name: elasticsearch-config
94             subPath: log4j2.properties
95             mountPath: /usr/share/elasticsearch/config/log4j2.properties
96           - name: elasticsearch-data
97             mountPath: /usr/share/elasticsearch/data
98         resources:
99 {{ include "common.resources" . | indent 12 }}
100       {{- if .Values.nodeSelector }}
101       nodeSelector:
102 {{ toYaml .Values.nodeSelector | indent 8 }}
103       {{- end -}}
104       {{- if .Values.affinity }}
105       affinity:
106 {{ toYaml .Values.affinity | indent 8 }}
107       {{- end }}
108       volumes:
109       - name: localtime
110         hostPath:
111           path: /etc/localtime
112       - name: elasticsearch-config
113         configMap:
114           name: {{ include "common.fullname" . }}-es-config
115       - name: elasticsearch-data
116         persistentVolumeClaim:
117           claimName: {{ include "common.fullname" . }}-data
118       restartPolicy: {{ .Values.restartPolicy }}
119       imagePullSecrets:
120       - name: "{{ include "common.namespace" . }}-docker-registry-key"