diff --git a/stable/nextcloud/Chart.yaml b/stable/nextcloud/Chart.yaml index e763c5b4b0..1b262a93e2 100644 --- a/stable/nextcloud/Chart.yaml +++ b/stable/nextcloud/Chart.yaml @@ -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: diff --git a/stable/nextcloud/README.md b/stable/nextcloud/README.md index 0ed12bda3d..ca6d7a1260 100644 --- a/stable/nextcloud/README.md +++ b/stable/nextcloud/README.md @@ -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. diff --git a/stable/nextcloud/templates/cronjob.yaml b/stable/nextcloud/templates/cronjob.yaml new file mode 100644 index 0000000000..6f5c85bd01 --- /dev/null +++ b/stable/nextcloud/templates/cronjob.yaml @@ -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 }} diff --git a/stable/nextcloud/values.yaml b/stable/nextcloud/values.yaml index d759a4b84a..0698162a27 100644 --- a/stable/nextcloud/values.yaml +++ b/stable/nextcloud/values.yaml @@ -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