Browse Source

Implemented moodle cronjob

master
Fábio Kaiser Rauber 3 years ago
parent
commit
5a207494a5
  1. 80
      charts/saberes/v0.1.0/templates/moodle-cronjob.yaml
  2. 9
      charts/saberes/v0.1.0/values.yaml

80
charts/saberes/v0.1.0/templates/moodle-cronjob.yaml

@ -0,0 +1,80 @@
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: {{ include "saberes.fullname" . }}-moodlecron
labels:
{{- include "saberes.labels" . | nindent 4 }}
spec:
schedule: {{ .Values.moodle.cron.schedule | quote }}
concurrencyPolicy: Forbid
jobTemplate:
spec:
template:
metadata:
labels:
{{- include "saberes.labels" . | nindent 12 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 12 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 12 }}
containers:
- name: {{ .Release.Name }}-moodlecron
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- "/bin/bash"
- "-c"
args:
- "/usr/bin/php /var/www/html/admin/cli/cron.php"
env:
- name: MOODLE_DB_HOST
value: {{ .Values.moodle.dbHost | quote }}
- name: MOODLE_DB_NAME
value: {{ .Values.moodle.dbName | quote }}
- name: MOODLE_DB_PASS
value: {{ .Values.moodle.dbPass | quote }}
- name: MOODLE_DB_USER
value: {{ .Values.moodle.dbUser | quote }}
- name: MOODLE_REVERSEPROXY
value: {{ .Values.moodle.reverseProxy | quote }}
- name: MOODLE_SSLPROXY
value: {{ .Values.moodle.sslProxy | quote }}
- name: MOODLE_URL
{{- if .Values.ingress.tls.enabled }}
value: https://{{ .Values.ingress.hostname }}
{{- else -}}
value: http://{{ .Values.ingress.hostname }}
{{- end }}
- name: OSTICKET_API_KEY
value: {{ .Values.osticket.apiKey | quote }}
- name: OSTICKET_API_URL
value: {{ .Values.osticket.url | quote }}
volumeMounts:
- mountPath: /var/moodledata
name: moodledata
resources:
{{- toYaml .Values.moodle.cron.resources | nindent 16 }}
restartPolicy: OnFailure
volumes:
- name: moodledata
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ include "saberes.fullname" . }}-moodledata
{{- else }}
emptyDir: {}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 12 }}
{{- end }}

9
charts/saberes/v0.1.0/values.yaml

@ -36,6 +36,15 @@ moodle:
dbPass: apass
reverseProxy: 'false'
sslProxy: 'true'
cron:
schedule: "*/5 1 * * *" # Every 5 mins
resources:
limits:
cpu: 1000m
memory: 1Gi
requests:
cpu: 500m
memory: 400Mi
ingress:
enabled: true

Loading…
Cancel
Save