From 097d894dd8b3e90a9acdb4c82b2ff14bc7b2083d Mon Sep 17 00:00:00 2001 From: Nikhil Malik Date: Tue, 31 Oct 2023 14:43:17 +0900 Subject: [PATCH] Added missing scripts for K8s calico L3 CICD case --- cicd/k8s-calico-ipvs3/README | 8 +++ cicd/k8s-calico-ipvs3/host_validation.sh | 60 +++++++++++++++++++++ cicd/k8s-calico-ipvs3/node_scripts/host.sh | 2 +- cicd/k8s-calico-ipvs3/udp_client | Bin 0 -> 17192 bytes 4 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 cicd/k8s-calico-ipvs3/README create mode 100755 cicd/k8s-calico-ipvs3/host_validation.sh create mode 100755 cicd/k8s-calico-ipvs3/udp_client 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 0000000000000000000000000000000000000000..b70cd81fccd77645a3ecd1f5fc7944f3dc1b399a GIT binary patch literal 17192 zcmeHOZ)_aJ6`%9Pi9?dJLt`*WAq!0;r^pvOB&h)ze74V7BRh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