diff --git a/test/helper.sh b/test/helper.sh index 1a7fc92e5..0d9d88f2b 100755 --- a/test/helper.sh +++ b/test/helper.sh @@ -113,16 +113,19 @@ function install_kwokctl() { if cmd_exist kwokctl; then return 0 fi - wget "https://github.com/kubernetes-sigs/kwok/releases/download/v0.1.0/kwokctl-$(go env GOOS)-$(go env GOARCH)" -O "/usr/local/bin/kwokctl" && + wget "https://github.com/kubernetes-sigs/kwok/releases/download/v0.4.0/kwokctl-$(go env GOOS)-$(go env GOARCH)" -O "/usr/local/bin/kwokctl" && chmod +x "/usr/local/bin/kwokctl" } +CONTROL_PLANE_NAME="" + # create a control plane cluster and install the Clusterpedia function create_control_plane() { local name="${1}" local version="${2}" create_cluster "${name}" "${version}" install_clusterpedia + CONTROL_PLANE_NAME="${name}" } # delete the control plane cluster @@ -141,7 +144,7 @@ function create_data_plane() { install_kwokctl - KWOK_KUBE_VERSION="${version}" kwokctl create cluster --name "${name}" --quiet-pull + KWOK_KUBE_VERSION="${version}" kwokctl create cluster --name "${name}" --quiet-pull --wait 120s ip="$(host_docker_internal)" kubeconfig="$(kwokctl get kubeconfig --name="${name}" | sed "s#/127.0.0.1:#/${ip}:#" || :)" if [[ "${kubeconfig}" == "" ]]; then @@ -166,8 +169,7 @@ metadata: type: kwok-controller name: fake-node EOF - pedia_cluster="$(build_pedia_cluster "${name}" "${kubeconfig}")" - echo "${pedia_cluster}" | kubectl apply -f - + build_pedia_cluster "${name}" "${kubeconfig}" | kwokctl --name "${CONTROL_PLANE_NAME}" kubectl apply -f - } # delete the worker fake cluster