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