Skip to content

Commit

Permalink
Add a cluster precheck for tuneSysctlConfig
Browse files Browse the repository at this point in the history
Signed-off-by: cyclinder <qifeng.guo@daocloud.io>
  • Loading branch information
cyclinder committed Sep 6, 2024
1 parent c1fb610 commit be37c12
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,11 @@ endif
@ echo "wait for the cluster ready" ; \
TEST_IMAGE_NAME=$(TEST_IMAGE_NAME) \
RELEASE_NAMESPACE=$(RELEASE_NAMESPACE) \
E2E_IP_FAMILY=$(E2E_IP_FAMILY) \
MULTUS_DEFAULT_CNI_NAME=$(MULTUS_DEFAULT_CNI_VLAN0) \
E2E_CLUSTER_NAME=$(E2E_CLUSTER_NAME) \
INSTALL_OVERLAY_CNI=$(INSTALL_OVERLAY_CNI) \
scripts/installTestPod.sh $(E2E_KUBECONFIG)
scripts/preCheckClusterReady.sh $(E2E_KUBECONFIG)
@echo ""
@echo "-----------------------------------------------------------------------------------------------------"
@echo " ip family: $(E2E_IP_FAMILY)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,24 @@ CURRENT_DIR_PATH=$(cd $(dirname $0); pwd)
[ -z "$E2E_CLUSTER_NAME" ] && echo "error, miss E2E_CLUSTER_NAME " && exit 1
echo "$CURRENT_FILENAME : E2E_CLUSTER_NAME $E2E_CLUSTER_NAME "

[ -z "$E2E_IP_FAMILY" ] && echo "error, miss E2E_IP_FAMILY " && exit 1
echo "$CURRENT_FILENAME : E2E_IP_FAMILY $E2E_IP_FAMILY "

[ -z "$TEST_IMAGE_NAME" ] && echo "error, miss TEST_IMAGE_NAME" && exit 1
echo "$CURRENT_FILENAME : TEST_IMAGE_NAME $TEST_IMAGE_NAME "

echo "$CURRENT_FILENAME : E2E_KUBECONFIG $E2E_KUBECONFIG "
kind_nodes=$(kind get nodes --name ${E2E_CLUSTER_NAME})
[ -z "$kind_nodes" ] && echo "error, any kind nodes not found" && exit 1
for node in $kind_nodes; do
echo "preCheckClusterReady.sh: Check the sysctl config for the kind node: ${node}"
value=$(docker exec ${node} sysctl net.ipv4.conf.all.rp_filter | awk -F '=' '{print $2}' | tr -d ' ')
if [ "$value" != "0" ]; then
echo "error, net.ipv4.conf.all.rp_filter should be 0, but got $value"
exit 1
fi
echo "preCheckClusterReady.sh: sysctlConfig net.ipv4.conf.all.rp_filter for $node is expect $value"
done

docker pull ${TEST_IMAGE_NAME}
kind load docker-image ${TEST_IMAGE_NAME} --name $E2E_CLUSTER_NAME
Expand Down

0 comments on commit be37c12

Please sign in to comment.