# Job — migração de banco de dados
apiVersion: batch/v1
kind: Job
metadata:
  name: db-migration
  namespace: production
spec:
  ttlSecondsAfterFinished: 100
  template:
    metadata:
      labels:
        job: db-migration
    spec:
      restartPolicy: Never
      containers:
      - name: migrate
        image: myapp:1.0.0
        command: ["python", "manage.py", "migrate"]
        env:
        - name: DATABASE_URL
          valueFrom:
            secretKeyRef:
              name: db-credentials
              key: url
      backoffLimit: 3