JunyiDu | e3fccd4 | 2022-09-28 16:56:13 +0800 | [diff] [blame] | 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 |
Andreas Geissler | 4753743 | 2024-02-27 08:55:23 +0100 | [diff] [blame] | 43 | resources: |
| 44 | limits: |
| 45 | cpu: "100m" |
Andreas Geissler | 8cbb3d9 | 2024-03-12 16:44:56 +0100 | [diff] [blame] | 46 | memory: "500Mi" |
Andreas Geissler | 4753743 | 2024-02-27 08:55:23 +0100 | [diff] [blame] | 47 | requests: |
| 48 | cpu: "3m" |
Andreas Geissler | 8cbb3d9 | 2024-03-12 16:44:56 +0100 | [diff] [blame] | 49 | memory: "20Mi" |
JunyiDu | e3fccd4 | 2022-09-28 16:56:13 +0800 | [diff] [blame] | 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 |
Andreas Geissler | 22f3b16 | 2023-02-07 13:10:01 +0100 | [diff] [blame] | 68 | {{ include "common.waitForJobContainer" . | indent 6 | trim }} |
Andreas Geissler | bd0d31a | 2024-03-20 09:51:32 +0100 | [diff] [blame] | 69 | {{- include "common.imagePullSecrets" . | nindent 6 }} |
vladimir turok | d804418 | 2023-07-27 16:28:36 +0200 | [diff] [blame] | 70 | serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}} |
JunyiDu | e3fccd4 | 2022-09-28 16:56:13 +0800 | [diff] [blame] | 71 | volumes: |
| 72 | - name: init-data |
| 73 | configMap: |
| 74 | name: {{ include "common.fullname" . }} |