Create cron jobs idempotently

Change-Id: Ib7d74ed3b202237027e6da9908c257e81c8cfc25
This commit is contained in:
Kostiantyn Kalynovskyi 2022-07-14 23:19:11 +00:00 committed by Kostyantyn Kalynovskyi
parent 5b6192746a
commit 18fdc30961

View File

@ -10,6 +10,7 @@ for i in ${CRONJOBS}; do
# avoid scheduled runs to prevent case when our manual job is deleted by history limit.
kubectl patch cj/"${CJ}" -n"${NS}" -p '{"spec" : {"suspend" : true }}'
kubectl get job -n"${NS}" "${CJ}-${TEST_POSTFIX}" || \
kubectl create job -n"${NS}" --from=cj/"${CJ}" "${CJ}-${TEST_POSTFIX}"
done