Backfil Billing Data
It might happen that Odoo is down for more than 3 hours. In that case we need to backfill the billing data for VSHN services.
Script of lesser doom
In accordance to the scriptofdoom.sh, we came up with a slightly less doomy script:
while read -r cronjob rest
do
echo $cronjob
kubectl --as cluster-admin -n syn-appcat create job --from cronjob/$cronjob $cronjob --dry-run -oyaml | yq e '.spec.template.spec.containers[0].args[0] = "appuio-reporting report --timerange 1h --begin=$(date -d \"now -12 hours\" -u +\"%Y-%m-%dT%H:00:00Z\") --repeat-until=$(date -u +\"%Y-%m-%dT%H:00:00Z\")"' | kubectl --as cluster-admin apply -f -
done <<< "$(kubectl --as cluster-admin -n syn-appcat get cronjobs.batch --no-headers)"
This will loop over all the billing cronjobs in the syn-appcat
, create a new job from them and replace the args with whatever we want.
This specific example will backfill the last 12h, but it can be adjusted to whatever time range is needed.