apiVersion: batch/v1
kind: Job
metadata:
  name: todolist-db-schema-migration
  namespace: netcorekit
spec:
  template:
    spec:
      containers:
      - name: todolist-db-schema-migration
        image: vndg/todoapi:latest
        imagePullPolicy: Always
        env:
        - name: Hosts__BasePath
          value: /
        command:
          - "/bin/sh"
          - "-c"
          - "until nc -z -v -w30 mysql 3306; do echo 'Waiting for database connection...'; sleep 5; done; until nc -z -v -w30 todolist 32501; do echo 'Waiting for todoapi connection...'; sleep 5; done; apk add --no-cache curl; curl http://todolist:32501/db-migration"
      restartPolicy: Never
