Skip to content

Commit

Permalink
BFD Implementation - changes for cicd scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
TrekkieCoder committed Feb 7, 2024
1 parent 28bb937 commit 6ec3366
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 14 deletions.
6 changes: 1 addition & 5 deletions cicd/k3s-calico/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,6 @@ sleep 10
# Wait for cluster to be ready
wait_cluster_ready_full

# Start nginx pods and services for test
kubectl $KUBECONFIG apply -f nginx.yml
kubectl $KUBECONFIG apply -f nginx-svc-lb.yml

sleep 5

# Start nginx pods and services for test(using kube-loxilb)
Expand All @@ -179,7 +175,7 @@ sleep 30
kubectl $KUBECONFIG get svc

# Route back to user
sudo ip route add 1.1.1.1/32 via 12.12.12.1
sudo ip route add 1.1.1.1/32 via 14.14.14.1

# Wait for cluster to be ready
wait_cluster_ready_full
2 changes: 2 additions & 0 deletions cicd/k3s-calico/nginx-svc-lb1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: v1
kind: Service
metadata:
name: nginx-lb1
annotations:
loxilb.io/staticIP : "11.11.11.11"
spec:
externalTrafficPolicy: Local
loadBalancerClass: loxilb.io/loxilb
Expand Down
46 changes: 37 additions & 9 deletions cicd/k3s-calico/validation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ IFS=' '

for((i=0; i<120; i++))
do
extLB=$(sudo kubectl $KUBECONFIG get svc | grep "nginx-lb")
extLB=$(sudo kubectl $KUBECONFIG get svc | grep "nginx-lb1")
read -a strarr <<< "$extLB"
len=${#strarr[*]}
if [[ $((len)) -lt 6 ]]; then
Expand Down Expand Up @@ -60,14 +60,6 @@ print_debug_info() {
code=0
print_debug_info

out=$($hexec user curl -s --connect-timeout 10 http://$extIP:80)
if [[ ${out} == *"Welcome to nginx"* ]]; then
echo "calico-k3s (ccm) [OK]"
else
echo "calico-k3s (ccm) [FAILED]"
code=1
fi

out=$($hexec user curl -s --connect-timeout 10 http://$extIP:55002)

if [[ ${out} == *"Welcome to nginx"* ]]; then
Expand All @@ -77,6 +69,24 @@ else
code=1
fi

for((i=0; i<120; i++))
do
extLB=$(sudo kubectl $KUBECONFIG get svc | grep "udp-lb1")
read -a strarr <<< "$extLB"
len=${#strarr[*]}
if [[ $((len)) -lt 6 ]]; then
echo "Can't find nginx-lb service"
sleep 1
continue
fi
if [[ ${strarr[3]} != *"none"* ]]; then
extIP="$(cut -d'-' -f2 <<<${strarr[3]})"
break
fi
echo "No external LB allocated"
sleep 1
done

out=$($hexec user timeout 30 ../common/udp_client $extIP 55003)
if [[ ${out} == *"Client"* ]]; then
echo "calico-k3s (kube-loxillb) udp [OK]"
Expand All @@ -85,6 +95,24 @@ else
code=1
fi

for((i=0; i<120; i++))
do
extLB=$(sudo kubectl $KUBECONFIG get svc | grep "sctp-lb1")
read -a strarr <<< "$extLB"
len=${#strarr[*]}
if [[ $((len)) -lt 6 ]]; then
echo "Can't find nginx-lb service"
sleep 1
continue
fi
if [[ ${strarr[3]} != *"none"* ]]; then
extIP="$(cut -d'-' -f2 <<<${strarr[3]})"
break
fi
echo "No external LB allocated"
sleep 1
done

out=$($hexec user timeout 30 ../common/sctp_socat_client 1.1.1.1 41291 $extIP 55004)
if [[ ${out} == *"server1"* ]]; then
echo "calico-k3s (kube-loxillb) sctp [OK]"
Expand Down

0 comments on commit 6ec3366

Please sign in to comment.