External dependencies config
[oom.git] / kubernetes / sdc / charts / sdc-es / templates / deployment.yaml
1 apiVersion: extensions/v1beta1
2 kind: Deployment
3 metadata:
4   name: {{ include "common.fullname" . }}
5   namespace: {{ include "common.namespace" . }}
6   labels:
7     app: {{ include "common.name" . }}
8     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
9     release: {{ .Release.Name }}
10     heritage: {{ .Release.Service }}
11 spec:
12   replicas: {{ .Values.replicaCount }}
13   template:
14     metadata:
15       labels:
16         app: {{ include "common.name" . }}
17         release: {{ .Release.Name }}
18     spec:
19       initContainers:
20       - name: {{ include "common.name" . }}-logs-init
21         command:
22         - /bin/bash
23         - "-c"
24         - |
25           mkdir -p /ubuntu-init/ASDC/ASDC-ES/
26           chmod -R 777 /ubuntu-init/
27         image: "{{ .Values.global.ubuntuInitRepository }}/{{ .Values.global.ubuntuInitImage }}"
28         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
29         volumeMounts:
30         - name: {{ include "common.fullname" . }}-logs
31           mountPath: /ubuntu-init/
32       containers:
33         - name: {{ include "common.name" . }}
34           image: "{{ .Values.global.repository | default .Values.repository }}/{{ .Values.image }}"
35           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
36           ports:
37           - containerPort: {{ .Values.service.internalPort }}
38           - containerPort: {{ .Values.service.internalPort2 }}
39           # disable liveness probe when breakpoints set in debugger
40           # so K8s doesn't restart unresponsive container
41           {{- if eq .Values.liveness.enabled true }}
42           livenessProbe:
43             tcpSocket:
44               port: {{ .Values.service.internalPort }}
45             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
46             periodSeconds: {{ .Values.liveness.periodSeconds }}
47           {{ end -}}
48           readinessProbe:
49             httpGet:
50               path: "_cluster/health?wait_for_status=yellow&timeout=120s"
51               port: {{ .Values.service.internalPort }}
52               scheme: HTTP
53             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
54             periodSeconds: {{ .Values.readiness.periodSeconds }}
55           env:
56           - name: ENVNAME
57             value: {{ .Values.global.env.name }}
58           - name: HOST_IP
59             valueFrom:
60               fieldRef:
61                 fieldPath: status.podIP
62           - name: ES_HEAP_SIZE
63             value: {{ .Values.config.elasticHeapSize }}
64           volumeMounts:
65           - name: {{ include "common.fullname" . }}-environments
66             mountPath: /root/chef-solo/environments/
67           - name: {{ include "common.fullname" . }}-localtime
68             mountPath: /etc/localtime
69             readOnly: true
70           - name: {{ include "common.fullname" . }}-logs
71             mountPath: /var/lib/jetty/logs
72           - name: {{ include "common.fullname" . }}-data
73             mountPath: /usr/share/elasticsearch/data/
74           resources:
75 {{ toYaml .Values.resources | indent 12 }}
76         {{- if .Values.nodeSelector }}
77         nodeSelector:
78 {{ toYaml .Values.nodeSelector | indent 10 }}
79         {{- end -}}
80         {{- if .Values.affinity }}
81         affinity:
82 {{ toYaml .Values.affinity | indent 10 }}
83         {{- end }}
84       volumes:
85         - name: {{ include "common.fullname" . }}-localtime
86           hostPath:
87             path: /etc/localtime
88       {{- if .Values.persistence.enabled }}
89         - name: {{ include "common.fullname" . }}-data
90           persistentVolumeClaim:
91             claimName: {{ include "common.fullname" . }}
92       {{- else }}
93           emptyDir: {}
94       {{- end }}
95         - name: {{ include "common.fullname" . }}-environments
96           configMap:
97             name: {{ .Release.Name }}-sdc-environments-configmap
98             defaultMode: 0755
99         - name: {{ include "common.fullname" . }}-logs
100           emptyDir: {}
101       imagePullSecrets:
102       - name: "{{ include "common.namespace" . }}-docker-registry-key"