Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e2e: fix openkruise installtion and debug ovs installtion #4423

Merged
merged 1 commit into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -323,15 +323,18 @@ e2e_init_underlay:

.PHONY: e2e_init_cilium_with_ebpf
e2e_init_cilium_with_ebpf:
$(QUIET) make e2e_init -e INSTALL_OVERLAY_CNI=true -e INSTALL_CALICO=false -e INSTALL_CILIUM=true DISABLE_KUBE_PROXY=true -e E2E_SPIDERPOOL_ENABLE_SUBNET=false
$(QUIET) make e2e_init -e INSTALL_OVERLAY_CNI=true -e INSTALL_CALICO=false -e INSTALL_CILIUM=true DISABLE_KUBE_PROXY=true \
-e E2E_SPIDERPOOL_ENABLE_SUBNET=false

.PHONY: e2e_init_calico
e2e_init_calico:
$(QUIET) make e2e_init -e INSTALL_OVERLAY_CNI=true -e INSTALL_CALICO=true -e INSTALL_CILIUM=false -e E2E_SPIDERPOOL_ENABLE_SUBNET=false
$(QUIET) make e2e_init -e INSTALL_OVERLAY_CNI=true -e INSTALL_CALICO=true -e INSTALL_CILIUM=false \
-e E2E_SPIDERPOOL_ENABLE_SUBNET=false

.PHONY: e2e_init_cilium
e2e_init_cilium:
$(QUIET) make e2e_init -e INSTALL_OVERLAY_CNI=true -e INSTALL_CALICO=false -e INSTALL_CILIUM=true -e E2E_SPIDERPOOL_ENABLE_SUBNET=false
$(QUIET) make e2e_init -e INSTALL_OVERLAY_CNI=true -e INSTALL_CALICO=false -e INSTALL_CILIUM=true \
-e E2E_SPIDERPOOL_ENABLE_SUBNET=false


.PHONY: e2e_test
Expand Down
6 changes: 5 additions & 1 deletion test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,11 @@ setup_kurise:
docker pull $${IMAGE} ; \
kind load docker-image $${IMAGE} --name $(E2E_CLUSTER_NAME); \
done; \
helm upgrade --install kruise openkruise/kruise --wait --timeout 20m --debug --set manager.image.repository=$(E2E_OPENKRUISE_IMAGE) \
HELM_OPTION=" --wait --timeout 20m --debug --set manager.image.repository=$(E2E_OPENKRUISE_IMAGE) " ; \
# openkruise failed to run with 1.7.3, see
# https://github.com/spidernet-io/spiderpool/issues/4396
HELM_OPTION+=" --version $(E2E_OPENKRUISE_VERSION) " ; \
helm upgrade --install kruise openkruise/kruise $${HELM_OPTION} \
--kubeconfig $(E2E_KUBECONFIG) || { KIND_CLUSTER_NAME=$(E2E_CLUSTER_NAME) ./scripts/debugEnv.sh $(E2E_KUBECONFIG) "detail" "$(E2E_LOG_FILE)" ; exit 1 ; } ; \

.PHONY: setup_spiderpool
Expand Down
4 changes: 3 additions & 1 deletion test/Makefile.defs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ http_proxy ?=
E2E_LOG_FILE ?= $(ROOT_DIR)/test/e2edebugLog.txt

#========= openkruise =========

# openkruise failed to run with 1.7.3, see
# https://github.com/spidernet-io/spiderpool/issues/4396
E2E_OPENKRUISE_VERSION := 1.7.2
ifeq ($(E2E_CHINA_IMAGE_REGISTRY),true)
E2E_OPENKRUISE_IMAGE ?= docker.m.daocloud.io/openkruise/kruise-manager
else
Expand Down
32 changes: 19 additions & 13 deletions test/scripts/install-ovs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

set -o errexit -o nounset -o pipefail

CURRENT_FILENAME=$( basename $0 )
CURRENT_FILENAME=$(basename $0)

[ -z "${HTTP_PROXY}" ] || export https_proxy=${HTTP_PROXY}

Expand All @@ -25,7 +25,10 @@ echo "$CURRENT_FILENAME : HOST_ADDITIONAL_INTERFACE $HOST_ADDITIONAL_INTERFACE "
echo "try to add secondary network nic for ovs bridge preparation"
if ! docker network ls | grep -q "${DOCKER_ADDITIONAL_NETWORK}"; then
echo "Docker network ${DOCKER_ADDITIONAL_NETWORK} does not exist, creating it..."
docker network create ${DOCKER_ADDITIONAL_NETWORK} --driver bridge || { echo "Failed to create Docker network"; exit 1; }
docker network create ${DOCKER_ADDITIONAL_NETWORK} --driver bridge || {
echo "Failed to create Docker network"
exit 1
}
else
echo "Docker network ${DOCKER_ADDITIONAL_NETWORK} already exists."
fi
Expand Down Expand Up @@ -53,17 +56,16 @@ elif [ ${E2E_IP_FAMILY} == "dual" ]; then
docker exec ${VLAN_GATEWAY_CONTAINER} ip addr add fd00:172:30::1/64 dev ${HOST_ADDITIONAL_INTERFACE}.${VLAN30}
docker exec ${VLAN_GATEWAY_CONTAINER} ip addr add fd00:172:40::1/64 dev ${HOST_ADDITIONAL_INTERFACE}.${VLAN40}
else
echo "error ip family, the value of IP_FAMILY must be of ipv4,ipv6 or dual." && exit 1
echo "error ip family, the value of IP_FAMILY must be of ipv4,ipv6 or dual." && exit 1
fi

echo -e "\033[35m Succeed to create vlan interface: ${HOST_ADDITIONAL_INTERFACE}.${VLAN30}、 ${HOST_ADDITIONAL_INTERFACE}.${VLAN40} in kind-node ${VLAN_GATEWAY_CONTAINER} \033[0m"


# https://github.com/antrea-io/antrea/issues/51
# fix: it possibley fails to insmod openvswitch.ko in the container in some OS version
# so it could load the ko in the host os in advance to make sure the ovs service could be started in the container
echo "=========install openvswitch in host os"
sudo apt-get update
sudo apt-get update
sudo apt-get install -y openvswitch-switch
sudo modinfo openvswitch
sudo systemctl start openvswitch-switch || true
Expand All @@ -78,32 +80,37 @@ for NODE in $KIND_NODES; do
install_openvswitch() {
for attempt in {1..5}; do
echo "Attempt $attempt to install openvswitch on ${NODE}..."
if ! docker exec ${NODE} apt-get update ; then
if ! docker exec ${NODE} apt-get update; then
echo "Failed to update package list on ${NODE}, retrying in 10s..."
sleep 10
continue
fi
if ! docker exec ${NODE} apt-get install -y openvswitch-switch ; then

if ! docker exec ${NODE} apt-get install -y openvswitch-switch; then
echo "Failed to install openvswitch on ${NODE}, retrying in 10s..."
sleep 10
continue
fi

echo "Succeed to install openvswitch on ${NODE}"
return 0
done

echo "Error: Failed to install openvswitch on ${NODE} after 5 attempts." >&2
return 1
}

echo "=========install openvswitch"
install_openvswitch

echo "start ovs service and add bridge"
{ docker exec ${NODE} systemctl start openvswitch-switch ; } \
|| { docker exec ${NODE} journalctl -xe ; docker exec ${NODE} systemctl status openvswitch-switch ; docker exec ${NODE} journalctl -u openvswitch-switch ; exit 1 ; }
{ docker exec ${NODE} systemctl start openvswitch-switch; } ||
{
docker exec ${NODE} journalctl -xe
docker exec ${NODE} systemctl status openvswitch-switch
docker exec ${NODE} journalctl -u openvswitch-switch
exit 1
}

docker exec ${NODE} ovs-vsctl add-br ${BRIDGE_INTERFACE}
docker exec ${NODE} ovs-vsctl add-port ${BRIDGE_INTERFACE} ${HOST_ADDITIONAL_INTERFACE}
Expand Down Expand Up @@ -139,4 +146,3 @@ for NODE in $KIND_NODES; do
done

echo -e "\033[35m Succeed to install openvswitch \033[0m"

Loading