[UUI] New Solve 2 components in one Docker
[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         - --container-name
33         - "{{ .Values.postgres.nameOverride }}"
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       containers:
44       - name: {{ include "common.name" . }}-job
45         image: {{ include "repositoryGenerator.image.postgres" . }}
46         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
47         env:
48         - name: PGUSER
49           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 10 }}
50         - name: PGPASSWORD
51           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }}
52         command:
53         - /bin/sh
54         - -c
55         - |
56           psql -U {{ .Values.postgres.config.pgUserName }}  -d {{ .Values.postgres.config.pgDatabase }}  -h $(UUI_SERVER_PG_PRIMARY_SERVICE_HOST) -f /aaa/init/postgres.sql
57         volumeMounts:
58         - name: init-data
59           mountPath: /aaa/init/postgres.sql
60           subPath: postgres.sql
61       imagePullSecrets:
62       - name: "{{ include "common.namespace" . }}-docker-registry-key"
63       volumes:
64       - name: init-data
65         configMap:
66           name: {{ include "common.fullname" . }}
67