From d39aeff8a980afeecd9db60b6a650227004419a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Wed, 12 Apr 2023 15:39:49 +0200 Subject: [PATCH] kata-deploy: Ensure node is ready after CRI Engine restart MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Let's ensure the node is ready after the CRI Engine restart, otherwise we may proceed and scripts may simply fail if they try to deploy a pod while the CRI Engine is not yet restarted (and, consequently, the node is not Ready). Related: #6649 Signed-off-by: Fabiano FidĂȘncio (cherry picked from commit 3b76abb3664980b83b134b490f5ce200af09e49d) --- tools/packaging/kata-deploy/scripts/kata-deploy.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tools/packaging/kata-deploy/scripts/kata-deploy.sh b/tools/packaging/kata-deploy/scripts/kata-deploy.sh index e4e48732b..4a12c3090 100755 --- a/tools/packaging/kata-deploy/scripts/kata-deploy.sh +++ b/tools/packaging/kata-deploy/scripts/kata-deploy.sh @@ -62,6 +62,15 @@ function install_artifacts() { chmod +x /opt/kata/runtime-rs/bin/* } +function wait_till_node_is_ready() { + local ready="False" + + while ! [[ "${ready}" == "True" ]]; do + sleep 2s + ready=$(kubectl get node $NODE_NAME -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}') + done +} + function configure_cri_runtime() { configure_different_shims_base @@ -75,6 +84,8 @@ function configure_cri_runtime() { esac systemctl daemon-reload systemctl restart "$1" + + wait_till_node_is_ready } function configure_different_shims_base() { @@ -265,6 +276,8 @@ function reset_runtime() { if [ "$1" == "crio" ] || [ "$1" == "containerd" ]; then systemctl restart kubelet fi + + wait_till_node_is_ready } function main() {