Enable Istio sidecar injection
[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: msb-discovery-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         # side car containers
77         - name: filebeat-onap
78           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
79           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
80           volumeMounts:
81           - mountPath: /var/log/onap
82             name: msb-discovery-logs
83           - mountPath: /usr/share/filebeat/data
84             name: msb-discovery-filebeat
85       volumes:
86         - name: localtime
87           hostPath:
88             path: /etc/localtime
89         - name: msb-discovery-logs
90           emptyDir: {}
91         - name: msb-discovery-filebeat
92           emptyDir: {}
93       imagePullSecrets:
94       - name: "{{ include "common.namespace" . }}-docker-registry-key"