-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: update the storage-version-migration script to complete execution in finite time #1682
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,19 +65,23 @@ spec: | |
ttlSecondsAfterFinished: 600 | ||
EOF | ||
|
||
JOB_NAME=$(kubectl -n shipwright-build get job --selector app=storage-version-migration-shipwright -o jsonpath='{.items[0].metadata.name}') | ||
|
||
while [ "$(kubectl -n shipwright-build get job "${JOB_NAME}" -o json | jq -r '.status.completionTime // ""')" == "" ]; do | ||
echo "[INFO] Storage version migraton job is still running" | ||
sleep 10 | ||
done | ||
NAMESPACE="shipwright-build" | ||
JOB_NAME=$(kubectl -n "${NAMESPACE}" get job --selector app=storage-version-migration-shipwright -o jsonpath='{.items[0].metadata.name}') | ||
|
||
isFailed="$(kubectl -n shipwright-build get job "${JOB_NAME}" -o json | jq -r '.status.conditions[] | select(.type == "Failed") | .status')" | ||
while true; do | ||
jobStatus=$(kubectl get job "${JOB_NAME}" -n "${NAMESPACE}" -o=jsonpath='{.status.conditions[*].type}') | ||
|
||
if [ "${isFailed}" == "True" ]; then | ||
echo "[ERROR] Storage version migration failed" | ||
kubectl -n shipwright-build logs "job/${JOB_NAME}" | ||
exit 1 | ||
fi | ||
if [[ "${jobStatus}" == *"Complete"* ]]; then | ||
echo "Job ${JOB_NAME} has completed successfully!" | ||
exit 0 | ||
Comment on lines
+75
to
+77
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not sufficient. You need to inspect the |
||
elif [[ "${jobStatus}" == *"Failed"* ]]; then | ||
echo "[ERROR] Storage version migration failed" | ||
exit 1 | ||
fi | ||
|
||
echo "[INFO] Storage version migration job is still running" | ||
sleep 10 | ||
done | ||
|
||
echo "[DONE]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably where the bug is. Per the Job API documentation:
I suspect that in your case, the job is failing. This script doesn't see a completion time because the
Job
never succeeds, hence it just runs forever.See https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/job-v1/#JobStatus