41c26db6e2f6add342955a4ec455735e1f86332e
[oom.git] / kubernetes / aai / charts / aai-traversal / templates / job.yaml
1 # Copyright © 2017-2018 AT&T
2 # Modifications Copyright © 2018 Amdocs, Bell Canada
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: batch/v1
17 kind: Job
18 metadata:
19   name: {{ include "common.fullname" . }}-update-query-data
20   namespace: {{ include "common.namespace" . }}
21   labels:
22     app: {{ include "common.name" . }}
23     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
24     release: {{ .Release.Name }}
25     heritage: {{ .Release.Service }}
26 spec:
27   template:
28     metadata:
29       labels:
30         app: {{ include "common.name" . }}-job
31         release: {{ .Release.Name }}
32       name: {{ include "common.name" . }}
33     spec:
34       initContainers:
35       - command:
36         - /root/ready.py
37         args:
38         - --container-name
39         - aai
40         env:
41         - name: NAMESPACE
42           valueFrom:
43             fieldRef:
44               apiVersion: v1
45               fieldPath: metadata.namespace
46         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
47         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
48         name: {{ include "common.name" . }}-readiness
49       containers:
50       - name: {{ include "common.name" . }}-job
51         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
52         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
53         command:
54         - bash
55         - "-c"
56         - |
57           set -x
58           mkdir -p /opt/aai/logroot/AAI-GQ/misc
59           bash -x /opt/app/aai-traversal/docker-entrypoint.sh install/updateQueryData.sh
60         env:
61         - name: LOCAL_USER_ID
62           value: "1000"
63         - name: LOCAL_GROUP_ID
64           value: "1000"
65         volumeMounts:
66         - mountPath: /etc/localtime
67           name: localtime
68           readOnly: true
69         - mountPath: /opt/app/aai-traversal/resources/etc/appprops/janusgraph-realtime.properties
70           name: {{ include "common.fullname" . }}-db-real-conf
71           subPath: janusgraph-realtime.properties
72         - mountPath: /opt/app/aai-traversal/resources/etc/appprops/janusgraph-cached.properties
73           name: {{ include "common.fullname" . }}-db-cached-conf
74           subPath: janusgraph-cached.properties
75         - mountPath: /opt/app/aai-traversal/resources/etc/appprops/aaiconfig.properties
76           name: {{ include "common.fullname" . }}-aaiconfig-conf
77           subPath: aaiconfig.properties
78         - mountPath: /var/log/onap
79           name: {{ include "common.fullname" . }}-logs
80         - mountPath: /opt/app/aai-traversal/resources/logback.xml
81           name: {{ include "common.fullname" . }}-log-conf
82           subPath: logback.xml
83         - mountPath: /opt/app/aai-traversal/resources/localhost-access-logback.xml
84           name: {{ include "common.fullname" . }}-localhost-access-log-conf
85           subPath: localhost-access-logback.xml
86         - mountPath: /opt/app/aai-traversal/resources/application.properties
87           name: {{ include "common.fullname" . }}-springapp-conf
88           subPath: application.properties
89         - mountPath: /opt/app/aai-traversal/resources/etc/auth/aai_keystore
90           name: {{ include "common.fullname" . }}-auth-sec
91           subPath: aai_keystore
92         # disable liveness probe when breakpoints set in debugger
93         # so K8s doesn't restart unresponsive container
94       volumes:
95       - name: localtime
96         hostPath:
97           path: /etc/localtime
98       - name: filebeat-conf
99         configMap:
100           name: aai-filebeat
101       - name: {{ include "common.fullname" . }}-logs
102         hostPath:
103           path: {{ .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountSubPath }}-update-query
104       - name: {{ include "common.fullname" . }}-filebeat
105         emptyDir: {}
106       - name: {{ include "common.fullname" . }}-log-conf
107         configMap:
108          name: {{ include "common.fullname" . }}-log
109       - name: {{ include "common.fullname" . }}-localhost-access-log-conf
110         configMap:
111          name: {{ include "common.fullname" . }}-localhost-access-log-configmap
112       - name: {{ include "common.fullname" . }}-db-real-conf
113         configMap:
114          name: {{ include "common.fullname" . }}-db-real-configmap
115       - name: {{ include "common.fullname" . }}-db-cached-conf
116         configMap:
117          name: {{ include "common.fullname" . }}-db-cached-configmap
118       - name: {{ include "common.fullname" . }}-aaiconfig-conf
119         configMap:
120          name: {{ include "common.fullname" . }}-aaiconfig-configmap
121       - name: {{ include "common.fullname" . }}-springapp-conf
122         configMap:
123          name: {{ include "common.fullname" . }}-springapp-configmap
124       - name: {{ include "common.fullname" . }}-realm-conf
125         configMap:
126          name: {{ include "common.fullname" . }}-realm-configmap
127       - name: {{ include "common.fullname" . }}-auth-sec
128         secret:
129          secretName: aai-auth-secret
130       restartPolicy: OnFailure
131       imagePullSecrets:
132       - name: "{{ include "common.namespace" . }}-docker-registry-key"