Merge "Container restart loop"
[oom.git] / kubernetes / msb / charts / msb-discovery / 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       annotations:
19         sidecar.istio.io/inject: "{{.Values.istioSidecar}}"
20     spec:
21       initContainers:
22       - command:
23         - /root/ready.py
24         args:
25         - --container-name
26         - msb-consul
27         env:
28         - name: NAMESPACE
29           valueFrom:
30             fieldRef:
31               apiVersion: v1
32               fieldPath: metadata.namespace
33         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
34         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
35         name: {{ include "common.name" . }}-readiness
36       containers:
37         - name: {{ include "common.name" . }}
38           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
39           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
40           ports:
41           - containerPort: {{ .Values.service.internalPort }}
42           # disable liveness probe when breakpoints set in debugger
43           # so K8s doesn't restart unresponsive container
44           {{- if eq .Values.liveness.enabled true }}
45           livenessProbe:
46             tcpSocket:
47               port: {{ .Values.service.internalPort }}
48             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
49             periodSeconds: {{ .Values.liveness.periodSeconds }}
50           {{ end -}}
51           readinessProbe:
52             tcpSocket:
53               port: {{ .Values.service.internalPort }}
54             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
55             periodSeconds: {{ .Values.readiness.periodSeconds }}
56           env:
57           - name: CONSUL_IP
58             value: msb-consul.{{ include "common.namespace" . }}
59           volumeMounts:
60           - mountPath: /etc/localtime
61             name: localtime
62             readOnly: true
63           - mountPath: /usr/local/discover-works/logs
64             name: {{ include "common.fullname" . }}-logs
65           resources:
66 {{ toYaml .Values.resources | indent 12 }}
67         {{- if .Values.nodeSelector }}
68         nodeSelector:
69 {{ toYaml .Values.nodeSelector | indent 10 }}
70         {{- end -}}
71         {{- if .Values.affinity }}
72         affinity:
73 {{ toYaml .Values.affinity | indent 10 }}
74         {{- end }}
75
76         # Filebeat sidecar container
77         - name: {{ include "common.name" . }}-filebeat-onap
78           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
79           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
80           volumeMounts:
81           - name: {{ include "common.fullname" . }}-filebeat-conf
82             mountPath: /usr/share/filebeat/filebeat.yml
83             subPath: filebeat.yml
84           - name: {{ include "common.fullname" . }}-data-filebeat
85             mountPath: /usr/share/filebeat/data
86           - name: {{ include "common.fullname" . }}-logs
87             mountPath: /var/log/onap/msb/msb-discovery
88           - mountPath: /opt/ajsc/etc/config/logback.xml
89             name: {{ include "common.fullname" . }}-log-conf
90             subPath: logback.xml
91       volumes:
92         - name: {{ include "common.fullname" . }}-log-conf
93           configMap:
94             name: {{ include "common.fullname" . }}-log
95         - name: {{ include "common.fullname" . }}-filebeat-conf
96           configMap:
97             name: {{ .Release.Name }}-msb-filebeat-configmap
98         - name: {{ include "common.fullname" . }}-data-filebeat
99           emptyDir: {}
100         - name:  {{ include "common.fullname" . }}-logs
101           emptyDir: {}
102         - name: localtime
103           hostPath:
104             path: /etc/localtime
105       imagePullSecrets:
106       - name: "{{ include "common.namespace" . }}-docker-registry-key"