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