apiVersion: batch/v1
kind: Job
metadata:
  name: staging-openfga-migrate
  labels:
    helm.sh/chart: openfga-0.2.12
    app.kubernetes.io/name: openfga
    app.kubernetes.io/instance: staging
    app.kubernetes.io/version: "v1.5.9"
    app.kubernetes.io/managed-by: Helm
  annotations:
    helm.sh/hook: post-install, post-upgrade, post-rollback, post-delete
    helm.sh/hook-delete-policy: before-hook-creation
    helm.sh/hook-weight: "-5"
spec:
  template:
    metadata:
      annotations:
        helm.sh/hook: post-install, post-upgrade, post-rollback, post-delete
        helm.sh/hook-delete-policy: before-hook-creation
        helm.sh/hook-weight: "-5"
    spec:
      serviceAccountName: staging-openfga
      containers:
        - name: migrate-database
          securityContext:
            {}
          image: "openfga/openfga:v1.5.9"
          args: ["migrate"]
          env:
            - name: OPENFGA_DATASTORE_ENGINE
              value: "postgres"
            - name: OPENFGA_DATASTORE_URI
              valueFrom:
                secretKeyRef:
                  name: "staging-openfga-db-superuser"
                  key: "uri"
          resources:
            {}
      restartPolicy: Never
  backoffLimit: 1
