699dfc310dae870f7543ea88464f239adeefe9a0
[oom.git] / kubernetes / sdc / charts / sdc-es / templates / deployment.yaml
1 # Copyright © 2017 Amdocs, AT&T, 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       - name: {{ include "common.name" . }}-logs-init
35         command:
36         - /bin/bash
37         - "-c"
38         - |
39           mkdir -p /ubuntu-init/ASDC/ASDC-ES/
40           chmod -R 777 /ubuntu-init/
41         image: "{{ .Values.global.ubuntuInitRepository }}/{{ .Values.global.ubuntuInitImage }}"
42         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
43         volumeMounts:
44         - name: {{ include "common.fullname" . }}-logs
45           mountPath: /ubuntu-init/
46       containers:
47         - name: {{ include "common.name" . }}
48           image: "{{ .Values.global.repository | default .Values.repository }}/{{ .Values.image }}"
49           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
50           ports:
51           - containerPort: {{ .Values.service.internalPort }}
52           - containerPort: {{ .Values.service.internalPort2 }}
53           # disable liveness probe when breakpoints set in debugger
54           # so K8s doesn't restart unresponsive container
55           {{- if eq .Values.liveness.enabled true }}
56           livenessProbe:
57             tcpSocket:
58               port: {{ .Values.service.internalPort }}
59             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
60             periodSeconds: {{ .Values.liveness.periodSeconds }}
61           {{ end -}}
62           readinessProbe:
63             httpGet:
64               path: "_cluster/health?wait_for_status=yellow&timeout=120s"
65               port: {{ .Values.service.internalPort }}
66               scheme: HTTP
67             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
68             periodSeconds: {{ .Values.readiness.periodSeconds }}
69           env:
70           - name: ENVNAME
71             value: {{ .Values.global.env.name }}
72           - name: HOST_IP
73             valueFrom:
74               fieldRef:
75                 fieldPath: status.podIP
76           - name: ES_HEAP_SIZE
77             value: {{ .Values.config.JvmHeapSize }}
78           - name: ES_JAVA_OPTS
79             value: {{ .Values.config.JvmOptions }}
80           volumeMounts:
81           - name: {{ include "common.fullname" . }}-environments
82             mountPath: /root/chef-solo/environments/
83           - name: {{ include "common.fullname" . }}-localtime
84             mountPath: /etc/localtime
85             readOnly: true
86           - name: {{ include "common.fullname" . }}-logs
87             mountPath: /var/lib/jetty/logs
88           - name: {{ include "common.fullname" . }}-data
89             mountPath: /usr/share/elasticsearch/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: {{ include "common.fullname" . }}-localtime
102           hostPath:
103             path: /etc/localtime
104       {{- if .Values.persistence.enabled }}
105         - name: {{ include "common.fullname" . }}-data
106           persistentVolumeClaim:
107             claimName: {{ include "common.fullname" . }}
108       {{- else }}
109           emptyDir: {}
110       {{- end }}
111         - name: {{ include "common.fullname" . }}-environments
112           configMap:
113             name: {{ .Release.Name }}-sdc-environments-configmap
114             defaultMode: 0755
115         - name: {{ include "common.fullname" . }}-logs
116           emptyDir: {}
117       imagePullSecrets:
118       - name: "{{ include "common.namespace" . }}-docker-registry-key"