helm icon indicating copy to clipboard operation
helm copied to clipboard

use Kubernetes CronJob instead of sidekar with cronjob daemon

Open rriemann opened this issue 11 months ago • 3 comments

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.

rriemann avatar Jan 15 '25 14:01 rriemann

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.

provokateurin avatar Jan 15 '25 16:01 provokateurin

#577 is the older Issue. It looks like there's an okay'd plan there as well, but no PR yet.

sdwilsh avatar Mar 02 '25 14:03 sdwilsh

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.

wrenix avatar Mar 06 '25 16:03 wrenix

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.

antoinetran avatar May 28 '25 12:05 antoinetran

This is likely solved by: https://github.com/nextcloud/helm/pull/740

DreamingRaven avatar Sep 13 '25 17:09 DreamingRaven