[AAI] Make AAI helm3 compatible
[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       volumes:
120       - name: aai-common-aai-auth-mount
121         secret:
122           secretName: aai-common-aai-auth
123       - name: localtime
124         hostPath:
125           path: /etc/localtime
126       - name: filebeat-conf
127         configMap:
128           name: aai-filebeat
129       - name: {{ include "common.fullname" . }}-logs
130         emptyDir: {}
131       - name: {{ include "common.fullname" . }}-filebeat
132         emptyDir: {}
133       - name: {{ include "common.fullname" . }}-log-conf
134         configMap:
135           name: {{ include "common.fullname" . }}-log
136       - name: localhost-access-log-conf
137         configMap:
138           name: {{ include "common.fullname" . }}-localhost-access-log-configmap
139       - name: springapp-conf
140         configMap:
141           name: {{ include "common.fullname" . }}-springapp-configmap
142       - name: aaiconfig-conf
143         configMap:
144           name: {{ include "common.fullname" . }}-aaiconfig-configmap
145       - name: realm-conf
146         configMap:
147           name: {{ include "common.fullname" . }}-realm-configmap
148       - name: auth-truststore-sec
149         secret:
150           secretName: aai-common-truststore
151           items:
152             {{ range $job := .Values.global.config.auth.files }}
153             - key: {{ . }}
154               path: {{ . }}
155             {{ end }}
156       restartPolicy: {{ .Values.restartPolicy }}
157       imagePullSecrets:
158       - name: "{{ include "common.namespace" . }}-docker-registry-key"