Skip to content

Commit

Permalink
Merge pull request #71 from SamYuan1990/linuxHeader
Browse files Browse the repository at this point in the history
add linux Header and libbpf prerequest
  • Loading branch information
rootfs authored Apr 3, 2024
2 parents b1506af + 9aa2ce3 commit d738af6
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ jobs:
export GRAFANA_ENABLE=${{matrix.GRAFANA_ENABLE}}
export CLUSTER_PROVIDER=${{matrix.cluster_provider}}
export TEKTON_ENABLE=${{matrix.TEKTON_ENABLE}}
./main.sh prerequisites
./main.sh up
- name: verify
run: |
Expand Down
45 changes: 45 additions & 0 deletions main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ declare -r REGISTRY_PORT=${REGISTRY_PORT:-5001}
declare -r PROMETHEUS_ENABLE=${PROMETHEUS_ENABLE:-false}
declare -r GRAFANA_ENABLE=${GRAFANA_ENABLE:-false}
declare -r TEKTON_ENABLE=${TEKTON_ENABLE:-false}
declare -r LIBBPF_VERSION=${LIBBPF_VERSION:-v1.2.0}

source "$PROJECT_ROOT/lib/utils.sh"

Expand Down Expand Up @@ -122,6 +123,41 @@ print_config() {
EOF
}

linuxHeader() {
sudo apt-get install -y linux-headers-"$(uname -r)"
sudo apt-get install -y linux-modules-"$(uname -r)"
sudo apt-get install -y linux-modules-extra-"$(uname -r)"
}

ebpf() {
sudo apt-get install -y binutils-dev build-essential pkg-config libelf-dev
mkdir -p temp-libbpf
cd temp-libbpf
git clone -b "$LIBBPF_VERSION" https://github.com/libbpf/libbpf
cd libbpf/src
sudo BUILD_STATIC_ONLY=y make install
sudo make install_uapi_headers
cd ../../..
sudo rm -rf temp-libbpf
}

containerruntime() {
# Add Docker's official GPG key:
sudo apt-get update -y
sudo apt-get install ca-certificates curl gnupg -y
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update -y
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
docker info
}

main() {
# ensure that all relative file refs are relative to the project root
cd "$PROJECT_ROOT"
Expand All @@ -143,6 +179,15 @@ main() {
print_config

case "$1" in
prerequisites)
linuxHeader
ebpf
return $?
;;
containerruntime)
containerruntime
return $?
;;
up)
cluster_up
return $?
Expand Down

0 comments on commit d738af6

Please sign in to comment.