diff --git a/gen3/bin/reset.sh b/gen3/bin/reset.sh index 61cbc57dc..9cbe1e90d 100644 --- a/gen3/bin/reset.sh +++ b/gen3/bin/reset.sh @@ -32,14 +32,14 @@ run_setup_jobs() { # sheepdog wants its transaction tables to exist at startup # jobs run asynchronously ... # - for jobName in gdcdb-create indexd-userdb; do + for jobName in gdcdb-create indexd-userdb fence-db-migrate; do echo "Launching job $jobName" gen3 job run $jobName done echo "Waiting for jobs to finish, and late starting services to come up" sleep 5 gen3 kube-wait4-pods - for jobName in gdcdb-create indexd-userdb; do + for jobName in gdcdb-create indexd-userdb fence-db-migrate; do echo "--------------------" echo "Logs for $jobName" gen3 job logs "$jobName" diff --git a/kube/services/jobs/fence-db-migrate-job.yaml b/kube/services/jobs/fence-db-migrate-job.yaml new file mode 100644 index 000000000..5a6fca66b --- /dev/null +++ b/kube/services/jobs/fence-db-migrate-job.yaml @@ -0,0 +1,57 @@ +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: fence-db-migrate +spec: + template: + metadata: + labels: + app: gen3job + spec: + serviceAccountName: useryaml-job + volumes: + - name: config-volume + secret: + secretName: "fence-config" + - name: fence-google-app-creds-secret-volume + secret: + secretName: "fence-google-app-creds-secret" + - name: fence-google-storage-creds-secret-volume + secret: + secretName: "fence-google-storage-creds-secret" + - name: fence-yaml + configMap: + name: fence + containers: + - name: fence + GEN3_FENCE_IMAGE + imagePullPolicy: Always + env: + - name: PYTHONPATH + value: /var/www/fence + volumeMounts: + - name: "config-volume" + readOnly: true + mountPath: "/var/www/fence/fence-config.yaml" + subPath: fence-config.yaml + - name: "fence-google-app-creds-secret-volume" + readOnly: true + mountPath: "/var/www/fence/fence_google_app_creds_secret.json" + subPath: fence_google_app_creds_secret.json + - name: "fence-google-storage-creds-secret-volume" + readOnly: true + mountPath: "/var/www/fence/fence_google_storage_creds_secret.json" + subPath: fence_google_storage_creds_secret.json + - name: "fence-yaml" + mountPath: "/var/www/fence/user.yaml" + subPath: user.yaml + command: ["/bin/bash"] + args: + - "-c" + - | + fence-create migrate + if [[ $? != 0 ]]; then + echo "WARNING: non zero exit code: $?" + fi + restartPolicy: Never