teableio/teable

View on GitHub
dockers/examples/helm/templates/migration-job.yaml

Summary

Maintainability
Test Coverage
{{- $envVars := include "common.env.transformDict" .Values.envVars -}}
{{- $secret := include "teable.nameBuilder" . }}
{{- $root := .Values.migrationJob }}
{{- if $root.enabled }}
apiVersion: batch/v1
kind: Job
metadata:
  name: {{ include "teable.nameBuilder" . }}
  namespace: {{ include "common.namespace" . }}
  labels:
    {{- include "common.labels" $ | nindent 4 }}
    app.kubernetes.io/part: migration
  annotations:
    "helm.sh/hook": pre-install,pre-upgrade
    "helm.sh/hook-weight": "0"
    "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
spec:
  template:
    metadata:
      name: {{ include "teable.nameBuilder" . }}
      {{- with $root.podAnnotations }}
      annotations:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      labels:
        {{- include "common.selectorLabels" $ | nindent 8 }}
        app.kubernetes.io/part: migration
    spec:
      restartPolicy: Never
      {{- if .Values.image.pullSecrets }}
      imagePullSecrets:
        {{- toYaml .Values.image.pullSecrets | nindent 8 }}
      {{- end }}
      containers:
        - name: {{ .Chart.Name }}
          {{- include "teable.shared.image" (list $ "migrationJob") | nindent 10 }}
          env:
            {{- include "teable.env.database" $ | nindent 12 }}
            {{- $envVars | nindent 12 }}
          resources:
            {{- toYaml $root.resources | nindent 12 }}
{{- end }}