Merge "[AAI] Add model-loader tracing config"
[oom.git] / kubernetes / uui / components / uui-server / templates / job.yaml
1 #
2 # Copyright 2022 CMCC Corporation.
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: {{- include "common.resourceMetadata" . | nindent 2 }}
19 spec:
20   backoffLimit: 20
21   template:
22     metadata:
23       labels:
24         app: {{ include "common.name" . }}-job
25         release: {{ include "common.release" . }}
26     spec:
27       restartPolicy: Never
28       initContainers:
29       - command:
30         - /app/ready.py
31         args:
32         - --service-name
33         - "{{ .Values.postgres.service.name2 }}"
34         env:
35         - name: NAMESPACE
36           valueFrom:
37             fieldRef:
38               apiVersion: v1
39               fieldPath: metadata.namespace
40         image: {{ include "repositoryGenerator.image.readiness" . }}
41         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy}}
42         name: {{ include "common.name" . }}-readiness
43         resources:
44           limits:
45             cpu: "100m"
46             memory: "500Mi"
47           requests:
48             cpu: "3m"
49             memory: "20Mi"
50       containers:
51       - name: {{ include "common.name" . }}-job
52         image: {{ include "repositoryGenerator.image.postgres" . }}
53         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
54         env:
55         - name: PGUSER
56           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 10 }}
57         - name: PGPASSWORD
58           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }}
59         command:
60         - /bin/sh
61         - -c
62         - |
63           psql -U {{ .Values.postgres.config.pgUserName }}  -d {{ .Values.postgres.config.pgDatabase }}  -h $(UUI_SERVER_PG_PRIMARY_SERVICE_HOST) -f /aaa/init/postgres.sql
64         volumeMounts:
65         - name: init-data
66           mountPath: /aaa/init/postgres.sql
67           subPath: postgres.sql
68       {{ include "common.waitForJobContainer" . | indent 6 | trim }}
69       {{- include "common.imagePullSecrets" . | nindent 6 }}
70       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
71       volumes:
72       - name: init-data
73         configMap:
74           name: {{ include "common.fullname" . }}