Improved drain script
@@ -443,10 +443,11 @@ func bpmProcessContainer(
container.Lifecycle.PreStop = &corev1.Handler{
Exec: &corev1.ExecAction{
Command: []string{
- "/usr/bin/dumb-init",
- "sh",
+ "/bin/sh",
"-c",
- `for s in $(ls ` + drainGlob + `); do
+ `
+shopt -s nullglob
+for s in ` + drainGlob + `; do
(
echo "Running drain script $s"
while true; do
@@ -471,7 +472,7 @@ func bpmProcessContainer(
done
)&
done
- echo "Waiting..."
+echo "Waiting for subprocesses to finish..."
wait
echo "Done"`,
},
