Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BFD Implementation - changes for cicd scripts #521

Merged
merged 1 commit into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 8 additions & 4 deletions cicd/k3s-flannel/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ echo "#########################################"
echo "Spawning all hosts"
echo "#########################################"

spawn_docker_host --dock-type loxilb --dock-name llb1 --with-bgp yes --bgp-config $(pwd)/llb1_gobgp_config --with-ka in --ka-config $(pwd)/keepalived_config1
spawn_docker_host --dock-type loxilb --dock-name llb2 --with-bgp yes --bgp-config $(pwd)/llb2_gobgp_config --with-ka in --ka-config $(pwd)/keepalived_config2
spawn_docker_host --dock-type loxilb --dock-name llb1 --with-bgp yes --bgp-config $(pwd)/llb1_gobgp_config --with-ka in
spawn_docker_host --dock-type loxilb --dock-name llb2 --with-bgp yes --bgp-config $(pwd)/llb2_gobgp_config --with-ka in
spawn_docker_host --dock-type host --dock-name ep1
spawn_docker_host --dock-type host --dock-name ep2
spawn_docker_host --dock-type host --dock-name ep3
Expand Down Expand Up @@ -98,6 +98,10 @@ $hexec r1 ip route add 20.20.20.1/32 via 11.11.11.11
#add_route llb1 1.1.1.0/24 11.11.11.254
#add_route llb2 1.1.1.0/24 11.11.11.254

## host network
sudo ip route add 11.11.11.11/32 via 14.14.14.1
sudo ip route add 123.123.123.1/32 via 14.14.14.1

sleep 1
##Create LB rule
create_lb_rule llb1 20.20.20.1 --tcp=2020:8080 --endpoints=31.31.31.1:1,32.32.32.1:1,33.33.33.1:1 --mode=fullnat --bgp
Expand Down Expand Up @@ -157,8 +161,8 @@ wait_cluster_ready_full

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

sleep 5

Expand Down
3 changes: 3 additions & 0 deletions cicd/k3s-flannel/nginx-svc-lb1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ apiVersion: v1
kind: Service
metadata:
name: nginx-lb1
annotations:
loxilb.io/staticIP : "11.11.11.11"
loxilb.io/lbmode: "fullnat"
spec:
externalTrafficPolicy: Local
loadBalancerClass: loxilb.io/loxilb
Expand Down
3 changes: 3 additions & 0 deletions cicd/k3s-flannel/rmconfig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ fi

source ../common.sh

sudo ip route del 11.11.11.11/32 via 14.14.14.1
sudo ip route del 123.123.123.1/32 via 14.14.14.1

sudo kubectl $KUBECONFIG delete -f nginx-svc-lb1.yml >> /dev/null 2>&1
sudo kubectl $KUBECONFIG delete -f nginx-svc-lb.yml >> /dev/null 2>&1
sudo kubectl $KUBECONFIG delete -f nginx.yml >> /dev/null 2>&1
Expand Down
31 changes: 21 additions & 10 deletions cicd/k3s-flannel/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 @@ -58,15 +58,7 @@ 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 "cluster-k3s (ccm) [OK]"
else
echo "cluster-k3s (ccm) [FAILED]"
code=1
fi
#print_debug_info

out=$($hexec user curl -s --connect-timeout 10 http://$extIP:55002)
if [[ ${out} == *"Welcome to nginx"* ]]; then
Expand All @@ -76,6 +68,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 udp-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 "cluster-k3s (kube-loxilb) udp [OK]"
Expand All @@ -85,6 +95,7 @@ else
fi

if [[ $code -eq 1 ]]; then
print_debug_info
echo "cluster-k3s failed"
exit 1
fi
Expand Down