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