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