diff --git a/cicd/k8s-calico-ipvs3/README b/cicd/k8s-calico-ipvs3/README new file mode 100644 index 000000000..3b7d30181 --- /dev/null +++ b/cicd/k8s-calico-ipvs3/README @@ -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. diff --git a/cicd/k8s-calico-ipvs3/host_validation.sh b/cicd/k8s-calico-ipvs3/host_validation.sh new file mode 100755 index 000000000..4a3737540 --- /dev/null +++ b/cicd/k8s-calico-ipvs3/host_validation.sh @@ -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 diff --git a/cicd/k8s-calico-ipvs3/node_scripts/host.sh b/cicd/k8s-calico-ipvs3/node_scripts/host.sh index a552c006a..7e2726014 100755 --- a/cicd/k8s-calico-ipvs3/node_scripts/host.sh +++ b/cicd/k8s-calico-ipvs3/node_scripts/host.sh @@ -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" diff --git a/cicd/k8s-calico-ipvs3/udp_client b/cicd/k8s-calico-ipvs3/udp_client new file mode 100755 index 000000000..b70cd81fc Binary files /dev/null and b/cicd/k8s-calico-ipvs3/udp_client differ