b595ac81bf36b16058de33d814f23d3711e1e822
[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         - aai-cassandra
58         - --container-name
59         - aai-schema-service
60       {{  end  }}
61         env:
62         - name: NAMESPACE
63           valueFrom:
64             fieldRef:
65               apiVersion: v1
66               fieldPath: metadata.namespace
67         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
68         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
69         name: {{ include "common.name" . }}-readiness
70       {{  end  }}
71       containers:
72       - name: {{ include "common.name" . }}
73         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
74         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
75         env:
76         - name: LOCAL_USER_ID
77           value: {{ .Values.global.config.userId | quote }}
78         - name: LOCAL_GROUP_ID
79           value: {{ .Values.global.config.groupId | quote }}
80         volumeMounts:
81         - mountPath: /etc/localtime
82           name: localtime
83           readOnly: true
84         - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-realtime.properties
85           name: {{ include "common.fullname" . }}-db-real-conf
86           subPath: janusgraph-realtime.properties
87         - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-cached.properties
88           name: {{ include "common.fullname" . }}-db-cached-conf
89           subPath: janusgraph-cached.properties
90         - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/aaiconfig.properties
91           name: {{ include "common.fullname" . }}-aaiconfig-conf
92           subPath: aaiconfig.properties
93         - mountPath: /opt/aai/logroot/AAI-RES
94           name: {{ include "common.fullname" . }}-logs
95         - mountPath: /opt/app/aai-graphadmin/resources/logback.xml
96           name: {{ include "common.fullname" . }}-log-conf
97           subPath: logback.xml
98         - mountPath: /opt/app/aai-graphadmin/resources/localhost-access-logback.xml
99           name: {{ include "common.fullname" . }}-localhost-access-log-conf
100           subPath: localhost-access-logback.xml
101         - mountPath: /opt/app/aai-graphadmin/resources/etc/auth/realm.properties
102           name: {{ include "common.fullname" . }}-realm-conf
103           subPath: realm.properties
104         - mountPath: /opt/app/aai-graphadmin/resources/application.properties
105           name: {{ include "common.fullname" . }}-springapp-conf
106           subPath: application.properties
107           {{ $global := . }}
108           {{ range $job := .Values.global.config.auth.files }}
109         - mountPath: /opt/app/aai-graphadmin/resources/etc/auth/{{ . }}
110           name: {{ include "common.fullname" $global }}-auth-truststore-sec
111           subPath: {{ . }}
112           {{ end }}
113         ports:
114         - containerPort: {{ .Values.service.internalPort }}
115         - containerPort: {{ .Values.service.internalPort2 }}
116         # disable liveness probe when breakpoints set in debugger
117         # so K8s doesn't restart unresponsive container
118         {{ if .Values.liveness.enabled }}
119         livenessProbe:
120           tcpSocket:
121             port: {{ .Values.service.internalPort }}
122           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
123           periodSeconds: {{ .Values.liveness.periodSeconds }}
124         {{ end }}
125         readinessProbe:
126           tcpSocket:
127             port: {{ .Values.service.internalPort }}
128           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
129           periodSeconds: {{ .Values.readiness.periodSeconds }}
130         resources:
131 {{ include "common.resources" . }}
132       {{- if .Values.nodeSelector }}
133       nodeSelector:
134 {{ toYaml .Values.nodeSelector | indent 8 }}
135       {{- end -}}
136       {{- if .Values.affinity }}
137       affinity:
138 {{ toYaml .Values.affinity | indent 8 }}
139       {{- end }}
140
141       # side car containers
142       - name: filebeat-onap
143         image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
144         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
145         volumeMounts:
146         - mountPath: /usr/share/filebeat/filebeat.yml
147           subPath: filebeat.yml
148           name: filebeat-conf
149         - mountPath: /var/log/onap
150           name: {{ include "common.fullname" . }}-logs
151         - mountPath: /usr/share/filebeat/data
152           name: {{ include "common.fullname" . }}-filebeat
153
154       volumes:
155       - name: localtime
156         hostPath:
157           path: /etc/localtime
158       - name: filebeat-conf
159         configMap:
160           name: aai-filebeat
161       - name: {{ include "common.fullname" . }}-logs
162         emptyDir: {}
163       - name: {{ include "common.fullname" . }}-filebeat
164         emptyDir: {}
165       - name: {{ include "common.fullname" . }}-log-conf
166         configMap:
167          name: {{ include "common.fullname" . }}-log
168       - name: {{ include "common.fullname" . }}-localhost-access-log-conf
169         configMap:
170          name: {{ include "common.fullname" . }}-localhost-access-log-configmap
171       - name: {{ include "common.fullname" . }}-db-real-conf
172         configMap:
173          name: {{ include "common.fullname" . }}-db-real-configmap
174       - name: {{ include "common.fullname" . }}-db-cached-conf
175         configMap:
176          name: {{ include "common.fullname" . }}-db-cached-configmap
177       - name: {{ include "common.fullname" . }}-aaiconfig-conf
178         configMap:
179          name: {{ include "common.fullname" . }}-aaiconfig-configmap
180       - name: {{ include "common.fullname" . }}-springapp-conf
181         configMap:
182          name: {{ include "common.fullname" . }}-springapp-configmap
183       - name: {{ include "common.fullname" . }}-realm-conf
184         configMap:
185          name: {{ include "common.fullname" . }}-realm-configmap
186       - name: {{ include "common.fullname" . }}-auth-truststore-sec
187         secret:
188          secretName: aai-common-truststore
189          items:
190           {{ range $job := .Values.global.config.auth.files }}
191            - key: {{ . }}
192              path: {{ . }}
193           {{ end }}
194       restartPolicy: {{ .Values.restartPolicy }}
195       imagePullSecrets:
196       - name: "{{ include "common.namespace" . }}-docker-registry-key"