From 19e98f936550d788718487c70da21a0c16d7e9c4 Mon Sep 17 00:00:00 2001 From: Abu Kashem Date: Tue, 10 Dec 2024 14:19:32 -0500 Subject: [PATCH] wait for at least 3 kube-apiserver instances --- .../bootstrap/files/usr/local/bin/wait-for-ha-api.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/data/data/bootstrap/files/usr/local/bin/wait-for-ha-api.sh b/data/data/bootstrap/files/usr/local/bin/wait-for-ha-api.sh index cdc69955eb7..d20fb327d25 100755 --- a/data/data/bootstrap/files/usr/local/bin/wait-for-ha-api.sh +++ b/data/data/bootstrap/files/usr/local/bin/wait-for-ha-api.sh @@ -20,7 +20,7 @@ wait_for_ha_api() { sleep 5 done - echo "Waiting for at least 2 available IP addresses for the default/kubernetes service" + echo "Waiting for at least 3 available IP addresses for the default/kubernetes service" while ! is_api_available do sleep 5 @@ -57,8 +57,9 @@ is_topology_ha() { ## ## for HA cluster, we mark the bootstrap process as complete when there -## are at least two IP addresses available to the endpoints +## are at least three IP addresses available to the endpoints ## of the default/kubernetes service object. +## NOTE: the IP address of the bootstrap instance is included in the endpoints ## TODO: move this to kas operator as a subcommand of the render command is_api_available() { output=$(oc --kubeconfig="$KUBECONFIG" get endpoints kubernetes --namespace=default -o jsonpath='{range @.subsets[*]}{range @.addresses[*]}{.ip}{" "}' 2>&1 ) @@ -73,11 +74,11 @@ is_api_available() { echo "Got the following addresses for the default/kubernetes endpoint object: $output" count=$(echo "$output" | wc -w) - if [[ ! $count -gt 1 ]] + if [[ ! $count -gt 2 ]] then return 1 fi - echo "Got at least 2 available addresses for the default/kubernetes service" + echo "Got at least 3 available addresses for the default/kubernetes service" return 0 }