apiVersion: batch/v1
kind: Job
metadata:
  name: db-migration
  namespace: tekton-hub-preview
spec:
  template:
    spec:
      containers:
      - name: db-migration
        image: ko://github.com/tektoncd/hub/api/cmd/db
        env:
            - name: POSTGRESQL_HOST
              value: db
            - name: POSTGRESQL_PORT
              valueFrom:
                secretKeyRef:
                  name: db
                  key: POSTGRESQL_PORT
            - name: POSTGRESQL_DATABASE
              valueFrom:
                secretKeyRef:
                  name: db
                  key: POSTGRESQL_DATABASE
            - name: POSTGRESQL_USER
              valueFrom:
                secretKeyRef:
                  name: db
                  key: POSTGRESQL_USER
            - name: POSTGRESQL_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: db
                  key: POSTGRESQL_PASSWORD
      restartPolicy: Never
  backoffLimit: 3
