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

PR - cicd script fixes #418

Merged
merged 2 commits into from
Oct 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions cicd/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dexec="sudo docker exec -i "
hns="sudo ip netns "
hexist="$vrn$hn"
lxdocker="ghcr.io/loxilb-io/loxilb:latest"
cluster_opts=""
var=$(lsb_release -r | cut -f2)
if [[ $var == *"22.04"* ]];then
lxdocker="ghcr.io/loxilb-io/loxilb:latestu22"
Expand Down Expand Up @@ -101,12 +102,6 @@ spawn_docker_host() {
bgp_conf="-v $bpath:/etc/gobgp/"
fi
fi
if [[ "$dname" == "llb1" ]]; then
cluster_opts=" --cluster=172.17.0.3 --self=0"
elif [[ "$dname" == "llb2" ]]; then
cluster_opts=" --cluster=172.17.0.2 --self=1"
fi

if [[ ! -z ${ka+x} ]]; then
sudo mkdir -p /etc/shared/$dname/
if [[ "$ka" == "in" ]];then
Expand All @@ -116,6 +111,7 @@ spawn_docker_host() {
fi
fi
docker run -u root --cap-add SYS_ADMIN --restart unless-stopped --privileged -dt --entrypoint /bin/bash $bgp_conf -v /dev/log:/dev/log -v /etc/shared/$dname:/etc/shared $loxilb_config $ka_conf --name $dname $lxdocker
get_llb_peerIP $dname
docker exec -dt $dname /root/loxilb-io/loxilb/loxilb $bgp_opts $cluster_opts $ka_opts

if [[ "$ka" == "out" ]];then
Expand Down Expand Up @@ -159,6 +155,29 @@ spawn_docker_host() {
$hexec $dname sysctl net.ipv4.conf.eth0.arp_ignore=2 2>&1 >> /dev/null
}

## Get loxilb peer docker IP
get_llb_peerIP() {
if [[ "$1" == "llb1" ]]; then
llb1IP=$(docker inspect --format='{{.NetworkSettings.IPAddress}}' llb1)
if [[ "lb$llb1IP" == "lb" ]];then
llb2IP="172.17.0.3"
else
read A B C D <<<"${llb1IP//./ }"
llb2IP="$A.$B.$C.$((D+1))"
fi
cluster_opts=" --cluster=$llb2IP --self=0"
elif [[ "$1" == "llb2" ]]; then
llb2IP=$(docker inspect --format='{{.NetworkSettings.IPAddress}}' llb2)
if [[ "lb$llb2IP" == "lb" ]];then
llb1IP="172.17.0.2"
else
read A B C D <<<"${llb2IP//./ }"
llb1IP="$A.$B.$C.$((D-1))"
fi
cluster_opts=" --cluster=$llb1IP --self=1"
fi
}

## Deletes a docker host
## arg1 - hostname
delete_docker_host() {
Expand Down
Loading