use Kubernetes CronJob instead of sidekar with cronjob daemon
Description of the change
Assume in the values.yaml the cronjob is enabled:
cronjob:
enabled: true
This requires a permanently running container as it is implemented as a container in the nextcloud deployment. One could use a K8s cronjob instead.
https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/
Benefits
If a K8s cronjob would be used instead, the resources would be freed when the cronjob is not running. At least this is my understanding.
Possible drawbacks
If the frequency is very high, the time of launching the container and stopping may not allow many other jobs to run in between.
It was like that in the past and there were problems, that's why it was changed to be a permanent container instead. I think there recently was another issue with a similar request and you should also be able to find the old issues/PRs from when this was changed. PRs are always welcome and we try to review them in a timely manner.
#577 is the older Issue. It looks like there's an okay'd plan there as well, but no PR yet.
Here it was changes from k8s-cronjob to cron daemon: https://github.com/nextcloud/helm/pull/292
On the first look, it seens just a replace that the curl job of cronjob inside the normal container is not beautiful.
I just wrote a reason why a CronJob is preferred instead of a crond inside a container: because in cluster with restricted-v2 policy (like OpenShift), the crond does not has the privilege to do a change group.
This is likely solved by: https://github.com/nextcloud/helm/pull/740