[GENERAL] Use readiness container v3.0.1
[oom.git] / kubernetes / msb / charts / msb-iag / templates / deployment.yaml
1 # Copyright © 2018 Amdocs, Bell Canada , ZTE
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #       http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 apiVersion: apps/v1
15 kind: Deployment
16 metadata:
17   name: {{ include "common.fullname" . }}
18   namespace: {{ include "common.namespace" . }}
19   labels:
20     app: {{ include "common.name" . }}
21     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
22     release: {{ include "common.release" . }}
23     heritage: {{ .Release.Service }}
24 spec:
25   selector:
26     matchLabels:
27       app: {{ include "common.name" . }}
28   replicas: {{ .Values.replicaCount }}
29   template:
30     metadata:
31       labels:
32         app: {{ include "common.name" . }}
33         release: {{ include "common.release" . }}
34       annotations:
35         sidecar.istio.io/inject: "{{.Values.istioSidecar}}"
36     spec:
37       serviceAccountName: msb
38       initContainers:
39       - command:
40         - /app/ready.py
41         args:
42         - --container-name
43         - msb-discovery
44         env:
45         - name: NAMESPACE
46           valueFrom:
47             fieldRef:
48               apiVersion: v1
49               fieldPath: metadata.namespace
50         image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
51         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
52         name: {{ include "common.name" . }}-readiness
53       containers:
54         - name: {{ include "common.name" . }}
55           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
56           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
57           ports:
58           - containerPort: {{ .Values.service.internalPort }}
59             name: {{ .Values.service.name }}
60           - containerPort: {{ .Values.service.internalPortHttps }}
61             name: {{ .Values.service.name }}-https
62           # disable liveness probe when breakpoints set in debugger
63           # so K8s doesn't restart unresponsive container
64           {{- if eq .Values.liveness.enabled true }}
65           livenessProbe:
66             tcpSocket:
67               port: {{ .Values.service.internalPort }}
68             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
69             periodSeconds: {{ .Values.liveness.periodSeconds }}
70           {{ end -}}
71           readinessProbe:
72             tcpSocket:
73               port: {{ .Values.service.internalPort }}
74             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
75             periodSeconds: {{ .Values.readiness.periodSeconds }}
76           env:
77           - name: CONSUL_IP
78             value: msb-consul.{{ include "common.namespace" . }}
79           - name: SDCLIENT_IP
80             value: msb-discovery.{{ include "common.namespace" . }}
81           - name: ROUTE_LABELS
82             value: {{ .Values.config.routeLabels }}
83           volumeMounts:
84           - mountPath: /etc/localtime
85             name: localtime
86             readOnly: true
87           - name: {{ include "common.fullname" . }}-cert
88             mountPath: /usr/local/openresty/nginx/ssl/cert/cert.crt
89             readOnly: true
90             subPath: "cert.crt"
91           - name: {{ include "common.fullname" . }}-cert
92             mountPath: /usr/local/openresty/nginx/html/cert/ca.crt
93             readOnly: true
94             subPath: "ca.crt"
95           - mountPath: /usr/local/apiroute-works/logs
96             name: {{ include "common.fullname" . }}-logs
97           resources:
98 {{ include "common.resources" . | indent 12 }}
99         {{- if .Values.nodeSelector }}
100         nodeSelector:
101 {{ toYaml .Values.nodeSelector | indent 10 }}
102         {{- end -}}
103         {{- if .Values.affinity }}
104         affinity:
105 {{ toYaml .Values.affinity | indent 10 }}
106         {{- end }}
107         # side car containers
108         - name: filebeat-onap
109           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
110           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
111           volumeMounts:
112           - name: {{ include "common.fullname" . }}-filebeat-conf
113             mountPath: /usr/share/filebeat/filebeat.yml
114             subPath: filebeat.yml
115           - name: {{ include "common.fullname" . }}-data-filebeat
116             mountPath: /usr/share/filebeat/data
117           - name: {{ include "common.fullname" . }}-logs
118             mountPath: /var/log/onap/msb/msb-iag
119           - mountPath: /opt/ajsc/etc/config/logback.xml
120             name: {{ include "common.fullname" . }}-log-conf
121             subPath: logback.xml
122       volumes:
123         - name: {{ include "common.fullname" . }}-cert
124           secret:
125             secretName: {{ include "common.release" . }}-msb-https-cert
126         - name: {{ include "common.fullname" . }}-log-conf
127           configMap:
128             name: {{ include "common.fullname" . }}-log
129         - name: {{ include "common.fullname" . }}-filebeat-conf
130           configMap:
131             name: {{ include "common.release" . }}-msb-filebeat-configmap
132         - name: {{ include "common.fullname" . }}-data-filebeat
133           emptyDir: {}
134         - name:  {{ include "common.fullname" . }}-logs
135           emptyDir: {}
136         - name: localtime
137           hostPath:
138             path: /etc/localtime
139       imagePullSecrets:
140       - name: "{{ include "common.namespace" . }}-docker-registry-key"