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