[stable/nextcloud] Adding cron for the background jobs (#14795)

Signed-off-by: Patrik Fuhrmann <fuhrmann.patrik@gmail.com>
This commit is contained in:
Patrik Fuhrmann
2019-06-15 12:30:10 -07:00
committed by Kubernetes Prow Robot
parent 4527ebe8a3
commit 120415f9ef
4 changed files with 92 additions and 3 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
apiVersion: v1
name: nextcloud
version: 1.2.2
version: 1.3.0
appVersion: 16.0.1
description: A file sharing server that puts the control and security of your own data back into your hands.
keywords:
+14
View File
@@ -82,6 +82,11 @@ The following table lists the configurable parameters of the nextcloud chart and
| `mariadb.db.password` | Password for the database | `changeme` |
| `mariadb.db.user` | Database user to create | `nextcloud` |
| `mariadb.rootUser.password` | MariaDB admin password | `nil` |
| `cronjob.enabled` | Whether to enable/disable cronjob | `false` |
| `cronjob.schedule` | Schedule for the CronJob | `*/15 * * * *` |
| `cronjob.annotations` | Annotations to add to the cronjob | {} |
| `cronjob.failedJobsHistoryLimit` | Specify the number of failed Jobs to keep | `5` |
| `cronjob.successfulJobsHistoryLimit`| Specify the number of completed Jobs to keep | `2` |
| `service.type` | Kubernetes Service type | `ClusterIp` |
| `service.loadBalancerIP` | LoadBalancerIp for service type LoadBalancer | `nil` |
| `persistence.enabled` | Enable persistence using PVC | `false` |
@@ -141,3 +146,12 @@ The [Nextcloud](https://hub.docker.com/_/nextcloud/) image stores the nextcloud
Persistent Volume Claims are used to keep the data across deployments. This is known to work in GCE, AWS, and minikube.
See the [Configuration](#configuration) section to enable persistence and configuration of the PVC.
## Cronjob
This chart can utilize Kubernetes `CronJob` resource to execute [background tasks](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/background_jobs_configuration.html).
To use this functionality, set `cronjob.enabled` parameter to `true` and switch background mode to Webcron in your nextcloud settings page.
See the [Configuration](#configuration) section for further configuration of the cronjob resource.
> **Note**: For the cronjobs to work correctly, ingress must be also enabled (set `ingress.enabled` to `true`) and `nextcloud.host` has to be publicly resolvable.
+61
View File
@@ -0,0 +1,61 @@
{{- if .Values.cronjob.enabled }}
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: {{ template "nextcloud.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
helm.sh/chart: {{ include "nextcloud.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
annotations:
{{ toYaml .Values.cronjob.annotations | indent 4 }}
spec:
schedule: "{{ .Values.cronjob.schedule }}"
concurrencyPolicy: Forbid
{{- with .Values.cronjob.failedJobsHistoryLimit }}
failedJobsHistoryLimit: {{ . }}
{{- end }}
{{- with .Values.cronjob.successfulJobsHistoryLimit }}
successfulJobsHistoryLimit: {{ . }}
{{- end }}
jobTemplate:
metadata:
labels:
app: {{ include "nextcloud.name" . }}
release: {{ .Release.Name }}
spec:
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
restartPolicy: Never
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: [ "curl" ]
args:
- "--fail"
{{- if .Values.ingress.tls }}
- "https://{{ .Values.nextcloud.host }}/cron.php"
{{- else }}
- "http://{{ .Values.nextcloud.host }}/cron.php"
{{- end }}
resources:
{{ toYaml .Values.resources | indent 16 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 12 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{ toYaml . | indent 12 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 12 }}:
{{- end }}
{{- end }}
+16 -2
View File
@@ -80,7 +80,6 @@ internalDatabase:
enabled: true
name: nextcloud
##
## External database configuration
##
@@ -119,12 +118,24 @@ mariadb:
accessMode: ReadWriteOnce
size: 8Gi
## Cronjob to execute Nextcloud background tasks
## ref: https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/background_jobs_configuration.html#cron-jobs
##
cronjob:
enabled: false
# Every 15 minutes
# Note: Setting this to any any other value than 15 minutes might
# cause issues with how nextcloud background jobs are executed
schedule: "*/15 * * * *"
annotations: {}
failedJobsHistoryLimit: 5
successfulJobsHistoryLimit: 2
service:
type: ClusterIP
port: 8080
loadBalancerIP: nil
## Enable persistence using Persistent Volume Claims
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
##
@@ -159,6 +170,9 @@ resources: {}
# cpu: 100m
# memory: 128Mi
## Liveness and readiness probe values
## Ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes
##
livenessProbe:
enabled: true
initialDelaySeconds: 30