Files
2026-09-05 19:07:31 +06:00

49 lines
1.6 KiB
YAML

---
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "hrbox.component" (dict "ctx" . "name" "migrate") }}-{{ .Release.Revision }}
labels:
{{- include "hrbox.labels" (dict "ctx" . "name" "jobs") | nindent 4 }}
annotations:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-delete-policy": before-hook-creation
"helm.sh/hook-weight": "10"
spec:
ttlSecondsAfterFinished: 3600
backoffLimit: 6
template:
metadata:
labels:
{{- include "hrbox.labels" (dict "ctx" . "name" "jobs") | nindent 8 }}
spec:
restartPolicy: OnFailure
terminationGracePeriodSeconds: 5
{{- include "hrbox.imagePullSecrets" . | nindent 6 }}
initContainers:
- name: wait-postgres
image: {{ .Values.image.postgresClient | quote }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- bash
- /wait.sh
volumeMounts:
- name: configs
mountPath: /wait.sh
subPath: wait.sh
env:
{{- include "envs_all" . | indent 12 }}
containers:
- name: run-migrations
image: {{ .Values.image.hrbox | quote }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ["php", "yii", "migrate", "--interactive=0"]
env:
{{- include "envs_all" . | indent 12 }}
{{- include "hrbox.resources" (dict "ctx" . "component" "jobs") | indent 10 }}
volumes:
- name: configs
configMap:
name: job-scripts
defaultMode: 420