Migrate the cron container from sidecar to K8s CronJob
Description of the change
With this change we no longer deploy a sidecar container to execute the cronjob, instead we deploy a Kubernetes CronJob object.
Benefits
- For me this has the major advantage that the CronJob can run as user www-data (uid 33) and execute the php command directly whereas crond in the sidecar has to run as root since otherwise the impersonation of user www-data fails (
crond: can't set groups: Operation not permitted). - History of failed and successful executions
- Apart from that I think that is also more robust if the container fails for some reason.
Possible drawbacks
None obvious to me.
Applicable issues
- fixes #577
Additional information
Checklist
- [X] I have read the CONTRIBUTING.md doc.
- [X] DCO has been signed off on the commit.
- [X] Chart version bumped in
Chart.yamlaccording to semver. - [x] (optional) Parameters are documented in the README.md
One concern that I had while originally thinking about the implementation: This would allow the cronjob to run even while the rest of nextcloud is not running (e.g. during upgrades). I'm not entirely sure if this is actually a problem, but worth checking what the implications are. I'm also not entirely sure if the current setup properly handles this in all cases.
One concern that I had while originally thinking about the implementation: This would allow the cronjob to run even while the rest of nextcloud is not running (e.g. during upgrades). I'm not entirely sure if this is actually a problem, but worth checking what the implications are. I'm also not entirely sure if the current setup properly handles this in all cases.
Thanks for this thought. But I think using the CronJob is not worse (maybe better) than the current state. Yes, it might happen that a cronJob is executed while a new, updated pod is deployed and potentially migrate the data model. But I have no idea how to avoid this one way or the other.
I did come across a few apps that ask their users to setup additional cronjobs, I wonder if that could be supported.
I did come across a few apps that ask their users to setup additional cronjobs, I wonder if that could be supported.
With the configurable command you can do basically whatever you want to, e.g. chain several commands, mount a script and execute this, ...
With the configurable command you can do basically whatever you want to, e.g. chain several commands, mount a script and execute this, ...
everything except have them run on different schedules. but I guess that can really be a follow-up change if needed
Great change! Good to see that.
Great change! Good to see that.
@JuniorJPDJ Unfortunately, I don't get any signs from the maintainers whether they will accept the switch to a Kubernetes Cronjob in the end (see https://github.com/nextcloud/helm/pull/712/files#r2000401925). So I am sort of stuck with my changes.
@Manuelraa Thanks for addressing this design flaw and solving my issue with your fix.