Various checks bugfixes

This commit is contained in:
Guillaume 2023-06-25 19:47:27 +02:00
parent 4877387140
commit a805e5d513

View File

@ -21,7 +21,7 @@ checkup() {
while :
do
pinfo "Checking availability of node $host..."
if true | sshcmd root@${hosts[$host]};
if true | sshcmd -q root@${hosts[$host]};
then
pinfo "VM $host is up!"
break
@ -39,7 +39,7 @@ checkup() {
start_control_plane() {
for host in ${!hosts[*]}; do
sshcmd root@${hosts[$host]} << EOF
sshcmd -q root@${hosts[$host]} << EOF
if ls /etc/kubernetes/manifests.static/* &>/dev/null ; then
mv /etc/kubernetes/manifests.static/* /var/lib/kubelet/manifests/
fi
@ -51,7 +51,6 @@ wait_for_apiserver() {
vip=$(extract_var clusters public_vip)
vip_api_port=$(extract_var clusters api_port)
sleep 20
while :
do
pinfo "Waiting for apiserver availability ($vip:$vip_api_port). Images may still being pulled... "
@ -59,7 +58,7 @@ wait_for_apiserver() {
pinfo "API is up!"
break
else
sleep 30
sleep 20
fi
done
@ -73,20 +72,20 @@ install_addons() {
}
approve_kubelet_certificates() {
tries=5
tries=10
nodes_num=$(kctl get node -oname|wc -l)
while [ "$nodes_num" != "${#hosts[*]}" ] ; do
pinfo "Waiting for certificates requests to be created by Kubelet when it's ready... ($tries/5)"
sleep 60s
while [ "$nodes_num" -lt "${#hosts[*]}" ] ; do
pinfo "Waiting for certificates requests to be created by Kubelet when it's ready... ($tries tries out of 10)"
sleep 20s
csrs="$(kctl get csr|awk '/Pending/ {print $1}')"
if [ "$csrs" != "" ]; then
kctl certificate approve $csrs
fi
((tries--))
if [ "$tries" -lt "1" ]; then
pinfo "Timeout waiting for kubelet certificates creation, please investigate why all nodes are not up by now"
break
perror "Timeout waiting for kubelet certificates creation, please investigate why all nodes are not up by now"
fi
nodes_num=$(kctl get node -oname|wc -l)
done
pinfo "All kubelets ($nodes_num) are up, enjoy !"
}
@ -100,8 +99,8 @@ unlock_store
declare -A hosts && get_hosts
checkup
start_control_plane
wait_for_apiserver
create_kubeconfig
wait_for_apiserver
install_addons
approve_kubelet_certificates # clients and serving certs