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 29 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
2 changes: 1 addition & 1 deletion .taskfiles/Broker/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
version: '3'
vars:
BROKER_IMAGE_NAME: ghcr.io/xentra-ai/images/guardian-broker
IMAGE_VERSION: local
IMAGE_VERSION: 0.1

tasks:
all:
Expand Down
5 changes: 2 additions & 3 deletions .taskfiles/Controller/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: '3'

vars:
CONTROLLER_IMAGE_NAME: ghcr.io/xentra-ai/images/guardian-controller
IMAGE_VERSION: local
IMAGE_VERSION: 0.8
TARGET: x86_64-unknown-linux-gnu

tasks:
Expand All @@ -16,11 +16,10 @@ 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
- kind load docker-image {{.CONTROLLER_IMAGE_NAME}}:{{.IMAGE_VERSION}}
- rm -rf localbin

Expand Down
6 changes: 3 additions & 3 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ includes:
controller: .taskfiles/Controller

vars:
IMAGE_VERSION: local
IMAGE_VERSION: 0.8

tasks:
all:
deps: [kind]
# deps: [kind]
desc: "Run all tasks"
cmds:
#- task: advisor:all
Expand All @@ -30,7 +30,7 @@ tasks:
desc: "Install in KinD cluster"
cmds:
- helm repo add xentra https://xentra-ai.github.io/kube-guardian || true
- helm install kube-guardian xentra/kube-guardian --namespace kube-guardian
- helm upgrade kube-guardian xentra/kube-guardian --namespace kube-guardian
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this assume it has already been installed?

--create-namespace --set controller.image.tag={{.IMAGE_VERSION}}
--set broker.image.tag={{.IMAGE_VERSION}}
--set controller.image.pullPolicy=IfNotPresent
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