Skip to content

Commit

Permalink
Merge branch 'loxilb-io:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
nik-netlox authored Mar 12, 2024
2 parents 40d5994 + f0d5729 commit e12244d
Show file tree
Hide file tree
Showing 21 changed files with 971 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/basic-sanity-ubuntu-22.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
- run: sudo -E env "PATH=$PATH" make
- run: sudo -E env "PATH=$PATH" make test
- run: docker pull ghcr.io/loxilb-io/loxilb:latest
- run: docker run -u root --cap-add SYS_ADMIN --restart unless-stopped --privileged -dit -v /dev/log:/dev/log --name loxilb ghcr.io/loxilb-io/loxilb:latest
- run: docker run -u root --cap-add SYS_ADMIN --restart unless-stopped --privileged -dit -v /dev/log:/dev/log --name loxilb ghcr.io/loxilb-io/loxilb:latest-amd64
- run: pwd && ls && sudo -E env "PATH=$PATH" make docker-cp-ebpf
- run: docker exec -dit loxilb mkllb_bpffs
- run: id=`docker ps -f name=loxilb | cut -d " " -f 1 | grep -iv "CONTAINER"` && docker commit $id ghcr.io/loxilb-io/loxilb:latest
Expand Down
19 changes: 10 additions & 9 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
tagName:
description: 'Tag Name'
required: true
default: 'latest'
default: 'latest-amd64'

jobs:

Expand All @@ -31,22 +31,23 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build the latest loxilb Docker image
- name: Build and run the latest loxilb Docker image
if: github.event.inputs.tagName == ''
run: docker build . --tag ghcr.io/loxilb-io/loxilb:latest
run: |
docker build . --tag ghcr.io/loxilb-io/loxilb:latest-amd64
docker run -u root --cap-add SYS_ADMIN --restart unless-stopped --privileged -dit -v /dev/log:/dev/log --name loxilb ghcr.io/loxilb-io/loxilb:latest-amd64
- name: Build the loxilb Docker image with given tag
- name: Build and run the loxilb Docker image with given tag
if: github.event.inputs.tagName != ''
run: docker build . --tag ghcr.io/loxilb-io/loxilb:${{ github.event.inputs.tagName }}
run: |
docker build . --tag ghcr.io/loxilb-io/loxilb:${{ github.event.inputs.tagName }}
docker run -u root --cap-add SYS_ADMIN --restart unless-stopped --privileged -dit -v /dev/log:/dev/log --name loxilb ghcr.io/loxilb-io/loxilb:${{ github.event.inputs.tagName }}
- name: Run the loxilb docker image to check
run: docker run -u root --cap-add SYS_ADMIN --restart unless-stopped --privileged -dit -v /dev/log:/dev/log --name loxilb ghcr.io/loxilb-io/loxilb:latest

- name: Publish the latest loxilb Docker image
if: |
github.repository == 'loxilb-io/loxilb'
&& github.event.inputs.tagName == ''
run: docker push ghcr.io/loxilb-io/loxilb:latest
run: docker push ghcr.io/loxilb-io/loxilb:latest-amd64

- name: Publish the loxilb Docker image with given tag
if: |
Expand Down
25 changes: 20 additions & 5 deletions .github/workflows/docker-multiarch.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: Docker-Multi-Arch

on:
push:
branches: [ "main" ]
workflow_dispatch:
inputs:
inputs:
tagName:
description: 'Tag Name'
required: true
Expand Down Expand Up @@ -40,14 +42,27 @@ jobs:
context: .
platforms: linux/amd64, linux/arm64
push: false
tags: ghcr.io/loxilb-io/loxilb:${{ github.event.inputs.tagName }}
tags: ghcr.io/loxilb-io/loxilb:latest

- name: Build and push
- name: Build and push to latest
if: |
github.repository == 'loxilb-io/loxilb'
github.repository == 'loxilb-io/loxilb'
&& github.event.inputs.tagName == ''
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64, linux/arm64
push: true
tags: ghcr.io/loxilb-io/loxilb:${{ github.event.inputs.tagName }}
tags: ghcr.io/loxilb-io/loxilb:latest

- name: Build and push to given tag
if: |
github.repository == 'loxilb-io/loxilb'
&& github.event.inputs.tagName != ''
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64, linux/arm64
push: true
tags: ghcr.io/loxilb-io/loxilb:${{ github.event.inputs.tagName }}

2 changes: 1 addition & 1 deletion .github/workflows/k3s-base-sanity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
required: true
default: 'k3s-base'
workflow_run:
workflows: ["Build-CI"]
workflows: ["Docker-Multi-Arch"]
types:
- completed
jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nat66-sanity-ubuntu-22.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- run: sudo -E env "PATH=$PATH" make test
- run: docker pull ghcr.io/loxilb-io/loxilb:latest
- run: docker run -u root --cap-add SYS_ADMIN --restart unless-stopped --privileged -dit -v /dev/log:/dev/log --name loxilb ghcr.io/loxilb-io/loxilb:latest
- run: pwd && ls && sudo -E env "PATH=$PATH" make docker-cp
- run: pwd && ls && sudo -E env "PATH=$PATH" make docker-cp-ebpf
- run: docker exec -dit loxilb mkllb_bpffs
- run: id=`docker ps -f name=loxilb | cut -d " " -f 1 | grep -iv "CONTAINER"` && docker commit $id ghcr.io/loxilb-io/loxilb:latest
- run: docker stop loxilb && docker rm loxilb
Expand Down
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ LABEL description="loxilb official docker image"
# Disable Prompt During Packages Installation
ARG DEBIAN_FRONTEND=noninteractive

# Env for golang
# Env variables
ENV PATH="${PATH}:/usr/local/go/bin"
ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/lib64/"

# Install loxilb related packages
RUN mkdir -p /opt/loxilb && \
Expand Down Expand Up @@ -43,8 +44,8 @@ RUN mkdir -p /opt/loxilb && \
/usr/local/sbin/loxicmd completion bash > /etc/bash_completion.d/loxi_completion && \
# Install loxilb
git clone --recurse-submodules https://github.com/loxilb-io/loxilb /root/loxilb-io/loxilb/ && \
cd /root/loxilb-io/loxilb/ && go get . && make && \
cp loxilb-ebpf/utils/mkllb_bpffs.sh /usr/local/sbin/mkllb_bpffs && \
cd /root/loxilb-io/loxilb/ && go get . && if [ "$arch" = "arm64" ] ; then DOCKER_BUILDX_ARM64=true make; \
else make ;fi && cp loxilb-ebpf/utils/mkllb_bpffs.sh /usr/local/sbin/mkllb_bpffs && \
cp api/certification/* /opt/loxilb/cert/ && cd - && \
cp /root/loxilb-io/loxilb/loxilb-ebpf/kernel/loxilb_dp_debug /usr/local/sbin/loxilb_dp_debug && \
cp /root/loxilb-io/loxilb/loxilb /usr/local/sbin/loxilb && \
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ docker:
docker build -t ghcr.io/loxilb-io/loxilb:latest .

docker-arm64:
docker buildx build --platform linux/arm64 -t ghcr.io/loxilb-io/loxilb:latest-arm64 .
docker buildx build --platform linux/arm64 --load -t ghcr.io/loxilb-io/loxilb:latest-arm64 .

lint:
golangci-lint run --enable-all
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ For deploying telco-cloud with cloud-native functions, loxilb can be used as a S
- [How-To : Standalone configuration](https://github.com/loxilb-io/loxilbdocs/blob/main/docs/cmd.md)
- [How-To : debug](https://github.com/loxilb-io/loxilbdocs/blob/main/docs/debugging.md)

## Getting started with different K8s distributions & tools

- [K3s : loxilb with default flannel](https://github.com/loxilb-io/loxilbdocs/blob/main/docs/k3s_quick_start_flannel.md)
- [K3s : loxilb with cilium](https://github.com/loxilb-io/loxilbdocs/blob/main/docs/quick_start_with_cilium.md)

## Knowledge-Base
- [What is eBPF](ebpf.md)
- [What is k8s service - load-balancer](https://github.com/loxilb-io/loxilbdocs/blob/main/docs/lb.md)
Expand Down
2 changes: 1 addition & 1 deletion api/restapi/handler/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,4 @@ func ConfigDeleteBFDSession(params operations.DeleteConfigBfdRemoteIPRemoteIPPar
return &ResultResponse{Result: err.Error()}
}
return &ResultResponse{Result: "Success"}
}
}
17 changes: 8 additions & 9 deletions cicd/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ dexec="sudo docker exec -i "
hns="sudo ip netns "
hexist="$vrn$hn"
lxdocker="ghcr.io/loxilb-io/loxilb:latest"
hostdocker="ghcr.io/nicolaka/netshoot:latest"
cluster_opts=""
ka_opts=""
var=$(lsb_release -r | cut -f2)
if [[ $var == *"22.04"* ]];then
lxdocker="ghcr.io/loxilb-io/loxilb:latestu22"
fi
#if [[ $var == *"22.04"* ]];then
# lxdocker="ghcr.io/loxilb-io/loxilb:latestu22"
#fi

loxilbs=()

Expand All @@ -32,11 +33,9 @@ pull_dockers() {
## loxilb docker
docker pull $lxdocker
## Host docker
docker pull eyes852/ubuntu-iperf-test:0.5
docker pull docker pull $hostdocker
## BGP host docker
docker pull ewindisch/quagga
## Keepalive docker
docker pull osixia/keepalived:2.0.20
}

## Creates a docker host
Expand Down Expand Up @@ -119,7 +118,7 @@ spawn_docker_host() {
if [[ "$bgp" == "yes" || ! -z "$bpath" ]]; then
docker run -u root --cap-add SYS_ADMIN --restart unless-stopped --privileged -dit $bgp_conf --name $dname ewindisch/quagga
else
docker run -u root --cap-add SYS_ADMIN -dit --name $dname eyes852/ubuntu-iperf-test:0.5
docker run -u root --cap-add SYS_ADMIN -dit --name $dname $hostdocker
fi
elif [[ "$dtype" == "seahost" ]]; then
docker run -u root --cap-add SYS_ADMIN -i -t --rm --detach --entrypoint /bin/bash --name $dname ghcr.io/loxilb-io/seagull:ubuntu1804
Expand Down Expand Up @@ -173,13 +172,13 @@ get_llb_peerIP() {
## Deletes a docker host
## arg1 - hostname
delete_docker_host() {
if docker stop $1 2>&1 >> /dev/null
if docker kill $1 2>&1 >> /dev/null
then
hd="true"
ka=`docker ps -f name=ka_$1| grep -w ka_$1 | cut -d " " -f 1 | grep -iv "CONTAINER"`
loxilbs=( "${loxilbs[@]/$1}" )
if [ "$ka" != "" ]; then
docker stop ka_$1 2>&1 >> /dev/null
docker kill ka_$1 2>&1 >> /dev/null
docker rm ka_$1 2>&1 >> /dev/null
fi
fi
Expand Down
29 changes: 29 additions & 0 deletions cicd/docker-k3s-cilium/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

loxilbs = (ENV['LOXILBS'] || "1").to_i
eps = (ENV['LOXILBS'] || "1").to_i
box_name = (ENV['VAGRANT_BOX'] || "sysnet4admin/Ubuntu-k8s")
box_version = "0.7.1"
Vagrant.configure("2") do |config|
config.vm.box = "#{box_name}"
config.vm.box_version = "#{box_version}"

if Vagrant.has_plugin?("vagrant-vbguest")
config.vbguest.auto_update = false
end

(1..loxilbs).each do |node_number|
config.vm.define "llb#{node_number}" do |loxilb|
loxilb.vm.hostname = "llb#{node_number}"
ip = node_number + 245
loxilb.vm.network :private_network, ip: "192.168.163.#{ip}", :netmask => "255.255.255.0"
loxilb.vm.provision :shell, :path => "loxilb.sh"
loxilb.vm.provider :virtualbox do |vbox|
vbox.customize ["modifyvm", :id, "--memory", 16000]
vbox.customize ["modifyvm", :id, "--cpus", 8]
vbox.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"]
end
end
end
end
Loading

0 comments on commit e12244d

Please sign in to comment.