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: Add discovery cronjobs #7

Open
wants to merge 3 commits into
base: sdaia-dev
Choose a base branch
from
Open
Changes from 2 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
85 changes: 85 additions & 0 deletions tutordiscovery/patches/k8s-cronjobs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
# Refresh course metadata and index update with every 5 mins cron
apiVersion: batch/v1
kind: CronJob
metadata:
name: discovery-refresh-course-metadata-and-index
labels:
app.kubernetes.io/name: discovery-refresh-course-metadata-and-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-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

- 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-refresh-course-metadata
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