Skip to content

Commit

Permalink
[ci] Fix flexible-ipam e2e config
Browse files Browse the repository at this point in the history
Use k8s version 1.30.1-1.1.
Supress clean up error when initialize e2e.
Enhance redeploy k8s determination logic.

Signed-off-by: gran <gran@vmware.com>
  • Loading branch information
gran-vmv committed May 23, 2024
1 parent ee6fd52 commit e40a45b
Showing 1 changed file with 30 additions and 27 deletions.
57 changes: 30 additions & 27 deletions ci/jenkins/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ IMAGE_PULL_POLICY="Always"
PROXY_ALL=false
DEFAULT_IP_MODE="ipv4"
IP_MODE=""
K8S_VERSION="1.28.2-00"
K8S_VERSION="1.30.1-1.1"
WINDOWS_YAML_NAME="antrea-windows"
WIN_IMAGE_NODE=""
echo "" > WIN_DHCP
Expand Down Expand Up @@ -169,15 +169,15 @@ function export_govc_env_var {

function clean_antrea {
echo "====== Cleanup Antrea Installation ======"
clean_ns "monitoring"
clean_ns "antrea-ipam-test"
clean_ns "antrea-test"
clean_ns "monitoring" || true
clean_ns "antrea-ipam-test" || true
clean_ns "antrea-test" || true
echo "====== Cleanup Conformance Namespaces ======"
clean_ns "net"
clean_ns "service"
clean_ns "x-"
clean_ns "y-"
clean_ns "z-"
clean_ns "net" || true
clean_ns "service" || true
clean_ns "x-" || true
clean_ns "y-" || true
clean_ns "z-" || true

# Delete antrea-prometheus first for k8s>=1.22 to avoid Pod stuck in Terminating state.
kubectl delete -f ${WORKDIR}/antrea-prometheus.yml --ignore-not-found=true || true
Expand Down Expand Up @@ -655,7 +655,7 @@ function run_e2e {
# HACK: see https://github.com/antrea-io/antrea/issues/2292
go mod edit -replace github.com/moby/spdystream=github.com/antoninbas/spdystream@v0.2.1 && go mod tidy
if [[ $TESTBED_TYPE == "flexible-ipam" ]]; then
go test -v antrea.io/antrea/test/e2e --logs-export-dir `pwd`/antrea-test-logs --provider remote -timeout=100m --prometheus --antrea-ipam
go test -v -run=TestAntreaIPAM antrea.io/antrea/test/e2e --logs-export-dir `pwd`/antrea-test-logs --provider remote -timeout=100m --prometheus --antrea-ipam
elif [[ $TESTBED_TYPE == "kind" ]]; then
go test -v antrea.io/antrea/test/e2e --logs-export-dir `pwd`/antrea-test-logs --provider kind -timeout=100m --prometheus
else
Expand Down Expand Up @@ -846,24 +846,27 @@ function redeploy_k8s_if_ip_mode_changes() {
HAS_IPV6=${INITIAL_VALUE}
POD_CIDRS=($( (kubectl get node ${CONTROL_PLANE_HOSTNAME} -o json | jq -r '.spec.podCIDRs | @sh') | tr -d \'\")) || true
echo "POD_CIDRS=${POD_CIDRS[*]}"
for POD_CIDR in "${POD_CIDRS[@]}"; do
if [[ $POD_CIDR =~ .*:.* ]]
then
(( HAS_IPV6++ ))
if [[ -n $POD_CIDRS ]]; then
for POD_CIDR in "${POD_CIDRS[@]}"; do
if [[ $POD_CIDR =~ .*:.* ]]
then
(( HAS_IPV6++ ))
else
(( HAS_IPV4++ ))
fi
done
if [[ ${IP_MODE} == "ipv4" ]]; then
(( HAS_IPV4-- ))
elif [[ ${IP_MODE} == "ipv6" ]]; then
(( HAS_IPV6-- ))
else
(( HAS_IPV4++ ))
(( HAS_IPV4-- ))
(( HAS_IPV6-- ))
fi
if [ ${HAS_IPV4} -eq ${INITIAL_VALUE} ] && [ ${HAS_IPV6} -eq ${INITIAL_VALUE} ]; then
#return 0
echo "pass"
fi
done
if [[ ${IP_MODE} == "ipv4" ]]; then
(( HAS_IPV4-- ))
elif [[ ${IP_MODE} == "ipv6" ]]; then
(( HAS_IPV6-- ))
else
(( HAS_IPV4-- ))
(( HAS_IPV6-- ))
fi
if [ ${HAS_IPV4} -eq ${INITIAL_VALUE} ] && [ ${HAS_IPV6} -eq ${INITIAL_VALUE} ]; then
return 0
fi

echo "===== Reset K8s cluster Nodes ====="
Expand All @@ -889,7 +892,7 @@ function redeploy_k8s_if_ip_mode_changes() {
else
NODE_IP_STRING="${IPV4S[i]},${IPV6S[i]}"
fi
ssh -o StrictHostKeyChecking=no -i "${WORKDIR}/id_rsa" -n ubuntu@${IPV4S[i]} "echo \"KUBELET_EXTRA_ARGS=--node-ip=${NODE_IP_STRING}\" | sudo tee /etc/default/kubelet; sudo systemctl restart kubelet"
ssh -o StrictHostKeyChecking=no -i "${WORKDIR}/id_rsa" -n ubuntu@${IPV4S[i]} "echo \"KUBELET_EXTRA_ARGS=--node-ip=${NODE_IP_STRING}\" | sudo tee /etc/default/kubelet; sudo systemctl unmask kubelet; sudo systemctl restart kubelet"
done

echo "===== Set up K8s cluster ====="
Expand Down

0 comments on commit e40a45b

Please sign in to comment.