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