Skip to content

Commit

Permalink
wait for at least 3 kube-apiserver instances
Browse files Browse the repository at this point in the history
  • Loading branch information
tkashem committed Dec 11, 2024
1 parent 78adb29 commit 19e98f9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions data/data/bootstrap/files/usr/local/bin/wait-for-ha-api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 )
Expand All @@ -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
}

0 comments on commit 19e98f9

Please sign in to comment.