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

add linux Header and libbpf prerequest #71

Merged
merged 1 commit into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
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
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
Loading