blob: 4d6b0ddc66a14e966fbea057a77fb61eb6c4ce23 [file] [log] [blame]
Sylvain Desbureaux70070412020-11-09 21:58:48 +01001# Copyright (c) 2017-2018 AT&T
2# Modifications Copyright (c) 2018 Amdocs, Bell Canada
3# Modifications Copyright (c) 2020 Nokia
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17{{ if .Values.global.jobs.updateQueryData.enabled }}
18
19apiVersion: batch/v1
20kind: Job
21metadata:
22 name: {{ include "common.fullname" . }}-update-query-data
23 namespace: {{ include "common.namespace" . }}
24 labels:
25 app: {{ include "common.name" . }}
26 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
27 release: {{ include "common.release" . }}
28 heritage: {{ .Release.Service }}
29{{ if .Values.global.jobs.migration.enabled }}
30 annotations:
31 "helm.sh/hook": post-upgrade,post-rollback,post-install
32 "helm.sh/hook-weight": "2"
33 "helm.sh/hook-delete-policy": before-hook-creation
34{{ end }}
35spec:
36 template:
37 metadata:
38 labels:
39 app: {{ include "common.name" . }}-job
40 release: {{ include "common.release" . }}
41 name: {{ include "common.name" . }}
42 spec:
43 initContainers:
44 - command:
45 - /app/ready.py
46 args:
47 - --container-name
48 - aai
49 {{ if eq .Values.global.aafEnabled true }}
50 - --container-name
51 - aaf-locate
52 {{ end }}
53 env:
54 - name: NAMESPACE
55 valueFrom:
56 fieldRef:
57 apiVersion: v1
58 fieldPath: metadata.namespace
59 image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
60 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
61 name: {{ include "common.name" . }}-readiness
62 containers:
63 - name: {{ include "common.name" . }}-job
64 image: "{{ include "common.repository" . }}/{{ .Values.image }}"
65 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
66 command:
67 - bash
68 - "-c"
69 - |
70 set -x
71 if [ ! -d /opt/aai/logroot/AAI-GQ/misc ]; then mkdir -p /opt/aai/logroot/AAI-GQ/misc; fi
72 until nc -w10 -z -v aai.{{.Release.Namespace}} 8443; do echo "Retrying to reach aai on port 8443"; done;
73 bash -x /opt/app/aai-traversal/docker-entrypoint.sh install/updateQueryData.sh
74 env:
75 - name: LOCAL_USER_ID
76 value: {{ .Values.global.config.userId | quote }}
77 - name: LOCAL_GROUP_ID
78 value: {{ .Values.global.config.groupId | quote }}
79 resources:
80{{ include "common.resources" . }}
81 volumeMounts:
82 - mountPath: /etc/localtime
83 name: localtime
84 readOnly: true
85 - mountPath: /opt/app/aai-traversal/resources/etc/appprops/janusgraph-realtime.properties
86 name: {{ include "common.fullname" . }}-config
87 subPath: janusgraph-realtime.properties
88 - mountPath: /opt/app/aai-traversal/resources/etc/appprops/janusgraph-cached.properties
89 name: {{ include "common.fullname" . }}-config
90 subPath: janusgraph-cached.properties
91 - mountPath: /opt/app/aai-traversal/resources/etc/appprops/aaiconfig.properties
92 name: {{ include "common.fullname" . }}-config
93 subPath: aaiconfig.properties
94 - mountPath: /opt/aai/logroot/AAI-GQ/
95 name: {{ include "common.fullname" . }}-logs
96 - mountPath: /opt/aai/logroot/AAI-GQ/misc
97 name: {{ include "common.fullname" . }}-logs-misc
98 - mountPath: /opt/app/aai-traversal/resources/logback.xml
99 name: {{ include "common.fullname" . }}-config
100 subPath: logback.xml
101 - mountPath: /opt/app/aai-traversal/resources/localhost-access-logback.xml
102 name: {{ include "common.fullname" . }}-config
103 subPath: localhost-access-logback.xml
104 - mountPath: /opt/app/aai-traversal/resources/application.properties
105 name: {{ include "common.fullname" . }}-config
106 subPath: application.properties
107 {{ $global := . }}
108 {{ range $job := .Values.global.config.auth.files }}
109 - mountPath: /opt/app/aai-traversal/resources/etc/auth/{{ . }}
110 name: {{ include "common.fullname" $global }}-auth-truststore-sec
111 subPath: {{ . }}
112 {{ end }}
113 # disable liveness probe when breakpoints set in debugger
114 # so K8s doesn't restart unresponsive container
115 volumes:
116 - name: localtime
117 hostPath:
118 path: /etc/localtime
119 - name: filebeat-conf
120 configMap:
121 name: aai-filebeat
122 - name: {{ include "common.fullname" . }}-logs
123 emptyDir: {}
124 - name: {{ include "common.fullname" . }}-logs-misc
125 emptyDir: {}
126 - name: {{ include "common.fullname" . }}-filebeat
127 emptyDir: {}
128 - name: {{ include "common.fullname" . }}-config
129 configMap:
130 name: {{ include "common.fullname" . }}-configmap
131 - name: {{ include "common.fullname" . }}-auth-truststore-sec
132 secret:
133 secretName: aai-common-truststore
134 items:
135 {{ range $job := .Values.global.config.auth.files }}
136 - key: {{ . }}
137 path: {{ . }}
138 {{ end }}
139 restartPolicy: OnFailure
140 imagePullSecrets:
141 - name: "{{ include "common.namespace" . }}-docker-registry-key"
142{{ end }}