# https://kubernetes.io/docs/concepts/workloads/controllers/job/ apiVersion: batch/v1 kind: Job metadata: name: election-migration annotations: # 1. Tells Argo this is a hook to run during sync argocd.argoproj.io/hook: Sync # 2. Ensures the migration runs BEFORE the deployment argocd.argoproj.io/sync-wave: "1" # 3. Deletes the job after it succeeds so it can run again next time argocd.argoproj.io/hook-delete-policy: BeforeHookCreation labels: app: election-migration spec: template: metadata: name: election-migration labels: app: election-migration spec: containers: - name: election-migration image: election-migration env: - name: DATABASE_URL valueFrom: secretKeyRef: name: election key: DATABASE_URL restartPolicy: OnFailure dnsPolicy: ClusterFirst