Merge "vvp -- VNF Validation Platform"
[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 {{ if .Values.global.jobs.updateQueryData.enabled }}
17
18 apiVersion: batch/v1
19 kind: Job
20 metadata:
21   name: {{ include "common.fullname" . }}-update-query-data
22   namespace: {{ include "common.namespace" . }}
23   labels:
24     app: {{ include "common.name" . }}
25     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
26     release: {{ .Release.Name }}
27     heritage: {{ .Release.Service }}
28 spec:
29   template:
30     metadata:
31       labels:
32         app: {{ include "common.name" . }}-job
33         release: {{ .Release.Name }}
34       name: {{ include "common.name" . }}
35     spec:
36       initContainers:
37       - command:
38         - /root/ready.py
39         args:
40         - --container-name
41         - aai
42         env:
43         - name: NAMESPACE
44           valueFrom:
45             fieldRef:
46               apiVersion: v1
47               fieldPath: metadata.namespace
48         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
49         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
50         name: {{ include "common.name" . }}-readiness
51       containers:
52       - name: {{ include "common.name" . }}-job
53         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
54         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
55         command:
56         - bash
57         - "-c"
58         - |
59           set -x
60           mkdir -p /opt/aai/logroot/AAI-GQ/misc
61           until nc -w10 -z -v aai.{{.Release.Namespace}} 8443; do echo "Retrying to reach aai on port 8443"; done;
62           bash -x /opt/app/aai-traversal/docker-entrypoint.sh install/updateQueryData.sh
63         env:
64         - name: LOCAL_USER_ID
65           value: {{ .Values.global.config.userId | quote }}
66         - name: LOCAL_GROUP_ID
67           value: {{ .Values.global.config.groupId | quote }}
68         volumeMounts:
69         - mountPath: /etc/localtime
70           name: localtime
71           readOnly: true
72         - mountPath: /opt/app/aai-traversal/resources/etc/appprops/janusgraph-realtime.properties
73           name: {{ include "common.fullname" . }}-db-real-conf
74           subPath: janusgraph-realtime.properties
75         - mountPath: /opt/app/aai-traversal/resources/etc/appprops/janusgraph-cached.properties
76           name: {{ include "common.fullname" . }}-db-cached-conf
77           subPath: janusgraph-cached.properties
78         - mountPath: /opt/app/aai-traversal/resources/etc/appprops/aaiconfig.properties
79           name: {{ include "common.fullname" . }}-aaiconfig-conf
80           subPath: aaiconfig.properties
81         - mountPath: /opt/aai/logroot/AAI-GQ/
82           name: {{ include "common.fullname" . }}-logs
83         - mountPath: /opt/app/aai-traversal/resources/logback.xml
84           name: {{ include "common.fullname" . }}-log-conf
85           subPath: logback.xml
86         - mountPath: /opt/app/aai-traversal/resources/localhost-access-logback.xml
87           name: {{ include "common.fullname" . }}-localhost-access-log-conf
88           subPath: localhost-access-logback.xml
89         - mountPath: /opt/app/aai-traversal/resources/application.properties
90           name: {{ include "common.fullname" . }}-springapp-conf
91           subPath: application.properties
92           {{ $global := . }}
93           {{ range $job := .Values.global.config.auth.files }}
94         - mountPath: /opt/app/aai-traversal/resources/etc/auth/{{ . }}
95           name: {{ include "common.fullname" $global }}-auth-truststore-sec
96           subPath: {{ . }}
97           {{ end }}
98         # disable liveness probe when breakpoints set in debugger
99         # so K8s doesn't restart unresponsive container
100       volumes:
101       - name: localtime
102         hostPath:
103           path: /etc/localtime
104       - name: filebeat-conf
105         configMap:
106           name: aai-filebeat
107       - name: {{ include "common.fullname" . }}-logs
108         hostPath:
109           path: {{ .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountSubPath }}-update-query
110       - name: {{ include "common.fullname" . }}-filebeat
111         emptyDir: {}
112       - name: {{ include "common.fullname" . }}-log-conf
113         configMap:
114          name: {{ include "common.fullname" . }}-log
115       - name: {{ include "common.fullname" . }}-localhost-access-log-conf
116         configMap:
117          name: {{ include "common.fullname" . }}-localhost-access-log-configmap
118       - name: {{ include "common.fullname" . }}-db-real-conf
119         configMap:
120          name: {{ include "common.fullname" . }}-db-real-configmap
121       - name: {{ include "common.fullname" . }}-db-cached-conf
122         configMap:
123          name: {{ include "common.fullname" . }}-db-cached-configmap
124       - name: {{ include "common.fullname" . }}-aaiconfig-conf
125         configMap:
126          name: {{ include "common.fullname" . }}-aaiconfig-configmap
127       - name: {{ include "common.fullname" . }}-springapp-conf
128         configMap:
129          name: {{ include "common.fullname" . }}-springapp-configmap
130       - name: {{ include "common.fullname" . }}-realm-conf
131         configMap:
132          name: {{ include "common.fullname" . }}-realm-configmap
133       - name: {{ include "common.fullname" . }}-auth-truststore-sec
134         secret:
135          secretName: aai-auth-truststore-secret
136          items:
137           {{ range $job := .Values.global.config.auth.files }}
138            - key: {{ . }}
139              path: {{ . }}
140           {{ end }}
141       restartPolicy: OnFailure
142       imagePullSecrets:
143       - name: "{{ include "common.namespace" . }}-docker-registry-key"
144 {{ end }}