Jakub Latusek | 2bd138d | 2020-10-21 13:36:29 +0200 | [diff] [blame] | 1 | {{/* |
Geora Barsky | a3f067c | 2018-07-19 16:46:37 -0400 | [diff] [blame] | 2 | # Copyright © 2017 Amdocs, Bell Canada |
| 3 | # |
| 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. |
Jakub Latusek | 2bd138d | 2020-10-21 13:36:29 +0200 | [diff] [blame] | 15 | */}} |
Geora Barsky | a3f067c | 2018-07-19 16:46:37 -0400 | [diff] [blame] | 16 | |
| 17 | apiVersion: extensions/v1beta1 |
| 18 | kind: Deployment |
| 19 | metadata: |
| 20 | name: {{ include "common.fullname" . }} |
| 21 | namespace: {{ include "common.namespace" . }} |
| 22 | labels: |
| 23 | app: {{ include "common.name" . }} |
| 24 | chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 25 | release: {{ include "common.release" . }} |
Geora Barsky | a3f067c | 2018-07-19 16:46:37 -0400 | [diff] [blame] | 26 | heritage: {{ .Release.Service }} |
| 27 | spec: |
| 28 | replicas: {{ .Values.replicaCount }} |
| 29 | template: |
| 30 | metadata: |
| 31 | labels: |
| 32 | app: {{ include "common.name" . }} |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 33 | release: {{ include "common.release" . }} |
Geora Barsky | a3f067c | 2018-07-19 16:46:37 -0400 | [diff] [blame] | 34 | spec: |
| 35 | initContainers: |
| 36 | - command: |
| 37 | - /bin/sh |
| 38 | - -c |
| 39 | - | |
| 40 | sysctl -w vm.max_map_count=262144 |
| 41 | mkdir -p /logroot/elasticsearch/logs |
| 42 | mkdir -p /logroot/elasticsearch/data |
| 43 | chmod -R 777 /logroot/elasticsearch |
| 44 | chown -R root:root /logroot |
| 45 | env: |
| 46 | - name: NAMESPACE |
| 47 | valueFrom: |
| 48 | fieldRef: |
| 49 | apiVersion: v1 |
| 50 | fieldPath: metadata.namespace |
| 51 | securityContext: |
| 52 | privileged: true |
Sylvain Desbureaux | 93ed075 | 2020-11-21 21:22:18 +0100 | [diff] [blame] | 53 | image: {{ include "repositoryGenerator.image.busybox" . }} |
Geora Barsky | a3f067c | 2018-07-19 16:46:37 -0400 | [diff] [blame] | 54 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 55 | name: init-sysctl |
| 56 | volumeMounts: |
| 57 | - name: {{ include "common.fullname" . }}-logs |
| 58 | mountPath: /logroot/ |
| 59 | containers: |
| 60 | - name: {{ include "common.name" . }} |
Sylvain Desbureaux | 93ed075 | 2020-11-21 21:22:18 +0100 | [diff] [blame] | 61 | image: {{ include "repositoryGenerator.elasticRepository" . }}/{{ .Values.image }} |
Geora Barsky | a3f067c | 2018-07-19 16:46:37 -0400 | [diff] [blame] | 62 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 63 | ports: |
| 64 | - containerPort: {{ .Values.service.internalPort }} |
| 65 | name: {{ .Values.service.name }} |
| 66 | - containerPort: {{ .Values.service.internalPort2 }} |
| 67 | name: {{ .Values.service.name2 }} |
| 68 | # disable liveness probe when breakpoints set in debugger |
| 69 | # so K8s doesn't restart unresponsive container |
| 70 | {{- if eq .Values.liveness.enabled true }} |
| 71 | livenessProbe: |
| 72 | tcpSocket: |
| 73 | port: {{ .Values.service.internalPort }} |
| 74 | initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} |
| 75 | periodSeconds: {{ .Values.liveness.periodSeconds }} |
| 76 | {{ end -}} |
| 77 | readinessProbe: |
| 78 | tcpSocket: |
| 79 | port: {{ .Values.service.internalPort2 }} |
| 80 | initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} |
| 81 | periodSeconds: {{ .Values.readiness.periodSeconds }} |
| 82 | env: |
| 83 | volumeMounts: |
| 84 | - mountPath: /etc/localtime |
| 85 | name: localtime |
| 86 | readOnly: true |
| 87 | - mountPath: /usr/share/elasticsearch/config/elasticsearch.yml |
| 88 | name: {{ include "common.fullname" . }}-config |
| 89 | subPath: elasticsearch.yml |
| 90 | - mountPath: /usr/share/elasticsearch/data/ |
| 91 | name: {{ include "common.fullname" . }}-data |
| 92 | resources: |
Mandeep Khinda | 5e3f36a | 2018-09-24 15:25:42 +0000 | [diff] [blame] | 93 | {{ include "common.resources" . | indent 12 }} |
Geora Barsky | a3f067c | 2018-07-19 16:46:37 -0400 | [diff] [blame] | 94 | {{- if .Values.nodeSelector }} |
| 95 | nodeSelector: |
| 96 | {{ toYaml .Values.nodeSelector | indent 10 }} |
| 97 | {{- end -}} |
| 98 | {{- if .Values.affinity }} |
| 99 | affinity: |
| 100 | {{ toYaml .Values.affinity | indent 10 }} |
| 101 | {{- end }} |
| 102 | volumes: |
| 103 | - name: localtime |
| 104 | hostPath: |
| 105 | path: /etc/localtime |
| 106 | - name: {{ include "common.fullname" . }}-config |
| 107 | configMap: |
| 108 | name: {{ include "common.fullname" . }}-configmap |
| 109 | items: |
| 110 | - key: elasticsearch.yml |
| 111 | path: elasticsearch.yml |
| 112 | - name: {{ include "common.fullname" . }}-data |
Sylvain Desbureaux | 9deede9 | 2019-12-09 11:26:40 +0100 | [diff] [blame] | 113 | {{- if .Values.persistence.enabled }} |
Geora Barsky | a3f067c | 2018-07-19 16:46:37 -0400 | [diff] [blame] | 114 | persistentVolumeClaim: |
| 115 | claimName: {{ include "common.fullname" . }} |
Sylvain Desbureaux | 9deede9 | 2019-12-09 11:26:40 +0100 | [diff] [blame] | 116 | {{- else }} |
| 117 | emptyDir: {} |
| 118 | {{- end }} |
Geora Barsky | a3f067c | 2018-07-19 16:46:37 -0400 | [diff] [blame] | 119 | - name: {{ include "common.fullname" . }}-logs |
Sylvain Desbureaux | 9deede9 | 2019-12-09 11:26:40 +0100 | [diff] [blame] | 120 | {{- if .Values.persistence.enabled }} |
| 121 | persistentVolumeClaim: |
| 122 | claimName: {{ include "common.fullname" . }}-logs |
| 123 | {{- else }} |
| 124 | emptyDir: {} |
| 125 | {{- end }} |
Geora Barsky | a3f067c | 2018-07-19 16:46:37 -0400 | [diff] [blame] | 126 | imagePullSecrets: |
| 127 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |