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