Merge "[AAI] Uses new tpls for repos / images"
[oom.git] / kubernetes / aai / components / aai-schema-service / templates / deployment.yaml
1 # Copyright © 2017 Amdocs, Bell Canada
2 # Modifications Copyright © 2018 AT&T
3 # Modifications Copyright © 2020 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   replicas: {{ .Values.replicaCount }}
29   selector:
30     matchLabels:
31       app: {{ include "common.name" . }}
32   template:
33     metadata:
34       labels:
35         app: {{ include "common.name" . }}
36         release: {{ include "common.release" . }}
37       name: {{ include "common.name" . }}
38       annotations:
39         checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
40     spec:
41       containers:
42       - name: {{ include "common.name" . }}
43         image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
44         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
45         env:
46         - name: LOCAL_USER_ID
47           value: {{ .Values.global.config.userId | quote }}
48         - name: LOCAL_GROUP_ID
49           value: {{ .Values.global.config.groupId | quote }}
50         volumeMounts:
51         - mountPath: /etc/localtime
52           name: localtime
53           readOnly: true
54         - mountPath: /opt/app/aai-schema-service/resources/etc/appprops/aaiconfig.properties
55           name: aaiconfig-conf
56           subPath: aaiconfig.properties
57         - mountPath: /opt/aai/logroot/AAI-SS
58           name: {{ include "common.fullname" . }}-logs
59         - mountPath: /opt/app/aai-schema-service/resources/logback.xml
60           name: {{ include "common.fullname" . }}-log-conf
61           subPath: logback.xml
62         - mountPath: /opt/app/aai-schema-service/resources/localhost-access-logback.xml
63           name: localhost-access-log-conf
64           subPath: localhost-access-logback.xml
65         - mountPath: /opt/app/aai-schema-service/resources/etc/auth/realm.properties
66           name: realm-conf
67           subPath: realm.properties
68         - mountPath: /opt/app/aai-schema-service/resources/application.properties
69           name: springapp-conf
70           subPath: application.properties
71           {{ $global := . }}
72           {{ range $job := .Values.global.config.auth.files }}
73         - mountPath: /opt/app/aai-schema-service/resources/etc/auth/{{ . }}
74           name: auth-truststore-sec
75           subPath: {{ . }}
76           {{ end }}
77         ports:
78         - containerPort: {{ .Values.service.internalPort }}
79         - containerPort: {{ .Values.service.internalPort2 }}
80         # disable liveness probe when breakpoints set in debugger
81         # so K8s doesn't restart unresponsive container
82         {{ if .Values.liveness.enabled }}
83         livenessProbe:
84           tcpSocket:
85             port: {{ .Values.service.internalPort }}
86           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
87           periodSeconds: {{ .Values.liveness.periodSeconds }}
88         {{ end }}
89         readinessProbe:
90           tcpSocket:
91             port: {{ .Values.service.internalPort }}
92           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
93           periodSeconds: {{ .Values.readiness.periodSeconds }}
94         resources:
95 {{ include "common.resources" . | indent 12 }}
96       {{- if .Values.nodeSelector }}
97       nodeSelector:
98 {{ toYaml .Values.nodeSelector | indent 8 }}
99       {{- end -}}
100       {{- if .Values.affinity }}
101       affinity:
102 {{ toYaml .Values.affinity | indent 8 }}
103       {{- end }}
104
105       # side car containers
106       - name: filebeat-onap
107         image: {{ include "repositoryGenerator.image.logging" . }}
108         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
109         volumeMounts:
110         - mountPath: /usr/share/filebeat/filebeat.yml
111           subPath: filebeat.yml
112           name: filebeat-conf
113         - mountPath: /var/log/onap
114           name: {{ include "common.fullname" . }}-logs
115         - mountPath: /usr/share/filebeat/data
116           name: {{ include "common.fullname" . }}-filebeat
117       volumes:
118       - name: aai-common-aai-auth-mount
119         secret:
120           secretName: aai-common-aai-auth
121       - name: localtime
122         hostPath:
123           path: /etc/localtime
124       - name: filebeat-conf
125         configMap:
126           name: aai-filebeat
127       - name: {{ include "common.fullname" . }}-logs
128         emptyDir: {}
129       - name: {{ include "common.fullname" . }}-filebeat
130         emptyDir: {}
131       - name: {{ include "common.fullname" . }}-log-conf
132         configMap:
133           name: {{ include "common.fullname" . }}-log
134       - name: localhost-access-log-conf
135         configMap:
136           name: {{ include "common.fullname" . }}-localhost-access-log-configmap
137       - name: springapp-conf
138         configMap:
139           name: {{ include "common.fullname" . }}-springapp-configmap
140       - name: aaiconfig-conf
141         configMap:
142           name: {{ include "common.fullname" . }}-aaiconfig-configmap
143       - name: realm-conf
144         configMap:
145           name: {{ include "common.fullname" . }}-realm-configmap
146       - name: auth-truststore-sec
147         secret:
148           secretName: aai-common-truststore
149           items:
150             {{ range $job := .Values.global.config.auth.files }}
151             - key: {{ . }}
152               path: {{ . }}
153             {{ end }}
154       restartPolicy: {{ .Values.restartPolicy }}
155       imagePullSecrets:
156       - name: "{{ include "common.namespace" . }}-docker-registry-key"