[AAI] Reintegrate AAI OOM charts in main repo
[oom.git] / kubernetes / aai / components / aai-schema-service / templates / deployment.yaml
1 # Copyright © 2017 Amdocs, Bell Canada
2 # Modifications Copyright © 2018 AT&T
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #       http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 apiVersion: apps/v1
17 kind: Deployment
18 metadata:
19   name: {{ include "common.fullname" . }}
20   namespace: {{ include "common.namespace" . }}
21   labels:
22     app: {{ include "common.name" . }}
23     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
24     release: {{ include "common.release" . }}
25     heritage: {{ .Release.Service }}
26 spec:
27   replicas: {{ .Values.replicaCount }}
28   selector:
29     matchLabels:
30       app: {{ include "common.name" . }}
31   template:
32     metadata:
33       labels:
34         app: {{ include "common.name" . }}
35         release: {{ include "common.release" . }}
36       name: {{ include "common.name" . }}
37       annotations:
38         checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
39     spec:
40       containers:
41       - name: {{ include "common.name" . }}
42         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
43         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
44         env:
45         - name: LOCAL_USER_ID
46           value: {{ .Values.global.config.userId | quote }}
47         - name: LOCAL_GROUP_ID
48           value: {{ .Values.global.config.groupId | quote }}
49         volumeMounts:
50         - mountPath: /etc/localtime
51           name: localtime
52           readOnly: true
53         - mountPath: /opt/app/aai-schema-service/resources/etc/appprops/aaiconfig.properties
54           name: aaiconfig-conf
55           subPath: aaiconfig.properties
56         - mountPath: /opt/aai/logroot/AAI-SS
57           name: {{ include "common.fullname" . }}-logs
58         - mountPath: /opt/app/aai-schema-service/resources/logback.xml
59           name: {{ include "common.fullname" . }}-log-conf
60           subPath: logback.xml
61         - mountPath: /opt/app/aai-schema-service/resources/localhost-access-logback.xml
62           name: localhost-access-log-conf
63           subPath: localhost-access-logback.xml
64         - mountPath: /opt/app/aai-schema-service/resources/etc/auth/realm.properties
65           name: realm-conf
66           subPath: realm.properties
67         - mountPath: /opt/app/aai-schema-service/resources/application.properties
68           name: springapp-conf
69           subPath: application.properties
70           {{ $global := . }}
71           {{ range $job := .Values.global.config.auth.files }}
72         - mountPath: /opt/app/aai-schema-service/resources/etc/auth/{{ . }}
73           name: auth-truststore-sec
74           subPath: {{ . }}
75           {{ end }}
76         ports:
77         - containerPort: {{ .Values.service.internalPort }}
78         - containerPort: {{ .Values.service.internalPort2 }}
79         # disable liveness probe when breakpoints set in debugger
80         # so K8s doesn't restart unresponsive container
81         {{ if .Values.liveness.enabled }}
82         livenessProbe:
83           tcpSocket:
84             port: {{ .Values.service.internalPort }}
85           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
86           periodSeconds: {{ .Values.liveness.periodSeconds }}
87         {{ end }}
88         readinessProbe:
89           tcpSocket:
90             port: {{ .Values.service.internalPort }}
91           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
92           periodSeconds: {{ .Values.readiness.periodSeconds }}
93         resources:
94 {{ include "common.resources" . | indent 12 }}
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       - name: filebeat-onap
106         image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
107         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
108         volumeMounts:
109         - mountPath: /usr/share/filebeat/filebeat.yml
110           subPath: filebeat.yml
111           name: filebeat-conf
112         - mountPath: /var/log/onap
113           name: {{ include "common.fullname" . }}-logs
114         - mountPath: /usr/share/filebeat/data
115           name: {{ include "common.fullname" . }}-filebeat
116       volumes:
117       - name: aai-common-aai-auth-mount
118         secret:
119           secretName: aai-common-aai-auth
120       - name: localtime
121         hostPath:
122           path: /etc/localtime
123       - name: filebeat-conf
124         configMap:
125           name: aai-filebeat
126       - name: {{ include "common.fullname" . }}-logs
127         emptyDir: {}
128       - name: {{ include "common.fullname" . }}-filebeat
129         emptyDir: {}
130       - name: {{ include "common.fullname" . }}-log-conf
131         configMap:
132          name: {{ include "common.fullname" . }}-log
133       - name: localhost-access-log-conf
134         configMap:
135          name: {{ include "common.fullname" . }}-localhost-access-log-configmap
136       - name: springapp-conf
137         configMap:
138          name: {{ include "common.fullname" . }}-springapp-configmap
139       - name: aaiconfig-conf
140         configMap:
141          name: {{ include "common.fullname" . }}-aaiconfig-configmap
142       - name: realm-conf
143         configMap:
144          name: {{ include "common.fullname" . }}-realm-configmap
145       - name: auth-truststore-sec
146         secret:
147          secretName: aai-common-truststore
148          items:
149           {{ range $job := .Values.global.config.auth.files }}
150            - key: {{ . }}
151              path: {{ . }}
152           {{ end }}
153       restartPolicy: {{ .Values.restartPolicy }}
154       imagePullSecrets:
155       - name: "{{ include "common.namespace" . }}-docker-registry-key"