[AAI] Use log template
[oom.git] / kubernetes / aai / components / aai-babel / templates / deployment.yaml
1 {{/*
2 # Copyright © 2018 Amdocs, AT&T
3 # Modifications Copyright © 2018 Bell Canada
4 # Modifications Copyright © 2020,2021 Orange
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 #       http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 */}}
18
19 apiVersion: apps/v1
20 kind: Deployment
21 metadata:
22   name: {{ include "common.fullname" . }}
23   namespace: {{ include "common.namespace" . }}
24   labels:
25     app: {{ include "common.name" . }}
26     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
27     release: {{ include "common.release" . }}
28     heritage: {{ .Release.Service }}
29 spec:
30   selector:
31     matchLabels:
32       app: {{ include "common.name" . }}
33   replicas: {{ .Values.replicaCount }}
34   template:
35     metadata:
36       labels:
37         app: {{ include "common.name" . }}
38         release: {{ include "common.release" . }}
39     spec:
40       containers:
41         - name: {{ include "common.name" . }}
42           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
43           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
44           ports:
45           - containerPort: {{ .Values.service.internalPort }}
46           # disable liveness probe when breakpoints set in debugger
47           # so K8s doesn't restart unresponsive container
48           {{ if .Values.liveness.enabled }}
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: CONFIG_HOME
62               value: /opt/app/babel/config
63             - name: KEY_STORE_PASSWORD
64               valueFrom:
65                 secretKeyRef:
66                   name: {{ template "common.fullname" . }}-pass
67                   key: KEY_STORE_PASSWORD
68             - name: KEY_MANAGER_PASSWORD
69               valueFrom:
70                 secretKeyRef:
71                   name: {{ template "common.fullname" . }}-pass
72                   key: KEY_MANAGER_PASSWORD
73           volumeMounts:
74           - mountPath: /etc/localtime
75             name: localtime
76             readOnly: true
77           - mountPath: /opt/app/babel/config/artifact-generator.properties
78             name: {{ include "common.fullname" . }}-config
79             subPath: artifact-generator.properties
80           - mountPath: /opt/app/babel/config/tosca-mappings.json
81             name: {{ include "common.fullname" . }}-config
82             subPath: tosca-mappings.json
83           - mountPath: /opt/app/babel/config/babel-auth.properties
84             name: {{ include "common.fullname" . }}-config
85             subPath: babel-auth.properties
86           - mountPath: /opt/app/babel/config/auth
87             name: {{ include "common.fullname" . }}-secrets
88           - mountPath: {{ .Values.log.path }}
89             name: logs
90           - mountPath: /opt/app/babel/config/logback.xml
91             name: {{ include "common.fullname" . }}-config
92             subPath: logback.xml
93           resources:
94 {{ include "common.resources" . }}
95       {{- if .Values.nodeSelector }}
96       nodeSelector:
97 {{ toYaml .Values.nodeSelector | indent 8 }}
98       {{- end -}}
99       {{- if .Values.affinity }}
100       affinity:
101 {{ toYaml .Values.affinity | indent 8 }}
102       {{- end }}
103
104         # side car containers
105       {{ include "common.log.sidecar" . | nindent 8 }}
106       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
107       volumes:
108         - name: localtime
109           hostPath:
110             path: /etc/localtime
111         - name: {{ include "common.fullname" . }}-config
112           configMap:
113             name: {{ include "common.fullname" . }}-configmap
114             items:
115             - key: artifact-generator.properties
116               path: artifact-generator.properties
117             - key: tosca-mappings.json
118               path: tosca-mappings.json
119             - key: babel-auth.properties
120               path: babel-auth.properties
121             - key: logback.xml
122               path: logback.xml
123         - name: {{ include "common.fullname" . }}-secrets
124           secret:
125             secretName: {{ include "common.fullname" . }}-babel-secrets
126         - name: logs
127           emptyDir: {}
128         {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 8 }}
129
130       imagePullSecrets:
131       - name: "{{ include "common.namespace" . }}-docker-registry-key"