blob: fe3e6e81be8981934652256501f8d6c137676ea4 [file] [log] [blame]
Sylvain Desbureaux70070412020-11-09 21:58:48 +01001#
2# ============LICENSE_START=======================================================
3# org.onap.aai
4# ================================================================================
5# Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
6# Copyright (c) 2020 Nokia Intellectual Property. All rights reserved.
7# ================================================================================
8# Licensed under the Apache License, Version 2.0 (the "License");
9# you may not use this file except in compliance with the License.
10# You may obtain a copy of the License at
11#
12# http://www.apache.org/licenses/LICENSE-2.0
13#
14# Unless required by applicable law or agreed to in writing, software
15# distributed under the License is distributed on an "AS IS" BASIS,
16# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17# See the License for the specific language governing permissions and
18# limitations under the License.
19# ============LICENSE_END=========================================================
20
21# In ONAP, the following job will always be run on each installation
22# The following job will go through the latest oxm and
23# create properties based on the data type defined in the oxm
24# and create the required indexes for the appropriate properties
25# This can be run multiple times as the code if the index or property already exists
26# then the index or property won't be created again
27# NOTE - During the execution of the createSchema job, there should
28# be no other janusgraph connection to the graph as its the reason
29# that resources traversal and graphadmin wait until this job is done
30# If you are using an existing cassandra cluster not coming from oom
31# then it is your job to ensure that there are no connections to the database
32
33{{- if and ( not .Values.global.jobs.migration.enabled ) ( .Values.global.jobs.createSchema.enabled ) }}
34apiVersion: batch/v1
35kind: Job
36metadata:
37 name: {{ include "common.fullname" . }}-create-db-schema
38 namespace: {{ include "common.namespace" . }}
39 labels:
40 app: {{ include "common.name" . }}-job
41 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
42 release: {{ include "common.release" . }}
43 heritage: {{ .Release.Service }}
44spec:
45 backoffLimit: 20
46 template:
47 metadata:
48 labels:
49 app: {{ include "common.name" . }}-job
50 release: {{ include "common.release" . }}
51 name: {{ include "common.name" . }}
52 spec:
53 initContainers:
54 - command:
55 - /app/ready.py
56 args:
57 - --container-name
58 {{- if .Values.global.cassandra.localCluster }}
59 - aai-cassandra
60 {{- else }}
61 - cassandra
62 {{- end }}
63 - --container-name
64 - aai-schema-service
65 env:
66 - name: NAMESPACE
67 valueFrom:
68 fieldRef:
69 apiVersion: v1
70 fieldPath: metadata.namespace
71 image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
72 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
73 name: {{ include "common.name" . }}-readiness
74 containers:
75 - name: {{ include "common.name" . }}-job
76 image: "{{ include "common.repository" . }}/{{ .Values.image }}"
77 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
78 command:
79 - /bin/bash
80 - docker-entrypoint.sh
81 - createDBSchema.sh
82 env:
83 - name: LOCAL_USER_ID
84 value: {{ .Values.global.config.userId | quote }}
85 - name: LOCAL_GROUP_ID
86 value: {{ .Values.global.config.groupId | quote }}
87 volumeMounts:
88 - mountPath: /etc/localtime
89 name: localtime
90 readOnly: true
91 - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-realtime.properties
92 name: {{ include "common.fullname" . }}-config
93 subPath: janusgraph-realtime.properties
94 - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-cached.properties
95 name: {{ include "common.fullname" . }}-config
96 subPath: janusgraph-cached.properties
97 - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/aaiconfig.properties
98 name: {{ include "common.fullname" . }}-config
99 subPath: aaiconfig.properties
100 - mountPath: /opt/aai/logroot/AAI-GA
101 name: {{ include "common.fullname" . }}-logs
102 - mountPath: /opt/app/aai-graphadmin/resources/logback.xml
103 name: {{ include "common.fullname" . }}-config
104 subPath: logback.xml
105 - mountPath: /opt/app/aai-graphadmin/resources/localhost-access-logback.xml
106 name: {{ include "common.fullname" . }}-config
107 subPath: localhost-access-logback.xml
108 - mountPath: /opt/app/aai-graphadmin/resources/application.properties
109 name: {{ include "common.fullname" . }}-config
110 subPath: application.properties
111 {{ $global := . }}
112 {{ range $job := .Values.global.config.auth.files }}
113 - mountPath: /opt/app/aai-graphadmin/resources/etc/auth/{{ . }}
114 name: {{ include "common.fullname" $global }}-auth-truststore-sec
115 subPath: {{ . }}
116 {{ end }}
117 resources:
118{{ include "common.resources" . }}
119 {{- if .Values.nodeSelector }}
120 nodeSelector:
121{{ toYaml .Values.nodeSelector | indent 8 }}
122 {{- end -}}
123 {{- if .Values.affinity }}
124 affinity:
125{{ toYaml .Values.affinity | indent 8 }}
126 {{- end }}
127 volumes:
128 - name: localtime
129 hostPath:
130 path: /etc/localtime
131 - name: filebeat-conf
132 configMap:
133 name: aai-filebeat
134 - name: {{ include "common.fullname" . }}-logs
135 emptyDir: {}
136 - name: {{ include "common.fullname" . }}-config
137 configMap:
138 name: {{ include "common.fullname" . }}-configmap
139 - name: {{ include "common.fullname" . }}-auth-truststore-sec
140 secret:
141 secretName: aai-common-truststore
142 items:
143 {{ range $job := .Values.global.config.auth.files }}
144 - key: {{ . }}
145 path: {{ . }}
146 {{ end }}
147 restartPolicy: Never
148 imagePullSecrets:
149 - name: "{{ include "common.namespace" . }}-docker-registry-key"
150{{ end }}