kata-deploy: Ensure node is ready after CRI Engine restart

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 <fabiano.fidencio@intel.com>
This commit is contained in:
Fabiano Fidêncio 2023-04-12 15:39:49 +02:00
parent 5ec9ae0f04
commit 3b76abb366

View File

@ -63,6 +63,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
@ -76,6 +85,8 @@ function configure_cri_runtime() {
esac
systemctl daemon-reload
systemctl restart "$1"
wait_till_node_is_ready
}
function configure_different_shims_base() {
@ -266,6 +277,8 @@ function reset_runtime() {
if [ "$1" == "crio" ] || [ "$1" == "containerd" ]; then
systemctl restart kubelet
fi
wait_till_node_is_ready
}
function main() {