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