Merge "clamphealth check"
[oom.git] / kubernetes / aai / charts / aai-elasticsearch / templates / deployment.yaml
1 apiVersion: extensions/v1beta1
2 kind: Deployment
3 metadata:
4   name: {{ include "common.fullname" . }}
5   namespace: {{ include "common.namespace" . }}
6   labels:
7     app: {{ include "common.name" . }}
8     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
9     release: {{ .Release.Name }}
10     heritage: {{ .Release.Service }}
11 spec:
12   replicas: {{ .Values.replicaCount }}
13   selector:
14     matchLabels:
15       app: {{ include "common.name" . }}
16   template:
17     metadata:
18       labels:
19         app: {{ include "common.name" . }}
20       name: {{ include "common.name" . }}
21     spec:
22       initContainers:
23       - command:
24         - /bin/sh
25         - -c
26         - |
27           mkdir -p /logroot/elasticsearch/es-data
28           chmod -R 777 /logroot/elasticsearch/es-data
29           chown -R root:root /logroot
30         env:
31         - name: NAMESPACE
32           valueFrom:
33             fieldRef:
34               apiVersion: v1
35               fieldPath: metadata.namespace
36         securityContext:
37           privileged: true
38         image: {{ .Values.global.dockerhubRepository | default .Values.dockerhubRepository }}/{{ .Values.global.busyboxImage | default .Values.busyboxImage }}
39         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
40         name: init-sysctl
41         volumeMounts:
42         - name: elasticsearch-data
43           mountPath: /logroot/
44       hostname: {{ include "common.name" . }}
45       containers:
46       - name: {{ include "common.name" . }}
47         image: {{ .Values.global.dockerhubRepository | default .Values.dockerhubRepository }}/{{ .Values.image }}
48         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
49         ports:
50         - containerPort: {{ .Values.service.internalPort }}
51         # disable liveness probe when breakpoints set in debugger
52         # so K8s doesn't restart unresponsive container
53         {{- if eq .Values.liveness.enabled true }}
54         livenessProbe:
55           tcpSocket:
56             port: {{ .Values.service.internalPort }}
57           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
58           periodSeconds: {{ .Values.liveness.periodSeconds }}
59         {{ end -}}
60         readinessProbe:
61           tcpSocket:
62             port: {{ .Values.service.internalPort }}
63           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
64           periodSeconds: {{ .Values.readiness.periodSeconds }}
65         volumeMounts:
66           - name: localtime
67             mountPath: /etc/localtime
68             readOnly: true
69           - name: elasticsearch-config
70             subPath: elasticsearch.yml
71             mountPath: /usr/share/elasticsearch/config/elasticsearch.yml
72           - name: elasticsearch-data
73             mountPath: /usr/share/elasticsearch/data
74         resources:
75 {{ toYaml .Values.resources | indent 10 }}
76       {{- if .Values.nodeSelector }}
77       nodeSelector:
78 {{ toYaml .Values.nodeSelector | indent 8 }}
79       {{- end -}}
80       {{- if .Values.affinity }}
81       affinity:
82 {{ toYaml .Values.affinity | indent 8 }}
83       {{- end }}
84
85       volumes:
86       - name: localtime
87         hostPath:
88           path: /etc/localtime
89       - name: elasticsearch-config
90         configMap:
91           name: {{ include "common.fullname" . }}
92       - name: elasticsearch-data
93         hostPath:
94           path: {{ .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountSubPath }}
95       imagePullSecrets:
96       - name: "{{ include "common.namespace" . }}-docker-registry-key"