Backfill Billing Data (Deprecated)
|
This page is deprecated. The script on this page applies only to the legacy metered billing CronJobs and is only relevant for Object Buckets on Cloudscale/Exoscale. For VSHN managed services (PostgreSQL, Redis, etc.) that use Event-Based Billing, use the resend annotation instead:
See AppCat Billing for full documentation. |
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=system: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=system:admin apply -f -
done <<< "$(kubectl --as=system: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.