blob: 785693a9ba70519965f83e7f329636d2db5153b6 [file] [log] [blame]
toshrajbhardwajf4fc1c62018-08-06 07:35:14 +00001# 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
kj9bf27312018-03-19 15:07:44 +020015apiVersion: extensions/v1beta1
16kind: Deployment
17metadata:
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: {{ .Release.Name }}
24 heritage: {{ .Release.Service }}
25spec:
26 replicas: {{ .Values.replicaCount }}
27 selector:
28 matchLabels:
29 app: {{ include "common.name" . }}
30 template:
31 metadata:
32 labels:
33 app: {{ include "common.name" . }}
Arul.Nambib8c668f2018-07-17 16:02:30 -040034 release: {{ .Release.Name }}
kj9bf27312018-03-19 15:07:44 +020035 name: {{ include "common.name" . }}
36 spec:
Edwin Lawrancea1dd5872019-03-05 10:30:33 +000037 hostname: {{ include "common.name" . }}
kj9bf27312018-03-19 15:07:44 +020038 initContainers:
39 - command:
40 - /bin/sh
41 - -c
42 - |
Julien Barbot5a5321f2018-10-23 09:54:45 +020043 sysctl -w vm.max_map_count=262144
Edwin Lawrance0d4b4b52018-08-02 15:57:13 +010044 mkdir -p /logroot/elasticsearch/logs
45 mkdir -p /logroot/elasticsearch/data
46 chmod -R 777 /logroot/elasticsearch
47 chown -R 1000:1000 /logroot
kj9bf27312018-03-19 15:07:44 +020048 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 }}
Edwin Lawrancea1dd5872019-03-05 10:30:33 +000057 imagePullPolicy: {{ .Values.pullPolicy | default .Values.global.pullPolicy }}
kj9bf27312018-03-19 15:07:44 +020058 name: init-sysctl
59 volumeMounts:
60 - name: elasticsearch-data
61 mountPath: /logroot/
kj9bf27312018-03-19 15:07:44 +020062 containers:
63 - name: {{ include "common.name" . }}
Edwin Lawrancea1dd5872019-03-05 10:30:33 +000064 image: "{{ include "common.repository" . }}/{{ .Values.image }}"
65 imagePullPolicy: {{ .Values.pullPolicy | default .Values.global.pullPolicy }}
kj9bf27312018-03-19 15:07:44 +020066 ports:
67 - containerPort: {{ .Values.service.internalPort }}
Edwin Lawrancea1dd5872019-03-05 10:30:33 +000068 - containerPort: {{ .Values.service.internalPort2 }}
kj9bf27312018-03-19 15:07:44 +020069 # 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
Edwin Lawrance0d4b4b52018-08-02 15:57:13 +010090 - 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
Edwin Lawrancea1dd5872019-03-05 10:30:33 +000096 - name: searchguard-scripts
97 subPath: run.sh
98 mountPath: /usr/share/elasticsearch/bin/run.sh
99 - name: searchguard-scripts
100 subPath: wait_until_started.sh
101 mountPath: /usr/share/elasticsearch/bin/wait_until_started.sh
102 - name: searchguard-scripts
103 subPath: init_sg.sh
104 mountPath: /usr/share/elasticsearch/bin/init_sg.sh
105 - name: searchguard-config
106 mountPath: /usr/share/elasticsearch/config/sg
107 - name: searchguard-auth-config
108 mountPath: /usr/share/elasticsearch/config/sg/auth
kj9bf27312018-03-19 15:07:44 +0200109 - name: elasticsearch-data
110 mountPath: /usr/share/elasticsearch/data
111 resources:
Edwin Lawrancea1dd5872019-03-05 10:30:33 +0000112{{ include "common.resources" . | indent 12 }}
kj9bf27312018-03-19 15:07:44 +0200113 {{- if .Values.nodeSelector }}
114 nodeSelector:
115{{ toYaml .Values.nodeSelector | indent 8 }}
116 {{- end -}}
117 {{- if .Values.affinity }}
118 affinity:
119{{ toYaml .Values.affinity | indent 8 }}
120 {{- end }}
121
122 volumes:
123 - name: localtime
124 hostPath:
125 path: /etc/localtime
126 - name: elasticsearch-config
127 configMap:
Edwin Lawrancea1dd5872019-03-05 10:30:33 +0000128 name: {{ include "common.fullname" . }}-es-config
129 - name: searchguard-scripts
130 configMap:
131 name: {{ include "common.fullname" . }}-sg-scripts
132 defaultMode: 0754
133 - name: searchguard-config
134 configMap:
135 name: {{ include "common.fullname" . }}-sg-config
136 - name: searchguard-auth-config
137 secret:
138 secretName: {{ include "common.fullname" . }}-sg-auth
kj9bf27312018-03-19 15:07:44 +0200139 - name: elasticsearch-data
140 hostPath:
BorislavG56857c42018-05-03 14:29:51 +0000141 path: {{ .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountSubPath }}
Edwin Lawrancea1dd5872019-03-05 10:30:33 +0000142 restartPolicy: {{ .Values.restartPolicy }}
kj9bf27312018-03-19 15:07:44 +0200143 imagePullSecrets:
144 - name: "{{ include "common.namespace" . }}-docker-registry-key"