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