Merge "[DCAEMOD] Uses new tpls for repos / images"
[oom.git] / kubernetes / log / components / log-elasticsearch / templates / deployment.yaml
1 {{/*
2 # Copyright © 2017 Amdocs, Bell Canada
3 # Modifications Copyright © 2018 AT&T
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #       http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 */}}
17
18 apiVersion: apps/v1
19 kind: Deployment
20 metadata:
21   name: {{ include "common.fullname" . }}
22   namespace: {{ include "common.namespace" . }}
23   labels:
24     app: {{ include "common.name" . }}
25     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
26     release: {{ include "common.release" . }}
27     heritage: {{ .Release.Service }}
28 spec:
29   replicas: {{ .Values.replicaCount }}
30   template:
31     metadata:
32       labels:
33         app: {{ include "common.name" . }}
34         release: {{ include "common.release" . }}
35     spec:
36       initContainers:
37       - command:
38         - /bin/sh
39         - -c
40         - |
41           sysctl -w vm.max_map_count=262144
42           mkdir -p /logroot/elasticsearch/logs
43           mkdir -p /logroot/elasticsearch/data
44           chmod -R 777 /logroot/elasticsearch
45           chown -R root:root /logroot
46         env:
47         - name: NAMESPACE
48           valueFrom:
49             fieldRef:
50               apiVersion: v1
51               fieldPath: metadata.namespace
52         securityContext:
53           privileged: true
54         image: {{ include "repositoryGenerator.image.busybox" . }}
55         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
56         name: init-sysctl
57         volumeMounts:
58         - name: {{ include "common.fullname" . }}-logs
59           mountPath: /logroot/
60       containers:
61         - name: {{ include "common.name" . }}
62           image: {{ include "repositoryGenerator.elasticRepository" . }}/{{ .Values.image }}
63           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
64           resources:
65 {{ include "common.resources" . | indent 12 }}
66           ports:
67           - containerPort: {{ .Values.service.internalPort }}
68             name: {{ .Values.service.name }}
69           - containerPort: {{ .Values.service.internalPort2 }}
70             name: {{ .Values.service.name2 }}
71 # disable liveness probe when breakpoints set in debugger
72           # so K8s doesn't restart unresponsive container
73           {{- if eq .Values.liveness.enabled true }}
74           livenessProbe:
75             tcpSocket:
76               port: {{ .Values.service.internalPort }}
77             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
78             periodSeconds: {{ .Values.liveness.periodSeconds }}
79           {{ end -}}
80           readinessProbe:
81             tcpSocket:
82               port: {{ .Values.service.internalPort2 }}
83             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
84             periodSeconds: {{ .Values.readiness.periodSeconds }}
85           env:
86           volumeMounts:
87           - mountPath: /etc/localtime
88             name: localtime
89             readOnly: true
90           - mountPath: /usr/share/elasticsearch/config/elasticsearch.yml
91             name: {{ include "common.fullname" . }}-config
92             subPath: elasticsearch.yml
93           - mountPath: /usr/share/elasticsearch/data/
94             name: {{ include "common.fullname" . }}-data
95       volumes:
96         - name: localtime
97           hostPath:
98             path: /etc/localtime
99         - name: {{ include "common.fullname" . }}-config
100           configMap:
101             name: {{ include "common.fullname" . }}-configmap
102             items:
103             - key: elasticsearch.yml
104               path: elasticsearch.yml
105         - name: {{ include "common.fullname" . }}-data
106           persistentVolumeClaim:
107             claimName: {{ include "common.fullname" . }}
108         - name: {{ include "common.fullname" . }}-logs
109           hostPath:
110             path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ include "common.release" . }}/{{ .Values.persistence.mountSubPathLogs }}
111       imagePullSecrets:
112       - name: "{{ include "common.namespace" . }}-docker-registry-key"