diff --git a/cicd/k3s-calico/config.sh b/cicd/k3s-calico/config.sh index c076daf54..f496adb57 100755 --- a/cicd/k3s-calico/config.sh +++ b/cicd/k3s-calico/config.sh @@ -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) @@ -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 diff --git a/cicd/k3s-calico/nginx-svc-lb1.yml b/cicd/k3s-calico/nginx-svc-lb1.yml index 5bcf72fd4..5875d9518 100644 --- a/cicd/k3s-calico/nginx-svc-lb1.yml +++ b/cicd/k3s-calico/nginx-svc-lb1.yml @@ -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 diff --git a/cicd/k3s-calico/validation.sh b/cicd/k3s-calico/validation.sh index 8c7bda986..885b29bd4 100755 --- a/cicd/k3s-calico/validation.sh +++ b/cicd/k3s-calico/validation.sh @@ -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 @@ -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 @@ -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]" @@ -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]"