From d6f535eb6d7e8fd9040dc8c50319dbd0b21073a9 Mon Sep 17 00:00:00 2001 From: Trekkie Date: Wed, 14 Jun 2023 02:09:00 +0900 Subject: [PATCH 1/4] cicd : Make sure cluster is up before creating service --- cicd/k3s-calico/config.sh | 41 +++++++++++++++++++++++++++++++++++ cicd/k3s-flannel/config.sh | 44 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 83 insertions(+), 2 deletions(-) diff --git a/cicd/k3s-calico/config.sh b/cicd/k3s-calico/config.sh index 44c6b5c92..06f9d4f31 100755 --- a/cicd/k3s-calico/config.sh +++ b/cicd/k3s-calico/config.sh @@ -2,6 +2,40 @@ source ../common.sh +function wait_cluster_ready { + Res=$(sudo kubectl get pods -A | + while IFS= read -r line; do + if [[ "$line" != *"Running"* && "$line" != *"READY"* ]]; then + echo "not ready" + return + fi + done) + if [[ $Res == *"not ready"* ]]; then + return 1 + fi + return 0 +} + +function wait_cluster_ready_full { + i=1 + nr=0 + for ((;;)) do + wait_cluster_ready + nr=$? + if [[ $nr == 0 ]]; then + echo "Cluster is ready" + break + fi + i=$(( $i + 1 )) + if [[ $i -ge 40 ]]; then + echo "Cluster is not ready.Giving up" + exit 1 + fi + echo "Cluster is not ready..." + sleep 10 + done +} + echo "#########################################" echo "Spawning all hosts" echo "#########################################" @@ -154,6 +188,10 @@ sudo chown bird:bird /var/log/bird.log sudo systemctl restart bird 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 @@ -175,3 +213,6 @@ kubectl $KUBECONFIG get svc # Route back to user sudo ip route add 1.1.1.1/32 via 12.12.12.1 + +# Wait for cluster to be ready +wait_cluster_ready_full diff --git a/cicd/k3s-flannel/config.sh b/cicd/k3s-flannel/config.sh index a7420e316..975e0f232 100755 --- a/cicd/k3s-flannel/config.sh +++ b/cicd/k3s-flannel/config.sh @@ -2,6 +2,40 @@ source ../common.sh +function wait_cluster_ready { + Res=$(sudo kubectl get pods -A | + while IFS= read -r line; do + if [[ "$line" != *"Running"* && "$line" != *"READY"* ]]; then + echo "not ready" + return + fi + done) + if [[ $Res == *"not ready"* ]]; then + return 1 + fi + return 0 +} + +function wait_cluster_ready_full { + i=1 + nr=0 + for ((;;)) do + wait_cluster_ready + nr=$? + if [[ $nr == 0 ]]; then + echo "Cluster is ready" + break + fi + i=$(( $i + 1 )) + if [[ $i -ge 40 ]]; then + echo "Cluster is not ready.Giving up" + exit 1 + fi + echo "Cluster is not ready...." + sleep 10 + done +} + echo "#########################################" echo "Spawning all hosts" echo "#########################################" @@ -119,8 +153,8 @@ else echo "Start K3s installation" # Install k3s without external cloud-manager and disabled servicelb - curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.22.9+k3s1 INSTALL_K3S_EXEC="server --disable traefik --disable servicelb --disable-cloud-controller --kubelet-arg cloud-provider=external" K3S_KUBECONFIG_MODE="644" sh - - #curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="server --disable traefik --disable servicelb --disable-cloud-controller --kubelet-arg cloud-provider=external" K3S_KUBECONFIG_MODE="644" sh - + #curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.22.9+k3s1 INSTALL_K3S_EXEC="server --disable traefik --disable servicelb --disable-cloud-controller --kubelet-arg cloud-provider=external" K3S_KUBECONFIG_MODE="644" sh - + curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="server --disable traefik --disable servicelb --disable-cloud-controller --kubelet-arg cloud-provider=external" K3S_KUBECONFIG_MODE="644" sh - sleep 10 @@ -148,6 +182,9 @@ fi sudo chown bird:bird /var/log/bird.log sudo systemctl restart bird +# Wait for cluster readiness +wait_cluster_ready_full + sleep 10 # Start nginx pods and services for test kubectl $KUBECONFIG apply -f nginx.yml @@ -165,3 +202,6 @@ sleep 30 # External LB service must be created by now kubectl $KUBECONFIG get svc + +# Wait for cluster readiness +wait_cluster_ready_full From 9529c442e0eafa4b6ac16693b249a64380b0ce63 Mon Sep 17 00:00:00 2001 From: Trekkie Coder Date: Wed, 14 Jun 2023 10:01:42 +0900 Subject: [PATCH 2/4] Enhancements to cicd #87 --- cicd/common.sh | 34 +++++++++++++++ cicd/k0s-weave/validation.sh | 70 ++++++++++++++++++------------ cicd/k3s-calico/config.sh | 36 +--------------- cicd/k3s-calico/validation.sh | 79 +++++++++++++++++++--------------- cicd/k3s-flannel/config.sh | 34 --------------- cicd/k3s-flannel/validation.sh | 68 ++++++++++++++++------------- 6 files changed, 160 insertions(+), 161 deletions(-) diff --git a/cicd/common.sh b/cicd/common.sh index 43cdbe208..dfd3e147a 100644 --- a/cicd/common.sh +++ b/cicd/common.sh @@ -552,3 +552,37 @@ function add_route() { echo "$1: ip route add $2 via $3 proto static" $hexec $1 ip route add $2 via $3 proto static } + +function wait_cluster_ready { + Res=$(sudo kubectl get pods -A | + while IFS= read -r line; do + if [[ "$line" != *"Running"* && "$line" != *"READY"* ]]; then + echo "not ready" + return + fi + done) + if [[ $Res == *"not ready"* ]]; then + return 1 + fi + return 0 +} + +function wait_cluster_ready_full { + i=1 + nr=0 + for ((;;)) do + wait_cluster_ready + nr=$? + if [[ $nr == 0 ]]; then + echo "Cluster is ready" + break + fi + i=$(( $i + 1 )) + if [[ $i -ge 40 ]]; then + echo "Cluster is not ready.Giving up" + exit 1 + fi + echo "Cluster is not ready...." + sleep 10 + done +} diff --git a/cicd/k0s-weave/validation.sh b/cicd/k0s-weave/validation.sh index 32cdd4ca2..89d9091e7 100755 --- a/cicd/k0s-weave/validation.sh +++ b/cicd/k0s-weave/validation.sh @@ -30,35 +30,43 @@ done ## Any routing updates ?? sleep 30 -echo $extIP -echo "End Points List" -sudo k0s kubectl get endpoints -A -echo "SVC List" -sudo k0s kubectl get svc -echo "Pod List" -sudo k0s kubectl get pods -A -echo "LB List" -$dexec llb1 loxicmd get lb -o wide -echo "EP List" -$dexec llb1 loxicmd get ep -o wide +echo "ExternalIP $extIP" -out=$($hexec user curl -s --connect-timeout 10 http://$extIP:55002) -if [[ ${out} == *"Welcome to nginx"* ]]; then - echo "cluster-k0s (tcp) [OK]" -else - echo "cluster-k0s (tcp) [FAILED]" +print_debug_info() { ## Dump some debug info - echo "llb1 lb-info" - $dexec llb1 loxicmd get lb - echo "llb1 route-info" + echo "**** k0s svc info ****" + sudo k0s kubectl get svc + echo "**** k0s pods info ****" + sudo k0s kubectl get pods -A + echo "**** k0s endpoints info ****" + sudo k0s kubectl get endpoints + + echo "**** llb1 lb-info ****" + $dexec llb1 loxicmd get lb -o wide + echo "**** loxilb ep-info ****" + $dexec llb1 loxicmd get ep -o wide + echo "**** llb1 route-info ****" $dexec llb1 ip route - echo "llb2 lb-info" - $dexec llb2 loxicmd get lb - echo "llb2 route-info" + + echo "**** llb2 lb-info ****" + $dexec llb2 loxicmd get lb -o wide + echo "**** loxilb ep-info ****" + $dexec llb1 loxicmd get ep -o wide + echo "**** llb2 route-info ****" $dexec llb2 ip route - echo "r1 route-info" + + echo "**** r1 route-info ****" $dexec r1 ip route - exit 1 +} + +code=0 +print_debug_info + +out=$($hexec user curl -s --connect-timeout 10 http://$extIP:55002) +if [[ ${out} == *"Welcome to nginx"* ]]; then + echo "cluster-k0s (tcp) [OK]" +else + code=1 fi out=$($hexec user ../common/udp_client $extIP 55003) @@ -66,7 +74,7 @@ if [[ ${out} == *"Client"* ]]; then echo "cluster-k0s (udp) [OK]" else echo "cluster-k0s (udp) [FAILED]" - exit 1 + code=1 fi out=$($hexec user ../common/sctp_client 1.1.1.1 34951 $extIP 55004) @@ -74,7 +82,7 @@ if [[ ${out} == *"server1"* ]]; then echo "cluster-k0s (sctp) [OK]" else echo "cluster-k0s (sctp) [FAILED]" - exit 1 + code=1 fi out=$($hexec user ../common/sctp_client 1.1.1.1 0 $extIP 55005) @@ -82,7 +90,7 @@ if [[ ${out} == *"server1"* ]]; then echo "cluster-k0s (sctp2) [OK]" else echo "cluster-k0s (sctp2) [FAILED]" - exit 1 + code=1 fi out=$($hexec user ../common/udp_client $extIP 55006) @@ -90,5 +98,13 @@ if [[ ${out} == *"Client"* ]]; then echo "cluster-k0s (udp2) [OK]" else echo "cluster-k0s (udp2) [FAILED]" + code=1 +fi + +if [[ $code -eq 1 ]]; then + echo "cluster-k0s failed" exit 1 fi + +exit + diff --git a/cicd/k3s-calico/config.sh b/cicd/k3s-calico/config.sh index 06f9d4f31..ad9db7699 100755 --- a/cicd/k3s-calico/config.sh +++ b/cicd/k3s-calico/config.sh @@ -2,40 +2,6 @@ source ../common.sh -function wait_cluster_ready { - Res=$(sudo kubectl get pods -A | - while IFS= read -r line; do - if [[ "$line" != *"Running"* && "$line" != *"READY"* ]]; then - echo "not ready" - return - fi - done) - if [[ $Res == *"not ready"* ]]; then - return 1 - fi - return 0 -} - -function wait_cluster_ready_full { - i=1 - nr=0 - for ((;;)) do - wait_cluster_ready - nr=$? - if [[ $nr == 0 ]]; then - echo "Cluster is ready" - break - fi - i=$(( $i + 1 )) - if [[ $i -ge 40 ]]; then - echo "Cluster is not ready.Giving up" - exit 1 - fi - echo "Cluster is not ready..." - sleep 10 - done -} - echo "#########################################" echo "Spawning all hosts" echo "#########################################" @@ -154,7 +120,7 @@ else # Install k3s without external cloud-manager and disabled servicelb #curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.22.9+k3s1 INSTALL_K3S_EXEC="server --disable traefik --disable servicelb --disable-cloud-controller --kubelet-arg cloud-provider=external" K3S_KUBECONFIG_MODE="644" sh - - curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.22.9+k3s1 INSTALL_K3S_EXEC="server --disable traefik --disable servicelb --disable-cloud-controller --kubelet-arg cloud-provider=external --flannel-backend=none --cluster-cidr=10.42.0.0/16" K3S_KUBECONFIG_MODE="644" sh - + curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="server --disable traefik --disable servicelb --disable-cloud-controller --kubelet-arg cloud-provider=external --flannel-backend=none --disable-network-policy --cluster-cidr=10.42.0.0/16" K3S_KUBECONFIG_MODE="644" sh - sleep 10 diff --git a/cicd/k3s-calico/validation.sh b/cicd/k3s-calico/validation.sh index 9961d55dc..09f3f53f1 100755 --- a/cicd/k3s-calico/validation.sh +++ b/cicd/k3s-calico/validation.sh @@ -30,62 +30,71 @@ done ## Any routing updates ?? sleep 30 -echo $extIP -$dexec llb1 loxicmd get lb -o wide -$dexec llb1 loxicmd get ep -o wide +echo "ExternalIP $extIP" -out=$($hexec user curl -s --connect-timeout 10 http://$extIP:80) -if [[ ${out} == *"Welcome to nginx"* ]]; then - echo calico-k3s [OK] -else - echo calico-k3s [FAILED] +print_debug_info() { ## Dump some debug info - echo "llb1 lb-info" - $dexec llb1 loxicmd get lb - echo "llb1 route-info" + echo "**** k3s svc info ****" + sudo kubectl get svc + echo "**** k3s pods info ****" + sudo kubectl get pods -A + + echo "**** llb1 lb-info ****" + $dexec llb1 loxicmd get lb -o wide + echo "**** loxilb ep-info ****" + $dexec llb1 loxicmd get ep -o wide + echo "**** llb1 route-info ****" $dexec llb1 ip route - echo "llb2 lb-info" - $dexec llb2 loxicmd get lb - echo "llb2 route-info" + + echo "**** llb2 lb-info ****" + $dexec llb2 loxicmd get lb -o wide + echo "**** loxilb ep-info ****" + $dexec llb1 loxicmd get ep -o wide + echo "**** llb2 route-info ****" $dexec llb2 ip route - echo "r1 route-info" + + echo "**** r1 route-info ****" $dexec r1 ip route - exit 1 +} + +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 - echo "calico-k3s (kube-loxilb) [OK]" + echo "calico-k3s (kube-loxilb) tcp [OK]" else - echo "calico-k3s (kube-loxilb) [FAILED]" - ## Dump some debug info - echo "llb1 lb-info" - $dexec llb1 loxicmd get lb - echo "llb1 route-info" - $dexec llb1 ip route - echo "llb2 lb-info" - $dexec llb2 loxicmd get lb - echo "llb2 route-info" - $dexec llb2 ip route - echo "r1 route-info" - $dexec r1 ip route - exit 1 + echo "calico-k3s (kube-loxilb) tcp [FAILED]" + code=1 fi out=$($hexec user timeout 30 ../common/udp_client $extIP 55003) if [[ ${out} == *"Client"* ]]; then - echo calico-k3s udp [OK] + echo "calico-k3s (kube-loxillb) udp [OK]" else - echo calico-k3s udp [FAILED] - exit 1 + echo "calico-k3s (kube-loxillb) udp [FAILED]" + code=1 fi out=$($hexec user timeout 30 ../common/sctp_client 1.1.1.1 41291 $extIP 55004) if [[ ${out} == *"server1"* ]]; then - echo calico-k3s sctp [OK] + echo "calico-k3s (kube-loxillb) sctp [OK]" else - echo calico-k3s sctp [FAILED] + echo "calico-k3s (kube-loxillb) sctp [FAILED]" + code=1 +fi + +if [[ $code -eq 1 ]]; then + echo "calico-k3s failed" exit 1 fi diff --git a/cicd/k3s-flannel/config.sh b/cicd/k3s-flannel/config.sh index 975e0f232..e867bd1c4 100755 --- a/cicd/k3s-flannel/config.sh +++ b/cicd/k3s-flannel/config.sh @@ -2,40 +2,6 @@ source ../common.sh -function wait_cluster_ready { - Res=$(sudo kubectl get pods -A | - while IFS= read -r line; do - if [[ "$line" != *"Running"* && "$line" != *"READY"* ]]; then - echo "not ready" - return - fi - done) - if [[ $Res == *"not ready"* ]]; then - return 1 - fi - return 0 -} - -function wait_cluster_ready_full { - i=1 - nr=0 - for ((;;)) do - wait_cluster_ready - nr=$? - if [[ $nr == 0 ]]; then - echo "Cluster is ready" - break - fi - i=$(( $i + 1 )) - if [[ $i -ge 40 ]]; then - echo "Cluster is not ready.Giving up" - exit 1 - fi - echo "Cluster is not ready...." - sleep 10 - done -} - echo "#########################################" echo "Spawning all hosts" echo "#########################################" diff --git a/cicd/k3s-flannel/validation.sh b/cicd/k3s-flannel/validation.sh index 666c4d936..31eab2f18 100755 --- a/cicd/k3s-flannel/validation.sh +++ b/cicd/k3s-flannel/validation.sh @@ -30,48 +30,50 @@ done ## Any routing updates ?? sleep 30 -echo $extIP -$dexec llb1 loxicmd get lb -o wide -$dexec llb1 loxicmd get ep -o wide +echo "ExternalIP $extIP" -out=$($hexec user curl -s --connect-timeout 10 http://$extIP:80) - -if [[ ${out} == *"Welcome to nginx"* ]]; then - echo cluster-k3s [OK] -else - echo cluster-k3s [FAILED] +print_debug_info() { ## Dump some debug info - echo "llb1 lb-info" - $dexec llb1 loxicmd get lb - echo "llb1 route-info" + echo "**** k3s svc info ****" + sudo kubectl get svc + echo "**** k3s pods info ****" + sudo kubectl get pods -A + + echo "**** llb1 lb-info ****" + $dexec llb1 loxicmd get lb -o wide + echo "**** loxilb ep-info ****" + $dexec llb1 loxicmd get ep -o wide + echo "**** llb1 route-info ****" $dexec llb1 ip route - echo "llb2 lb-info" - $dexec llb2 loxicmd get lb - echo "llb2 route-info" + + echo "**** llb2 lb-info ****" + $dexec llb2 loxicmd get lb -o wide + echo "**** loxilb ep-info ****" + $dexec llb1 loxicmd get ep -o wide + echo "**** llb2 route-info ****" $dexec llb2 ip route - echo "r1 route-info" + + echo "**** r1 route-info ****" $dexec r1 ip route - exit 1 +} + +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 out=$($hexec user curl -s --connect-timeout 10 http://$extIP:55002) - if [[ ${out} == *"Welcome to nginx"* ]]; then echo "cluster-k3s (kube-loxilb) tcp [OK]" else echo "cluster-k3s (kube-loxilb) tcp [FAILED]" - ## Dump some debug info - echo "llb1 lb-info" - $dexec llb1 loxicmd get lb - echo "llb1 route-info" - $dexec llb1 ip route - echo "llb2 lb-info" - $dexec llb2 loxicmd get lb - echo "llb2 route-info" - $dexec llb2 ip route - echo "r1 route-info" - $dexec r1 ip route - exit 1 + code=1 fi out=$($hexec user timeout 30 ../common/udp_client $extIP 55003) @@ -79,6 +81,12 @@ if [[ ${out} == *"Client"* ]]; then echo "cluster-k3s (kube-loxilb) udp [OK]" else echo "cluster-k3s (kube-loxilb) udp [FAILED]" + code=1 +fi + +if [[ $code -eq 1 ]]; then + echo "cluster-k3s failed" exit 1 fi + exit From 05e2fe4e3de2e5507186eae78af8e1c433f81621 Mon Sep 17 00:00:00 2001 From: Trekkie Coder Date: Wed, 14 Jun 2023 10:17:10 +0900 Subject: [PATCH 3/4] Enhancements to cicd #87 --- cicd/k3s-calico/validation.sh | 4 ++-- cicd/k3s-flannel/validation.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cicd/k3s-calico/validation.sh b/cicd/k3s-calico/validation.sh index 09f3f53f1..7778bc515 100755 --- a/cicd/k3s-calico/validation.sh +++ b/cicd/k3s-calico/validation.sh @@ -35,9 +35,9 @@ echo "ExternalIP $extIP" print_debug_info() { ## Dump some debug info echo "**** k3s svc info ****" - sudo kubectl get svc + sudo kubectl $KUBECONFIG get svc echo "**** k3s pods info ****" - sudo kubectl get pods -A + sudo kubectl $KUBECONFIG get pods -A echo "**** llb1 lb-info ****" $dexec llb1 loxicmd get lb -o wide diff --git a/cicd/k3s-flannel/validation.sh b/cicd/k3s-flannel/validation.sh index 31eab2f18..2ca3c84df 100755 --- a/cicd/k3s-flannel/validation.sh +++ b/cicd/k3s-flannel/validation.sh @@ -35,9 +35,9 @@ echo "ExternalIP $extIP" print_debug_info() { ## Dump some debug info echo "**** k3s svc info ****" - sudo kubectl get svc + sudo kubectl $KUBECONFIG get svc echo "**** k3s pods info ****" - sudo kubectl get pods -A + sudo kubectl $KUBECONFIG get pods -A echo "**** llb1 lb-info ****" $dexec llb1 loxicmd get lb -o wide From 93bb5a6aaeac895291d624de09a9c54c95fbee2b Mon Sep 17 00:00:00 2001 From: Trekkie Coder Date: Wed, 14 Jun 2023 10:28:03 +0900 Subject: [PATCH 4/4] Enhancements to cicd #87 --- cicd/common.sh | 34 --------------------------------- cicd/k0s-weave/config.sh | 39 ++++++++++++++++++++++++++++++++++++++ cicd/k0s-weave/rmweave.sh | 22 +++++++++++++++++++++ cicd/k3s-calico/config.sh | 1 + cicd/k3s-flannel/config.sh | 1 + 5 files changed, 63 insertions(+), 34 deletions(-) create mode 100755 cicd/k0s-weave/rmweave.sh diff --git a/cicd/common.sh b/cicd/common.sh index dfd3e147a..43cdbe208 100644 --- a/cicd/common.sh +++ b/cicd/common.sh @@ -552,37 +552,3 @@ function add_route() { echo "$1: ip route add $2 via $3 proto static" $hexec $1 ip route add $2 via $3 proto static } - -function wait_cluster_ready { - Res=$(sudo kubectl get pods -A | - while IFS= read -r line; do - if [[ "$line" != *"Running"* && "$line" != *"READY"* ]]; then - echo "not ready" - return - fi - done) - if [[ $Res == *"not ready"* ]]; then - return 1 - fi - return 0 -} - -function wait_cluster_ready_full { - i=1 - nr=0 - for ((;;)) do - wait_cluster_ready - nr=$? - if [[ $nr == 0 ]]; then - echo "Cluster is ready" - break - fi - i=$(( $i + 1 )) - if [[ $i -ge 40 ]]; then - echo "Cluster is not ready.Giving up" - exit 1 - fi - echo "Cluster is not ready...." - sleep 10 - done -} diff --git a/cicd/k0s-weave/config.sh b/cicd/k0s-weave/config.sh index 0379cc7ab..46d8bf7e3 100755 --- a/cicd/k0s-weave/config.sh +++ b/cicd/k0s-weave/config.sh @@ -2,6 +2,41 @@ source ../common.sh + +function wait_k0s_cluster_ready { + Res=$(sudo k0s kubectl get pods -A | + while IFS= read -r line; do + if [[ "$line" != *"Running"* && "$line" != *"READY"* ]]; then + echo "not ready" + return + fi + done) + if [[ $Res == *"not ready"* ]]; then + return 1 + fi + return 0 +} + +function wait_k0s_cluster_ready_full { + i=1 + nr=0 + for ((;;)) do + wait_k0s_cluster_ready + nr=$? + if [[ $nr == 0 ]]; then + echo "Cluster is ready" + break + fi + i=$(( $i + 1 )) + if [[ $i -ge 40 ]]; then + echo "Cluster is not ready.Giving up" + exit 1 + fi + echo "Cluster is not ready...." + sleep 10 + done +} + echo "#########################################" echo "Spawning all hosts" echo "#########################################" @@ -161,6 +196,8 @@ fi sudo chown bird:bird /var/log/bird.log sudo systemctl restart bird +wait_k0s_cluster_ready_full + sleep 30 # Start nginx pods and services for test(using kube-loxilb) @@ -180,5 +217,7 @@ sleep 30 # External LB service must be created by now sudo k0s kubectl get svc +wait_k0s_cluster_ready_full + # Route back to user sudo ip route add 1.1.1.1/32 via 12.12.12.1 diff --git a/cicd/k0s-weave/rmweave.sh b/cicd/k0s-weave/rmweave.sh new file mode 100755 index 000000000..890428c30 --- /dev/null +++ b/cicd/k0s-weave/rmweave.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +sudo curl -L git.io/weave -o /usr/local/bin/weave +sudo chmod a+x /usr/local/bin/weave +weave reset --force +sudo rm -fr /usr/local/bin/weave + +ip a | grep 'vethwepl.*\@' -oP | while read -r line ; do + veth=${line::-1} + if [[ $veth =~ [0-9] ]]; then + echo check $veth + pid=$(echo $veth | tr -dc '0-9') + if ! ps -p $pid > /dev/null; then + echo deleting $veth + ip link delete $veth >&2 + else + echo $veth still running + fi + else + echo $veth veth has no number in it and will not be deleted + fi +done diff --git a/cicd/k3s-calico/config.sh b/cicd/k3s-calico/config.sh index ad9db7699..765d151ea 100755 --- a/cicd/k3s-calico/config.sh +++ b/cicd/k3s-calico/config.sh @@ -1,6 +1,7 @@ #!/bin/bash source ../common.sh +source ../k3s_common.sh echo "#########################################" echo "Spawning all hosts" diff --git a/cicd/k3s-flannel/config.sh b/cicd/k3s-flannel/config.sh index e867bd1c4..31dcfea6f 100755 --- a/cicd/k3s-flannel/config.sh +++ b/cicd/k3s-flannel/config.sh @@ -1,6 +1,7 @@ #!/bin/bash source ../common.sh +source ../k3s_common.sh echo "#########################################" echo "Spawning all hosts"