Fix cli failure
Signed-off-by: jwcesign <jiangwei115@huawei.com>
This commit is contained in:
parent
a14d64f055
commit
3ac3b4e5d7
|
@ -38,11 +38,16 @@ hack/create-cluster.sh ${MEMBER_CLUSTER_2_NAME} ${KUBECONFIG_PATH}/${MEMBER_CLUS
|
||||||
# wait cluster ready
|
# wait cluster ready
|
||||||
echo "Wait clusters ready..."
|
echo "Wait clusters ready..."
|
||||||
util::wait_file_exist ${KUBECONFIG_PATH}/${HOST_CLUSTER_NAME}.config 300
|
util::wait_file_exist ${KUBECONFIG_PATH}/${HOST_CLUSTER_NAME}.config 300
|
||||||
util::wait_file_exist ${KUBECONFIG_PATH}/${MEMBER_CLUSTER_1_NAME}.config 300
|
|
||||||
util::wait_file_exist ${KUBECONFIG_PATH}/${MEMBER_CLUSTER_2_NAME}.config 300
|
|
||||||
kubectl wait --for=condition=Ready nodes --all --timeout=800s --kubeconfig=${KUBECONFIG_PATH}/${HOST_CLUSTER_NAME}.config
|
kubectl wait --for=condition=Ready nodes --all --timeout=800s --kubeconfig=${KUBECONFIG_PATH}/${HOST_CLUSTER_NAME}.config
|
||||||
|
util::wait_nodes_taint_disappear 800 ${KUBECONFIG_PATH}/${HOST_CLUSTER_NAME}.config
|
||||||
|
|
||||||
|
util::wait_file_exist ${KUBECONFIG_PATH}/${MEMBER_CLUSTER_1_NAME}.config 300
|
||||||
kubectl wait --for=condition=Ready nodes --all --timeout=800s --kubeconfig=${KUBECONFIG_PATH}/${MEMBER_CLUSTER_1_NAME}.config
|
kubectl wait --for=condition=Ready nodes --all --timeout=800s --kubeconfig=${KUBECONFIG_PATH}/${MEMBER_CLUSTER_1_NAME}.config
|
||||||
|
util::wait_nodes_taint_disappear 800 ${KUBECONFIG_PATH}/${MEMBER_CLUSTER_1_NAME}.config
|
||||||
|
|
||||||
|
util::wait_file_exist ${KUBECONFIG_PATH}/${MEMBER_CLUSTER_2_NAME}.config 300
|
||||||
kubectl wait --for=condition=Ready nodes --all --timeout=800s --kubeconfig=${KUBECONFIG_PATH}/${MEMBER_CLUSTER_2_NAME}.config
|
kubectl wait --for=condition=Ready nodes --all --timeout=800s --kubeconfig=${KUBECONFIG_PATH}/${MEMBER_CLUSTER_2_NAME}.config
|
||||||
|
util::wait_nodes_taint_disappear 800 ${KUBECONFIG_PATH}/${MEMBER_CLUSTER_2_NAME}.config
|
||||||
|
|
||||||
# init Karmada control plane
|
# init Karmada control plane
|
||||||
echo "Start init karmada control plane..."
|
echo "Start init karmada control plane..."
|
||||||
|
|
22
hack/util.sh
22
hack/util.sh
|
@ -693,3 +693,25 @@ RUN echo -e http://mirrors.ustc.edu.cn/alpine/v3.17/main/ > /etc/apk/repositorie
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# util::wait_nodes_taint_disappear will wait for all the nodes' taint to disappear
|
||||||
|
# Parameters:
|
||||||
|
# - timeout: Timeout in seconds.
|
||||||
|
# - kubeconfig_path: The path of kubeconfig.
|
||||||
|
# Returns:
|
||||||
|
# 1 if the condition is not met before the timeout, else 0
|
||||||
|
function util::wait_nodes_taint_disappear() {
|
||||||
|
local timeout=${1}
|
||||||
|
local kubeconfig_path=${2}
|
||||||
|
|
||||||
|
timeout "${timeout}" bash <<EOF && return 0
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
taints=\$(kubectl get nodes --kubeconfig=${kubeconfig_path} -o=jsonpath="{.items[*].spec.taints}")
|
||||||
|
if [ -z \$taints ]; then
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
EOF
|
||||||
|
echo "Timeout for nodes' taint to disappear"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue