Skip to content

Commit 8e030ab

Browse files
Merge pull request #67 from mage-ai/xiaoyou/cleanup-jobs
[xy] Add cleanup job to helm chart and bump version to 0.2.7
2 parents f03d00f + 374f585 commit 8e030ab

File tree

3 files changed

+50
-1
lines changed

3 files changed

+50
-1
lines changed

charts/mageai/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,4 @@ type: application
7676
# This is the chart version. This version number should be incremented each time you make changes
7777
# to the chart and its templates, including the app version.
7878
# Versions are expected to follow Semantic Versioning (https://semver.org/)
79-
version: 0.2.6
79+
version: 0.2.7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{{- if .Values.cleanupJob.enabled -}}
2+
apiVersion: batch/v1
3+
kind: CronJob
4+
metadata:
5+
name: {{ include "mageai.fullname" . }}-cleanup-job
6+
spec:
7+
schedule: "0 * * * *" # Runs every hour
8+
jobTemplate:
9+
spec:
10+
template:
11+
spec:
12+
containers:
13+
- name: mage-cleanup
14+
{{- if .Values.image.digest }}
15+
image: "{{ .Values.image.repository }}@{{ .Values.image.digest }}"
16+
{{- else }}
17+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
18+
{{- end }}
19+
command:
20+
- /bin/sh
21+
- -c
22+
- |
23+
repo_name="${USER_CODE_PATH:-default_repo}" &&
24+
mage clean-cached-variables "$repo_name" &&
25+
mage clean-old-logs "$repo_name"
26+
env:
27+
{{- if .Values.env }}
28+
{{- toYaml .Values.env | nindent 16 }}
29+
{{- else if .Values.extraEnvs }}
30+
{{- toYaml .Values.extraEnvs | nindent 16 }}
31+
{{- end }}
32+
volumeMounts:
33+
{{- if .Values.volumes }}
34+
- name: mage-fs
35+
mountPath: /home/src
36+
{{- else if .Values.extraVolumeMounts }}
37+
{{- toYaml .Values.extraVolumeMounts | nindent 16 }}
38+
{{- end }}
39+
restartPolicy: OnFailure
40+
volumes:
41+
{{- if .Values.volumes }}
42+
{{- toYaml .Values.volumes | nindent 12 }}
43+
{{- else if .Values.extraVolumes -}}
44+
{{ toYaml .Values.extraVolumes | nindent 12 }}
45+
{{- end }}
46+
{{- end }}

charts/mageai/values.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -209,3 +209,6 @@ extraEnvs:
209209
valueFrom:
210210
fieldRef:
211211
fieldPath: metadata.namespace
212+
213+
cleanupJob:
214+
enabled: false

0 commit comments

Comments
 (0)