Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added K8s CronJob implementation #45

Merged
merged 7 commits into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion charts/owncloud/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ A major chart version change (like v1.2.3 -> v2.0.0) indicates that there is an
| owncloud.commentsManagerFactory | string | `""` | Define an alternative Comments Manager (see [documentation](https://doc.owncloud.com/server/latest/admin_manual/configuration/server/config_sample_php_parameters.html#define-an-alternative-comments-manager)). |
| owncloud.configExtra | object | `{}` | |
| owncloud.corsAllowedDomains | string | `""` | Define global list of CORS domains (see [documentation](https://doc.owncloud.com/server/latest/admin_manual/configuration/server/config_sample_php_parameters.html#define-global-list-of-cors-domains)). |
| owncloud.cronLog | string | `""` | Define logging if cron ran successfully(see [documentation](https://doc.owncloud.com/server/latest/admin_manual/configuration/server/config_sample_php_parameters.html#define-logging-if-cron-ran-successfully)) |
| owncloud.crondEnabled | string | `"true"` | Enable or disable the system cron service. Required for `.Values.owncloud.backgroundMode: "cron"`. |
| owncloud.crondSchedule | string | `"*/1 * * * *"` | Cron schedule to run ownCloud background jobs. |
| owncloud.csrfDisabled | string | `""` | Enable or disable ownCloud’s built-in CSRF protection mechanism (see [documentation](https://doc.owncloud.com/server/latest/admin_manual/configuration/server/config_sample_php_parameters.html#enable-or-disable-ownclouds-built-in-csrf-protection-mechanism)). |
Expand Down
56 changes: 56 additions & 0 deletions charts/owncloud/templates/cronjob.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{{- if .Values.owncloud.crondEnabled -}}
apiVersion: batch/v1
kind: CronJob
metadata:
name: {{ include "owncloud.fullname" . }}-cronjob
labels:
{{- include "owncloud.labels" . | nindent 4 }}
annotations:
ignore-check.kube-linter.io/run-as-non-root : "ownCloud does not support non-root containers"
ignore-check.kube-linter.io/no-read-only-root-fs : "ownCloud need to write /etc/environment on startup"
spec:
schedule: {{ .Values.owncloud.crondSchedule | quote }}
concurrencyPolicy: Forbid
jobTemplate:
spec:
parallelism: 1
backoffLimit: 0
template:
metadata:
annotations:
checksum/config: {{ print .Values.owncloud.configExtra | sha256sum }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 12 }}
{{- end }}
labels:
{{- include "owncloud.selectorLabels" . | nindent 12 }}
spec:
restartPolicy: Never
containers:
- name: {{ .Chart.Name }}-cronjob
securityContext:
{{- toYaml .Values.securityContext | nindent 14 }}
image: {{ template "owncloud.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
envFrom:
- configMapRef:
name: owncloud-env-config
command: ["/usr/bin/entrypoint", "/usr/bin/owncloud", "/usr/bin/cronjob"]
resources:
{{- toYaml .Values.resources | nindent 14 }}
volumeMounts:
- name: owncloud-data
mountPath: {{ .Values.owncloud.volume.root }}
- name: config-volume
mountPath: {{ .Values.owncloud.volume.config }}/configmap.config.php
subPath: configmap.config.php
volumes:
- name: owncloud-data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ include "owncloud.fullname" . }}
{{- end }}
- name: config-volume
secret:
secretName: owncloud-config
{{- end -}}
Loading