{{- if and .Values.migrations.enabled .Values.migrations.jobs }} {{- range $job := .Values.migrations.jobs }} apiVersion: batch/v1 kind: Job metadata: name: {{ include "stellaops.fullname" $ }}-migration-{{ $job.name | trunc 30 | trimSuffix "-" }} labels: {{- include "stellaops.labels" $ | nindent 4 }} stellaops.io/component: migration stellaops.io/migration-name: {{ $job.name | quote }} spec: backoffLimit: {{ default 3 $job.backoffLimit }} ttlSecondsAfterFinished: {{ default 3600 $job.ttlSecondsAfterFinished }} template: metadata: labels: {{- include "stellaops.selectorLabels" $ | nindent 8 }} stellaops.io/component: migration stellaops.io/migration-name: {{ $job.name | quote }} spec: restartPolicy: {{ default "Never" $job.restartPolicy }} serviceAccountName: {{ default "default" $job.serviceAccountName }} containers: - name: {{ $job.name | trunc 50 | trimSuffix "-" }} image: {{ $job.image | quote }} imagePullPolicy: {{ default "IfNotPresent" $job.imagePullPolicy }} command: {{- if $job.command }} {{ toJson $job.command }} {{- else }} null {{- end }} args: {{- if $job.args }} {{ toJson $job.args }} {{- else }} null {{- end }} env: {{- if $job.env }} {{- range $k, $v := $job.env }} - name: {{ $k }} value: {{ $v | quote }} {{- end }} {{- end }} envFrom: {{- if $job.envFrom }} {{- toYaml $job.envFrom | nindent 12 }} {{- end }} resources: {{- if $job.resources }} {{- toYaml $job.resources | nindent 12 }} {{- else }}{} {{- end }} imagePullSecrets: {{- if $.Values.global.image.pullSecrets }} {{- toYaml $.Values.global.image.pullSecrets | nindent 8 }} {{- end }} {{- end }} {{- end }}