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 <[email protected]>
  • Loading branch information
gran-vmv committed May 23, 2024
1 parent ee6fd52 commit f531d23
Showing 1 changed file with 28 additions and 26 deletions.
54 changes: 28 additions & 26 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 @@ -846,24 +846,26 @@ 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
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 +891,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 f531d23

Please sign in to comment.