blob: 6ca5ee4acb1b2e2bc45d726d7dd5d3aae4e06ab7 [file] [log] [blame]
JunyiDue3fccd42022-09-28 16:56:13 +08001#
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#
16apiVersion: batch/v1
17kind: Job
18metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
19spec:
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
Andreas Geissler47537432024-02-27 08:55:23 +010043 resources:
44 limits:
45 cpu: "100m"
Andreas Geissler8cbb3d92024-03-12 16:44:56 +010046 memory: "500Mi"
Andreas Geissler47537432024-02-27 08:55:23 +010047 requests:
48 cpu: "3m"
Andreas Geissler8cbb3d92024-03-12 16:44:56 +010049 memory: "20Mi"
JunyiDue3fccd42022-09-28 16:56:13 +080050 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
Andreas Geissler22f3b162023-02-07 13:10:01 +010068 {{ include "common.waitForJobContainer" . | indent 6 | trim }}
Andreas Geisslerbd0d31a2024-03-20 09:51:32 +010069 {{- include "common.imagePullSecrets" . | nindent 6 }}
vladimir turokd8044182023-07-27 16:28:36 +020070 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
JunyiDue3fccd42022-09-28 16:56:13 +080071 volumes:
72 - name: init-data
73 configMap:
74 name: {{ include "common.fullname" . }}