Skip to content

Commit 32f5667

Browse files
authored
Merge pull request #3226 from yuvipanda/scheduledjob
Run a cronJob every 30m to cleanup docker buildkit cache
2 parents 22b05b5 + 014e118 commit 32f5667

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{{ if .Values.buildkitPruner.enabled }}
2+
apiVersion: batch/v1
3+
kind: CronJob
4+
metadata:
5+
name: build-cache-prune
6+
spec:
7+
schedule: {{ .Values.buildkitPruner.schedule | quote }}
8+
# If the previous run is still going, replace it with our new one
9+
concurrencyPolicy: Replace
10+
jobTemplate:
11+
spec:
12+
template:
13+
spec:
14+
restartPolicy: OnFailure
15+
volumes:
16+
- name: dind-socket
17+
hostPath:
18+
path: /var/run/dind/docker.sock
19+
containers:
20+
- name: pruner
21+
image: {{ .Values.buildkitPruner.image }}
22+
env:
23+
- name: DOCKER_HOST
24+
value: "unix:///var/run/dind/docker.sock"
25+
command:
26+
- /bin/sh
27+
- -c
28+
- |
29+
docker builder prune --force --all --keep-storage={{ .Values.buildkitPruner.buildkitCacheSize }} && \
30+
docker system df
31+
volumeMounts:
32+
- name: dind-socket
33+
mountPath: /var/run/dind/docker.sock
34+
{{- end }}

mybinder/values.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# values ref: https://github.com/yuvipanda/cryptnono/blob/main/cryptnono/values.yaml
21
cryptnono:
32
enabled: true
43
detectors:
@@ -10,6 +9,14 @@ cryptnono:
109
containerdHostPath: /run/containerd/containerd.sock
1110
dockerHostPath: /run/dind/docker.sock
1211

12+
buildkitPruner:
13+
enabled: true
14+
# Use the same image as we use for dind
15+
image: docker:27.5.1-dind
16+
buildkitCacheSize: 300GB
17+
# Run this every 30min
18+
schedule: "*/30 * * * *"
19+
1320
registry:
1421
enabled: false
1522
replicas: 2

0 commit comments

Comments
 (0)