Fix persistent volume to be mapped to Release.Name
[oom.git] / kubernetes / aai / charts / aai-traversal / templates / job.yaml
1 # Copyright © 2017-2018 AT&T
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #       http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 apiVersion: batch/v1
16 kind: Job
17 metadata:
18   name: {{ include "common.fullname" . }}-update-query-data
19   namespace: {{ include "common.namespace" . }}
20   labels:
21     app: {{ include "common.name" . }}
22     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
23     release: {{ .Release.Name }}
24     heritage: {{ .Release.Service }}
25 spec:
26   template:
27     metadata:
28       labels:
29         app: {{ include "common.name" . }}-job
30         release: {{ .Release.Name }}
31       name: {{ include "common.name" . }}
32     spec:
33       initContainers:
34       - command:
35         - /root/ready.py
36         args:
37         - --container-name
38         - aai
39         env:
40         - name: NAMESPACE
41           valueFrom:
42             fieldRef:
43               apiVersion: v1
44               fieldPath: metadata.namespace
45         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
46         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
47         name: {{ include "common.name" . }}-readiness
48       containers:
49       - name: {{ include "common.name" . }}-job
50         image: "{{ .Values.global.repository | default .Values.repository }}/{{ .Values.image }}"
51         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
52         command:
53         - bash
54         - "-c"
55         - |
56           set -x
57           mkdir -p /opt/aai/logroot/AAI-GQ/misc
58           bash -x /opt/app/aai-traversal/docker-entrypoint.sh install/updateQueryData.sh
59         env:
60         - name: LOCAL_USER_ID
61           value: "1000"
62         - name: LOCAL_GROUP_ID
63           value: "1000"
64         volumeMounts:
65         - mountPath: /etc/localtime
66           name: localtime
67           readOnly: true
68         - mountPath: /opt/app/aai-traversal/resources/etc/appprops/janusgraph-realtime.properties
69           name: {{ include "common.fullname" . }}-db-real-conf
70           subPath: janusgraph-realtime.properties
71         - mountPath: /opt/app/aai-traversal/resources/etc/appprops/janusgraph-cached.properties
72           name: {{ include "common.fullname" . }}-db-cached-conf
73           subPath: janusgraph-cached.properties
74         - mountPath: /opt/app/aai-traversal/resources/etc/appprops/aaiconfig.properties
75           name: {{ include "common.fullname" . }}-aaiconfig-conf
76           subPath: aaiconfig.properties
77         - mountPath: /var/log/onap
78           name: {{ include "common.fullname" . }}-logs
79         - mountPath: /opt/app/aai-traversal/resources/logback.xml
80           name: {{ include "common.fullname" . }}-log-conf
81           subPath: logback.xml
82         - mountPath: /opt/app/aai-traversal/resources/localhost-access-logback.xml
83           name: {{ include "common.fullname" . }}-localhost-access-log-conf
84           subPath: localhost-access-logback.xml
85         - mountPath: /opt/app/aai-traversal/resources/application.properties
86           name: {{ include "common.fullname" . }}-springapp-conf
87           subPath: application.properties
88         - mountPath: /opt/app/aai-traversal/resources/etc/auth/aai_keystore
89           name: {{ include "common.fullname" . }}-auth-sec
90           subPath: aai_keystore
91         # disable liveness probe when breakpoints set in debugger
92         # so K8s doesn't restart unresponsive container
93       volumes:
94       - name: localtime
95         hostPath:
96           path: /etc/localtime
97       - name: filebeat-conf
98         configMap:
99           name: aai-filebeat
100       - name: {{ include "common.fullname" . }}-logs
101         hostPath:
102           path: {{ .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountSubPath }}-update-query
103       - name: {{ include "common.fullname" . }}-filebeat
104         emptyDir: {}
105       - name: {{ include "common.fullname" . }}-log-conf
106         configMap:
107          name: {{ include "common.fullname" . }}-log
108       - name: {{ include "common.fullname" . }}-localhost-access-log-conf
109         configMap:
110          name: {{ include "common.fullname" . }}-localhost-access-log-configmap
111       - name: {{ include "common.fullname" . }}-db-real-conf
112         configMap:
113          name: {{ include "common.fullname" . }}-db-real-configmap
114       - name: {{ include "common.fullname" . }}-db-cached-conf
115         configMap:
116          name: {{ include "common.fullname" . }}-db-cached-configmap
117       - name: {{ include "common.fullname" . }}-aaiconfig-conf
118         configMap:
119          name: {{ include "common.fullname" . }}-aaiconfig-configmap
120       - name: {{ include "common.fullname" . }}-springapp-conf
121         configMap:
122          name: {{ include "common.fullname" . }}-springapp-configmap
123       - name: {{ include "common.fullname" . }}-realm-conf
124         configMap:
125          name: {{ include "common.fullname" . }}-realm-configmap
126       - name: {{ include "common.fullname" . }}-auth-sec
127         secret:
128          secretName: {{ include "common.fullname" . }}-auth-secret
129       restartPolicy: OnFailure
130       imagePullSecrets:
131       - name: "{{ include "common.namespace" . }}-docker-registry-key"