Skip to content

Commit

Permalink
Merge pull request kosmos-io#835 from lyzuiui/dev-fix-hack-shell-scripts
Browse files Browse the repository at this point in the history
fix: Optimize e2e test scripts
  • Loading branch information
duanmengkk authored Feb 17, 2025
2 parents 87ef581 + 684b8e3 commit 6e9f40c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ upload-images: images
docker push ${REGISTRY}/clusterlink-floater:${VERSION}
docker push ${REGISTRY}/clusterlink-elector:${VERSION}
docker push ${REGISTRY}/clustertree-cluster-manager:${VERSION}
docker push ${REGISTRY}/virtual-cluster-operator:${VERSION}
docker push ${REGISTRY}/node-agent:${VERSION}
docker push ${REGISTRY}/scheduler:${VERSION}

.PHONY: release
Expand Down
4 changes: 2 additions & 2 deletions hack/cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ function create_cluster() {
docker exec ${clustername}-control-plane /bin/sh -c "cat /etc/kubernetes/admin.conf" | sed -e "s|${clustername}-control-plane|$dockerip|g" -e "/certificate-authority-data:/d" -e "5s/^/ insecure-skip-tls-verify: true\n/" -e "w ${CLUSTER_DIR}/kubeconfig-nodeIp"

kubectl --kubeconfig $CLUSTER_DIR/kubeconfig create -f "$CURRENT/calicooperator/tigera-operator.yaml" || $("${REUSE}" -eq "true")
kind export kubeconfig --name "$clustername"
util::wait_for_crd installations.operator.tigera.io
#kind export kubeconfig --name "$clustername"
util::wait_for_crd --kubeconfig $CLUSTER_DIR/kubeconfig installations.operator.tigera.io
kubectl --kubeconfig $CLUSTER_DIR/kubeconfig apply -f "${CLUSTER_DIR}"/calicoconfig
echo "create cluster ${clustername} success"
echo "wait all node ready"
Expand Down
16 changes: 15 additions & 1 deletion hack/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -514,11 +514,25 @@ function util::wait_for_crd() {
local crd_names=("$@")
local timeout=500
local count=0
local kubeconfig=""

while [[ $# -gt 0 ]]; do
case "$1" in
--kubeconfig)
kubeconfig="$2"
shift 2
;;
*)
crd_names+=("$1")
shift
;;
esac
done

local end=$((SECONDS+timeout))
while [ $SECONDS -lt $end ]; do
for crd_name in "${crd_names[@]}"; do
if kubectl get crd "$crd_name"; then
if kubectl ${kubeconfig:+--kubeconfig="$kubeconfig"} get crd "$crd_name" >/dev/null 2>&1; then
echo "CRD $crd_name has been stored successfully."
# delete crd from waiting list
count=$(($count+1))
Expand Down

0 comments on commit 6e9f40c

Please sign in to comment.