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