Merge "Remove sidecar containers after SIGTERM is send to stop them" into stable/train
This commit is contained in:
commit
c22a67f121
|
@ -36,8 +36,7 @@ CLI='echo noop'
|
|||
kill_container() {
|
||||
add_date "Stopping container $1 ($2)"
|
||||
$CLI stop $2
|
||||
add_date "Deleting container $1 ($2)"
|
||||
$CLI rm $2
|
||||
delete_container $1 $2
|
||||
}
|
||||
|
||||
signal_container() {
|
||||
|
@ -49,6 +48,12 @@ signal_container() {
|
|||
$CLI kill --signal $SIGNAL $2
|
||||
}
|
||||
|
||||
delete_container() {
|
||||
add_date "Deleting container $1 ($2)"
|
||||
$CLI rm $2 || echo "Deleting container $1 ($2) failed"
|
||||
}
|
||||
|
||||
|
||||
{% raw -%}
|
||||
if [ -f /proc/$PID/cgroup ]; then
|
||||
# Get container ID based on process cgroups
|
||||
|
@ -64,6 +69,7 @@ if [ -f /proc/$PID/cgroup ]; then
|
|||
;;
|
||||
15)
|
||||
signal_container $CT_NAME $CT_ID 15
|
||||
delete_container $CT_NAME $CT_ID
|
||||
;;
|
||||
*)
|
||||
add_date "Unknown action ${SIG} for ${CT_NAME} ${CT_ID}"
|
||||
|
|
Loading…
Reference in New Issue