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

Migrate libbpf #145

Merged
merged 30 commits into from
Aug 19, 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
11 changes: 2 additions & 9 deletions .github/workflows/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,16 @@ jobs:
echo "BUILD=x86_64-unknown-linux-gnu" >> $GITHUB_OUTPUT
fi

- name: Install bpf-linker
- name: Build Rust
run: |
sudo apt update -y

sudo apt install linux-tools-common linux-tools-generic linux-tools-$(uname -r) -y

cd controller

cargo install bpf-linker

cargo install cross --git https://github.com/cross-rs/cross

cargo xtask codegen

# build ebpf byte code
cargo xtask build-ebpf --release


cross build --target ${{ steps.args.outputs.BUILD }} --release

- uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4
Expand Down
1 change: 1 addition & 0 deletions .taskfiles/Broker/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ tasks:
desc: "Build and load the broker Docker image"
cmds:
- docker build -t {{.BROKER_IMAGE_NAME}}:{{.IMAGE_VERSION}} broker -f broker/Dockerfile
#- docker push {{.BROKER_IMAGE_NAME}}:{{.IMAGE_VERSION}}
- kind load docker-image {{.BROKER_IMAGE_NAME}}:{{.IMAGE_VERSION}}

preflight:
Expand Down
4 changes: 2 additions & 2 deletions .taskfiles/Controller/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ tasks:
build:
desc: "Build the controller with Cargo and cross"
cmds:
- cd controller && cargo xtask build-ebpf --release
- cd controller && cross build --release --target {{.TARGET}}
- mkdir -p localbin
- cp controller/target/{{.TARGET}}/release/kube-guardian localbin
- docker build -t {{.CONTROLLER_IMAGE_NAME}}:{{.IMAGE_VERSION}} . -f controller/docker/local.Dockerfile
- docker build -t {{.CONTROLLER_IMAGE_NAME}}:{{.IMAGE_VERSION}} . -f controller/Dockerfile
#- docker push {{.CONTROLLER_IMAGE_NAME}}:{{.IMAGE_VERSION}}
- kind load docker-image {{.CONTROLLER_IMAGE_NAME}}:{{.IMAGE_VERSION}}
- rm -rf localbin

Expand Down
File renamed without changes.
9 changes: 9 additions & 0 deletions broker/diesel.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# For documentation on how to configure this file,
# see https://diesel.rs/guides/configuring-diesel-cli

[print_schema]
file = "src/schema.rs"
custom_type_derives = ["diesel::query_builder::QueryId"]

[migrations_directory]
dir = "migrations"
7 changes: 7 additions & 0 deletions charts/kube-guardian/templates/controller/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ spec:
- name: containerd-sock
mountPath: /run/containerd/containerd.sock
readOnly: true
- mountPath: /sys/kernel/tracing
name: tracefs
readOnly: true
- mountPath: /proc
name: hostproc
readOnly: true
Expand Down Expand Up @@ -94,6 +97,10 @@ spec:
- hostPath:
path: /sys/kernel/debug
name: debugfs
- hostPath:
path: /sys/kernel/tracing
type: Directory
name: tracefs
nodeSelector:
{{- if .Values.controller.nodeSelector }}
{{- toYaml .Values.controller.nodeSelector | nindent 8 }}
Expand Down
2 changes: 2 additions & 0 deletions controller/.cargo/Config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
8 changes: 0 additions & 8 deletions controller/.cargo/config.toml

This file was deleted.

3 changes: 3 additions & 0 deletions controller/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**/target/**
localbin
.vscode
Loading
Loading