cronjob.yaml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. {{ $cronjob_values := (. | mustDeepCopy) }}
  2. {{ $_ := set $cronjob_values "common" (dict "nameSuffix" "cronjob") }}
  3. {{ $hostName := .Values.nextcloud.host }}
  4. {{ if .Values.useServiceNameForHost }}
  5. {{ $hostName = (include "common.names.fullname" .) }}
  6. {{ end }}
  7. {{if .Values.cronjob.enabled }}
  8. apiVersion: batch/v1
  9. kind: CronJob
  10. metadata:
  11. name: {{ template "common.names.fullname" $cronjob_values }}
  12. labels:
  13. app: {{ template "common.names.name" $cronjob_values }}
  14. chart: {{ template "common.names.chart" $cronjob_values }}
  15. release: {{ .Release.Name }}
  16. annotations:
  17. rollme: {{ randAlphaNum 5 | quote }}
  18. spec:
  19. schedule: "{{ .Values.cronjob.schedule }}"
  20. concurrencyPolicy: Forbid
  21. failedJobsHistoryLimit: 2
  22. successfulJobsHistoryLimit: 1
  23. jobTemplate:
  24. metadata:
  25. labels:
  26. app: {{ template "common.names.name" $cronjob_values }}
  27. release: {{ .Release.Name }}
  28. {{- include "common.labels.selectorLabels" $cronjob_values | nindent 8 }}
  29. spec:
  30. template:
  31. metadata:
  32. labels:
  33. app: {{ template "common.names.name" $cronjob_values }}
  34. release: {{ .Release.Name }}
  35. {{- include "common.labels.selectorLabels" $cronjob_values | nindent 12 }}
  36. spec:
  37. restartPolicy: Never
  38. securityContext:
  39. runAsUser: 33
  40. runAsGroup: 0
  41. fsGroup: 33
  42. containers:
  43. - name: {{ .Chart.Name }}-cronjob
  44. image: "{{.Values.image.repository }}:{{.Values.image.tag }}"
  45. imagePullPolicy: {{ .Values.image.pullPolicy }}
  46. command:
  47. - php
  48. - -f
  49. - /var/www/html/cron.php
  50. volumeMounts:
  51. - name: nextcloud-data
  52. mountPath: /var/www/
  53. subPath: "root"
  54. - name: nextcloud-data
  55. mountPath: /var/www/html
  56. subPath: "html"
  57. - name: nextcloud-data
  58. mountPath: {{ .Values.nextcloud.datadir }}
  59. subPath: "data"
  60. - name: nextcloud-data
  61. mountPath: /var/www/html/config
  62. subPath: "config"
  63. - name: nextcloud-data
  64. mountPath: /var/www/html/custom_apps
  65. subPath: "custom_apps"
  66. - name: nextcloud-data
  67. mountPath: /var/www/tmp
  68. subPath: "tmp"
  69. - name: nextcloud-data
  70. mountPath: /var/www/html/themes
  71. subPath: "themes"
  72. volumes:
  73. {{ if .Values.appVolumeMounts }}
  74. {{- include "common.storage.configureAppVolumes" .Values | nindent 12 }}
  75. {{ end }}
  76. {{ end }}