Parcourir la source

Merge pull request #8084 from vrutkovs/master-restart-container-stop

master-restart: wait for container to stop before proceeding
OpenShift Merge Robot il y a 7 ans
Parent
commit
38578d8dcb

+ 12 - 1
roles/openshift_control_plane/files/scripts/docker/master-restart

@@ -18,9 +18,20 @@ done
 # TODO: move to cri-ctl
 # TODO: short term hack for cri-o
 
+# Get a child container name to wait for it to stop
+child_container=$(docker ps -l -q --filter "label=io.kubernetes.container.name=${1}")
+
 container=$(docker ps -l -q --filter "label=openshift.io/component=${1}" --filter "label=io.kubernetes.container.name=POD")
 if [[ -z "${container}" ]]; then
   echo "Component ${1} is already stopped" 1>&2
   exit 0
 fi
-exec docker stop "${container}" --time 30 >/dev/null
+# Stop the pod
+docker stop "${container}" --time 30 >/dev/null
+
+# Wait for child container to change state
+if [[ -z "${child_container}" ]]; then
+  echo "Component ${1} is already stopped" 1>&2
+  exit 0
+fi
+exec timeout 60 docker wait $child_container