-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
51 lines (39 loc) · 1.2 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
REGISTRY ?= dippynark
DOCKERFILE ?= Dockerfile
IMAGE ?= bpf-kubernetes
TAG ?= $(shell uname -r)
BPF_BUILDER_DOCKERFILE ?= bpf/Dockerfile
BPF_BUILDER_IMAGE ?= bpf-builder
CGROUP2 = /sys/fs/cgroup/unified
DEBUGFS = /sys/kernel/debug
# If you can use docker without being root, you can do "make SUDO="
SUDO=$(shell docker info >/dev/null 2>&1 || echo "sudo -E")
run_%:
@docker run -it \
--privileged \
--pid=host \
--net=host \
-e NODE_NAME=$(shell hostname) \
-e KUBECONFIG=$(KUBECONFIG) \
-v $(KUBECONFIG):$(KUBECONFIG) \
-v $(CGROUP2):$(CGROUP2) \
-v $(DEBUGFS):$(DEBUGFS) \
${REGISTRY}/${IMAGE}:${TAG} \
--example $*
build: install_bpf docker_build
docker_build:
$(SUDO) docker build -t ${REGISTRY}/${IMAGE}:${TAG} .
docker_push:
$(SUDO) docker push ${REGISTRY}/${IMAGE}:${TAG}
install_bpf: bpf
cp -a $(CURDIR)/bpf/bindata.go $(CURDIR)/pkg/bpf/bindata.go
bpf: docker_build_bpf
docker_build_bpf: docker_build_bpf_image
$(SUDO) docker run --rm \
-v $(CURDIR)/bpf:/bpf \
-v /usr/src:/usr/src \
--workdir=/bpf \
$(REGISTRY)/$(BPF_BUILDER_IMAGE) \
make bindata.go
docker_build_bpf_image:
$(SUDO) docker build -t $(REGISTRY)/$(BPF_BUILDER_IMAGE) -f $(BPF_BUILDER_DOCKERFILE) ./bpf