Enable Istio sidecar injection
[oom.git] / kubernetes / msb / charts / msb-iag / 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-discovery
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             name: {{ .Values.service.name }}
43           - containerPort: {{ .Values.service.internalPortHttps }}
44             name: {{ .Values.service.name }}-https
45           # disable liveness probe when breakpoints set in debugger
46           # so K8s doesn't restart unresponsive container
47           {{- if eq .Values.liveness.enabled true }}
48           livenessProbe:
49             tcpSocket:
50               port: {{ .Values.service.internalPort }}
51             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
52             periodSeconds: {{ .Values.liveness.periodSeconds }}
53           {{ end -}}
54           readinessProbe:
55             tcpSocket:
56               port: {{ .Values.service.internalPort }}
57             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
58             periodSeconds: {{ .Values.readiness.periodSeconds }}
59           env:
60           - name: CONSUL_IP
61             value: msb-consul.{{ include "common.namespace" . }}
62           - name: SDCLIENT_IP
63             value: msb-discovery.{{ include "common.namespace" . }}
64           - name: ROUTE_LABELS
65             value: {{ .Values.config.routeLabels }}
66           volumeMounts:
67           - mountPath: /etc/localtime
68             name: localtime
69             readOnly: true
70           - mountPath: /usr/local/apiroute-works/logs
71             name: msb-discovery-logs
72           resources:
73 {{ toYaml .Values.resources | indent 12 }}
74         {{- if .Values.nodeSelector }}
75         nodeSelector:
76 {{ toYaml .Values.nodeSelector | indent 10 }}
77         {{- end -}}
78         {{- if .Values.affinity }}
79         affinity:
80 {{ toYaml .Values.affinity | indent 10 }}
81         {{- end }}
82         # side car containers
83         - name: filebeat-onap
84           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
85           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
86           volumeMounts:
87           - mountPath: /var/log/onap
88             name: msb-discovery-logs
89           - mountPath: /usr/share/filebeat/data
90             name: msb-discovery-filebeat
91       volumes:
92         - name: localtime
93           hostPath:
94             path: /etc/localtime
95         - name: msb-discovery-logs
96           emptyDir: {}
97         - name: msb-discovery-filebeat
98           emptyDir: {}
99       imagePullSecrets:
100       - name: "{{ include "common.namespace" . }}-docker-registry-key"