Skip to content

Commit 3480ea2

Browse files
Post start hook
Detach deleted loop devices from previous worker instances. It should be done when the worker stops but it's not. Space isn't released, leading the node space to fill up quickly. This will always happen upon a worker crash or forcing a pod to terminate Signed-off-by: David Rozé <[email protected]>
1 parent a8d4d5f commit 3480ea2

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

templates/worker-configmap.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ metadata:
88
release: "{{ .Release.Name }}"
99
heritage: "{{ .Release.Service }}"
1010
data:
11+
post-start-hook.sh: |
12+
#!/bin/bash
13+
losetup -d $(losetup -a | grep "volumes\.img (deleted)" | cut -d: -f1)
14+
exit 0
1115
pre-stop-hook.sh: |
1216
#!/bin/bash
1317
while true; do

templates/worker-deployment.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ spec:
8181
{{ toYaml .Values.worker.readinessProbe | indent 12 }}
8282
{{- end }}
8383
lifecycle:
84+
postStart:
85+
exec:
86+
command:
87+
- "/bin/bash"
88+
- "/post-start-hook.sh"
8489
preStop:
8590
exec:
8691
command:
@@ -107,6 +112,9 @@ spec:
107112
- name: concourse-keys
108113
mountPath: {{ .Values.worker.keySecretsPath | quote }}
109114
readOnly: true
115+
- name: concourse-worker
116+
mountPath: /post-start-hook.sh
117+
subPath: post-start-hook.sh
110118
- name: concourse-worker
111119
mountPath: /pre-stop-hook.sh
112120
subPath: pre-stop-hook.sh

0 commit comments

Comments
 (0)