Skip to content

Commit

Permalink
Added missing scripts for K8s calico L3 CICD case
Browse files Browse the repository at this point in the history
  • Loading branch information
nik-netlox committed Oct 31, 2023
1 parent 86ba4a5 commit 097d894
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 1 deletion.
8 changes: 8 additions & 0 deletions cicd/k8s-calico-ipvs3/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Test Case Description

This scenario will have K8s(1 Master Nodes & 2 Worker Nodes) cluster with Calico CNI in ipvs mode. LoxiLB will be running as external Service LB. Workloads will be spawned in all the cluster nodes.

Client will be connected to the LoxiLB with L3 network. Client and LoxiLB will run BGP peering. LoxiLB will advertise the Service CIDR or VirtualIP to the client.
Service CIDR will also be a Virtual IP, different from the K8s cluster network.

In scenarios where LoxiLB runs outside of the cluster, it is advised to create LB services in either one-arm or fullnat mode for ease of connectivity or else user has to resolve connectivity with either static routes or through BGP.
60 changes: 60 additions & 0 deletions cicd/k8s-calico-ipvs3/host_validation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash
extIP=$(cat /vagrant/extIP)

mode="onearm"
tcp_port=56002
udp_port=56003
sctp_port=56004

code=0
echo Service IP: $extIP

numECMP=$(ip route list match $extIP | grep $extIP -A 2 | tail -n 2 | wc -l)

ip route list match $extIP | grep $extIP -A 2

if [ $numECMP == "2" ]; then
echo "Host ECMP route [OK]"
else
echo "Host ECMP route [NOK]"
fi
echo -e "\n*********************************************"
echo "Testing Service"
echo "*********************************************"
for((i=0;i<20;i++))
do

out=$(curl -s --connect-timeout 10 http://$extIP:$tcp_port)
if [[ ${out} == *"Welcome to nginx"* ]]; then
echo -e "K8s-calico-ipvs3 TCP\t($mode)\t[OK]"
else
echo -e "K8s-calico-ipvs3 TCP\t($mode)\t[FAILED]"
code=1
fi

out=$(timeout 5 /vagrant/udp_client $extIP $udp_port)
if [[ ${out} == *"Client"* ]]; then
echo -e "K8s-calico-ipvs3 UDP\t($mode)\t[OK]"
else
echo -e "K8s-calico-ipvs3 UDP\t($mode)\t[FAILED]"
code=1
fi

sctp_darn -H 192.168.80.9 -h 20.20.20.1 -p 56004 -s < /vagrant/input > output
#sleep 2
exp="New connection, peer addresses
20.20.20.1:56004"

res=`cat output | grep -A 1 "New connection, peer addresses"`
sudo rm -rf output
if [[ "$res" == "$exp" ]]; then
#echo $res
echo -e "K8s-calico-ipvs3 SCTP\t($mode)\t[OK]"
else
echo -e "K8s-calico-ipvs3 SCTP\t($mode)\t[FAILED]"
code=1
fi


done
exit $code
2 changes: 1 addition & 1 deletion cicd/k8s-calico-ipvs3/node_scripts/host.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ if [ ! -f /var/log/bird.log ]; then
sudo touch /var/log/bird.log
fi
sudo chown bird:bird /var/log/bird.log
sudo service bird start
sudo service bird restart

echo "Host is up"
Binary file added cicd/k8s-calico-ipvs3/udp_client
Binary file not shown.

0 comments on commit 097d894

Please sign in to comment.