[AAI] Reintegrate AAI OOM charts in main repo
[oom.git] / kubernetes / aai / components / aai-graphadmin / templates / deployment.yaml
1 #
2 # ============LICENSE_START=======================================================
3 # org.onap.aai
4 # ================================================================================
5 # Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
6 # Copyright (c) 2020 Nokia Intellectual Property. All rights reserved.
7 # ================================================================================
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # you may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
11 #
12 #    http://www.apache.org/licenses/LICENSE-2.0
13 #
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS,
16 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 # See the License for the specific language governing permissions and
18 # limitations under the License.
19 # ============LICENSE_END=========================================================
20 apiVersion: apps/v1
21 kind: Deployment
22 metadata:
23   name: {{ include "common.fullname" . }}
24   namespace: {{ include "common.namespace" . }}
25   labels:
26     app: {{ include "common.name" . }}
27     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
28     release: {{ include "common.release" . }}
29     heritage: {{ .Release.Service }}
30 spec:
31   replicas: {{ .Values.replicaCount }}
32   selector:
33     matchLabels:
34       app: {{ include "common.name" . }}
35   template:
36     metadata:
37       labels:
38         app: {{ include "common.name" . }}
39         release: {{ include "common.release" . }}
40       name: {{ include "common.name" . }}
41       annotations:
42         checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
43     spec:
44       hostname: aai-graphadmin
45     {{ if .Values.global.initContainers.enabled }}
46       initContainers:
47       - command:
48       {{ if .Values.global.jobs.migration.enabled }}
49         - /app/ready.py
50         args:
51         - --job-name
52         - {{ include "common.release" . }}-aai-graphadmin-migration
53       {{  else if .Values.global.jobs.createSchema.enabled  }}
54         - /app/ready.py
55         args:
56         - --job-name
57         - {{ include "common.release" . }}-aai-graphadmin-create-db-schema
58       {{  else }}
59         - /app/ready.py
60         args:
61         - --container-name
62         {{- if .Values.global.cassandra.localCluster }}
63         - aai-cassandra
64         {{- else }}
65         - cassandra
66         {{- end }}
67         - --container-name
68         - aai-schema-service
69       {{  end  }}
70         env:
71         - name: NAMESPACE
72           valueFrom:
73             fieldRef:
74               apiVersion: v1
75               fieldPath: metadata.namespace
76         image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
77         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
78         name: {{ include "common.name" . }}-readiness
79       {{  end  }}
80       containers:
81       - name: {{ include "common.name" . }}
82         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
83         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
84         env:
85         - name: LOCAL_USER_ID
86           value: {{ .Values.global.config.userId | quote }}
87         - name: LOCAL_GROUP_ID
88           value: {{ .Values.global.config.groupId | quote }}
89         volumeMounts:
90         - mountPath: /etc/localtime
91           name: localtime
92           readOnly: true
93         - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-realtime.properties
94           name: {{ include "common.fullname" . }}-config
95           subPath: janusgraph-realtime.properties
96         - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-cached.properties
97           name: {{ include "common.fullname" . }}-config
98           subPath: janusgraph-cached.properties
99         - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/aaiconfig.properties
100           name: {{ include "common.fullname" . }}-config
101           subPath: aaiconfig.properties
102         - mountPath: /opt/aai/logroot/AAI-RES
103           name: {{ include "common.fullname" . }}-logs
104         - mountPath: /opt/app/aai-graphadmin/resources/logback.xml
105           name: {{ include "common.fullname" . }}-config
106           subPath: logback.xml
107         - mountPath: /opt/app/aai-graphadmin/resources/localhost-access-logback.xml
108           name: {{ include "common.fullname" . }}-config
109           subPath: localhost-access-logback.xml
110         - mountPath: /opt/app/aai-graphadmin/resources/etc/auth/realm.properties
111           name: {{ include "common.fullname" . }}-config
112           subPath: realm.properties
113         - mountPath: /opt/app/aai-graphadmin/resources/application.properties
114           name: {{ include "common.fullname" . }}-config
115           subPath: application.properties
116           {{ $global := . }}
117           {{ range $job := .Values.global.config.auth.files }}
118         - mountPath: /opt/app/aai-graphadmin/resources/etc/auth/{{ . }}
119           name: {{ include "common.fullname" $global }}-auth-truststore-sec
120           subPath: {{ . }}
121           {{ end }}
122         ports:
123         - containerPort: {{ .Values.service.internalPort }}
124         - containerPort: {{ .Values.service.internalPort2 }}
125         # disable liveness probe when breakpoints set in debugger
126         # so K8s doesn't restart unresponsive container
127         {{ if .Values.liveness.enabled }}
128         livenessProbe:
129           tcpSocket:
130             port: {{ .Values.service.internalPort }}
131           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
132           periodSeconds: {{ .Values.liveness.periodSeconds }}
133         {{ end }}
134         readinessProbe:
135           tcpSocket:
136             port: {{ .Values.service.internalPort }}
137           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
138           periodSeconds: {{ .Values.readiness.periodSeconds }}
139         resources:
140 {{ include "common.resources" . }}
141       {{- if .Values.nodeSelector }}
142       nodeSelector:
143 {{ toYaml .Values.nodeSelector | indent 8 }}
144       {{- end -}}
145       {{- if .Values.affinity }}
146       affinity:
147 {{ toYaml .Values.affinity | indent 8 }}
148       {{- end }}
149
150       # side car containers
151       - name: filebeat-onap
152         image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
153         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
154         volumeMounts:
155         - mountPath: /usr/share/filebeat/filebeat.yml
156           subPath: filebeat.yml
157           name: filebeat-conf
158         - mountPath: /var/log/onap
159           name: {{ include "common.fullname" . }}-logs
160         - mountPath: /usr/share/filebeat/data
161           name: {{ include "common.fullname" . }}-filebeat
162
163       volumes:
164       - name: localtime
165         hostPath:
166           path: /etc/localtime
167       - name: filebeat-conf
168         configMap:
169           name: aai-filebeat
170       - name: {{ include "common.fullname" . }}-logs
171         emptyDir: {}
172       - name: {{ include "common.fullname" . }}-filebeat
173         emptyDir: {}
174       - name: {{ include "common.fullname" . }}-config
175         configMap:
176          name: {{ include "common.fullname" . }}-configmap
177       - name: {{ include "common.fullname" . }}-auth-truststore-sec
178         secret:
179          secretName: aai-common-truststore
180          items:
181           {{ range $job := .Values.global.config.auth.files }}
182            - key: {{ . }}
183              path: {{ . }}
184           {{ end }}
185       restartPolicy: {{ .Values.restartPolicy }}
186       imagePullSecrets:
187       - name: "{{ include "common.namespace" . }}-docker-registry-key"