diff --git a/tutordiscovery/patches/k8s-cronjobs b/tutordiscovery/patches/k8s-cronjobs new file mode 100644 index 0000000..ffff3e9 --- /dev/null +++ b/tutordiscovery/patches/k8s-cronjobs @@ -0,0 +1,109 @@ +--- +# Refresh course metadata and index update with every 5 mins cron +apiVersion: batch/v1 +kind: CronJob +metadata: + name: discovery-refresh-course-metadata + labels: + app.kubernetes.io/name: discovery-refresh-course-metadata + app.kubernetes.io/component: cronjob +spec: + # Cron of every 10 mins + schedule: "*/10 * * * *" + jobTemplate: + spec: + template: + metadata: + labels: + app: discovery-cronjobs + spec: + containers: + - name: discovery-cronjobs-refresh-course-metadata + image: {{ DISCOVERY_DOCKER_IMAGE }} + imagePullPolicy: IfNotPresent + command: + - /bin/sh + - -c + - /openedx/discovery/manage.py refresh_course_metadata --partner_code=openedx + volumeMounts: + - mountPath: /openedx/discovery/course_discovery/settings/tutor/production.py + name: settings + subPath: production.py + volumes: + - name: settings + configMap: + name: discovery-settings + restartPolicy: OnFailure + +--- +apiVersion: batch/v1 +kind: CronJob +metadata: + name: discovery-update-index + labels: + app.kubernetes.io/name: discovery-update-index + app.kubernetes.io/component: cronjob +spec: + # Cron of every 10 mins + schedule: "10 * * * *" + jobTemplate: + spec: + template: + metadata: + labels: + app: discovery-cronjobs + spec: + containers: + - name: discovery-cronjobs-update-index + image: {{ DISCOVERY_DOCKER_IMAGE }} + imagePullPolicy: IfNotPresent + command: + - /bin/sh + - -c + - /openedx/discovery/manage.py update_index --disable-change-limit + volumeMounts: + - mountPath: /openedx/discovery/course_discovery/settings/tutor/production.py + name: settings + subPath: production.py + volumes: + - name: settings + configMap: + name: discovery-settings + restartPolicy: OnFailure + +--- +# Remove unused indexes +apiVersion: batch/v1 +kind: CronJob +metadata: + name: discovery-remove-unuses-indexes + labels: + app.kubernetes.io/name: discovery-remove-unuses-indexes + app.kubernetes.io/component: cronjob +spec: + # Cron of every day + schedule: "0 1 * * *" + jobTemplate: + spec: + template: + metadata: + labels: + app: discovery-cronjobs + spec: + containers: + - name: discovery-cronjobs-remove-unuses-indexes + image: {{ DISCOVERY_DOCKER_IMAGE }} + imagePullPolicy: IfNotPresent + command: + - /bin/sh + - -c + - /openedx/discovery/manage.py remove_unused_indexes + volumeMounts: + - mountPath: /openedx/discovery/course_discovery/settings/tutor/production.py + name: settings + subPath: production.py + volumes: + - name: settings + configMap: + name: discovery-settings + restartPolicy: OnFailure