Merge "[devstack] Replace healthz with readyz to check kubernetes"

This commit is contained in:
Zuul 2022-03-07 11:49:52 +00:00 committed by Gerrit Code Review
commit 3f66afa57f

View File

@ -1465,26 +1465,18 @@ function wait_for {
echo "" echo ""
} }
function _wait_for_ok_health { function _wait_for_ok_ready {
local name local name
local url
local start_time local start_time
local curr_time local curr_time
local time_diff local time_diff
local apiserver
local token
name="$1" name="$1"
timeout=${2:-$KURYR_WAIT_TIMEOUT} timeout=${2:-$KURYR_WAIT_TIMEOUT}
apiserver=$(get_k8s_apiserver)
token=$(get_k8s_token)
url="${apiserver}/healthz"
extra_flags=("-s" "--insecure" "--header" "Authorization: Bearer $token")
start_time=$(date +%s) start_time=$(date +%s)
echo -n "Waiting for ${name} to be healthy" echo -n "Waiting for ${name} to be ready"
until [[ "$(curl "${extra_flags[@]}" "$url")" == "ok" ]]; do until [[ "$(kubectl get --raw='/readyz')" == "ok" ]]; do
echo -n "." echo -n "."
curr_time=$(date +%s) curr_time=$(date +%s)
time_diff=$((curr_time - start_time)) time_diff=$((curr_time - start_time))
@ -1512,7 +1504,7 @@ function prepare_kubelet {
function run_kuryr_kubernetes { function run_kuryr_kubernetes {
local controller_bin local controller_bin
_wait_for_ok_health "kubernetes" 1200 _wait_for_ok_ready "kubernetes" 1200
controller_bin=$(which kuryr-k8s-controller) controller_bin=$(which kuryr-k8s-controller)
run_process kuryr-kubernetes "$controller_bin --config-file $KURYR_CONFIG" run_process kuryr-kubernetes "$controller_bin --config-file $KURYR_CONFIG"