diff --git a/README.md b/README.md index 9303aa93b59363b50498cac5afe5b7b83a6493f0..dc48a67d2e8b3e3af1d7caa007a38e21cb9b90a8 100644 --- a/README.md +++ b/README.md @@ -91,8 +91,9 @@ $ kubectl logs <pod> -c init-wordpress Helm will set up the kubernetes pods that are needed to run your website: 1. A WordPress pod that serves the site - - If you enabled `backup.enabled` or `wordpress.mu_cron.enabled`, this pod - will also contain a sidecar container that runs cron jobs. + - If you have `backup.enabled` or `wordpress.mu_cron.enabled`, or have a + non-empty `customCron`, this pod will also contain a sidecar container that + runs cron jobs. 2. Two MariaDB pods running the database (master-slave setup by default, unless you changed this in `values-local.yaml`) 3. If you configured Redis, a Redis pod is also set up diff --git a/templates/cron-schedule.yaml b/templates/cron-schedule.yaml index 88beda82664d5217100866ecb33060cfc14289e1..a9ab91aa4cf405813ebd94d99ae8937578714071 100644 --- a/templates/cron-schedule.yaml +++ b/templates/cron-schedule.yaml @@ -13,5 +13,8 @@ data: {{ .Values.wordpress.mu_cron.cronjob.schedule }} curl -s -w '%{http_code}' {{- if .Values.wordpress.mu_cron.cronjob.curlInsecure }} -k {{- end }} -L 'http://{{ include "wordpress.fullname" . }}:{{ .Values.service.port }}{{ .Values.wordpress.mu_cron.cronjob.path }}?doing_wp_cron&{{ required "Please set wordpress.mu_cron.secret to a random secret" .Values.wordpress.mu_cron.secret }}' {{- end }} {{- if .Values.backup.enabled }} - {{ .Values.backup.schedule }} cd /var/local/ansible && ansible-playbook backup.yml -e @secrets/secret-vars.yaml + {{ .Values.backup.schedule }} cd /var/local/ansible && ansible-playbook backup.yml -e @secrets/secret-vars.yaml +{{- end }} +{{- range .Values.customCron }} + {{ .schedule }} {{ .command }} {{- end }} diff --git a/templates/statefulset.yaml b/templates/statefulset.yaml index f2666d5562ed0c91852c297e0b47a87381c10bcc..ca2a9488e27a7080815f20b4ba6a10ba20582347 100644 --- a/templates/statefulset.yaml +++ b/templates/statefulset.yaml @@ -128,7 +128,7 @@ spec: subPath: .htaccess resources: {{ toYaml .Values.resources | indent 12 }} - {{- if or .Values.backup.enabled .Values.wordpress.mu_cron.enabled }} + {{- if or .Values.backup.enabled .Values.wordpress.mu_cron.enabled .Values.customCron }} - name: {{ .Chart.Name }}-cron image: "{{ .Values.initImage.repository }}:{{ .Values.initImage.tag }}" imagePullPolicy: {{ .Values.initImage.pullPolicy }} diff --git a/values-local.yaml.example b/values-local.yaml.example index 396de73e66dad6c8fbccf7b608ac9f500196dba3..51f827c12b8d39d115a7b68d9f3eb53fa7380fc6 100644 --- a/values-local.yaml.example +++ b/values-local.yaml.example @@ -180,6 +180,11 @@ redis: # # The cron schedule that determines when backups are made. # # Run at 3:37 every day. # schedule: "37 3 * * *" + +# customCron: +# - schedule: "5 * * * *" +# command: "echo test" + # It's advisable to set resource limits to prevent your K8s cluster from # crashing # resources: diff --git a/values.yaml b/values.yaml index 5acf023fc2997d5ae01e354ec94e7b97f4e3fe88..3c0943768bf9c097b32910f90e4fec0efe46e879 100644 --- a/values.yaml +++ b/values.yaml @@ -319,6 +319,8 @@ backup: schedule: "0 2 * * *" isDate: true +customCron: [] + wpSalts: {} # Some of the variables configured above are put into a variable here, that's