Open pschichtel opened 6 months ago
Some long time ago this was how the crons were implemented, but it had quite some problems which I don't remember anymore. Please search in the issues and PRs of this repo to dig up the history of this. If the problems can be avoided now it definitely makes sense to use the k8s cron instead.
I've found quite a few issues related to cronjobs, but I haven't found any that would suggest an issue with running them as CronJob resources. The cronjob resource used curl to invoke webcron, I can imagine how this could cause various issues like network timeouts. My intent would be to use the same nextcloud/docker image and run the same command the current cron container uses as well.
History of the cronjob.yaml: https://github.com/nextcloud/helm/commits/main/charts/nextcloud/templates/cronjob.yaml
I guess that makes sense, just execute the cron.php script which can not timeout instead of using curl which can timeout. I wonder why nobody thought about this :sweat_smile:
If I were to submit a PR to implement this: Should I keep the current cron mechanism around (e.g. introduce an option to select sidecar vs cronjob)?
I don't think that would be necessary as there is no real breaking change, as long as you use the same container image and mount all the same volumes etc. You're effectively switching https://github.com/nextcloud/docker/blob/13f51c4f70676edb464ce5ea03631403b54623df/29/fpm/Dockerfile#L18 against the k8s Cronjob resource. @jessebot what do you think?
Yeah, I like the idea of this being a k8s cronjob 👍 I don't see a big a deal with removing the cron container either.
This also allows proper scaling of nextcloud pod, as scaling cron container is a bad idea.
Not really, you can have as many cron jobs concurrently as you want (especially useful and necessary on large instances). 1:1 scaling of server and cron is probably a bad idea though as the resource usages are different.
fyi I still have this on my todo, the last few weeks where a little busy.
Another use case for a Kubernetes CronJob is to run the cron container as a non-root user, because at the moment this doesn't seem possible (see this issue)
Description of the change
I would like to use k8s' CronJob resources to run nextcloud's cronjob tasks instead of having them executed by the cron container.
Benefits
Possible drawbacks
I'm not entirely clear on how this might interact with nextcloud during upgrades, but I don't think it changes much compared to the status quo.
Additional information