-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (52 loc) · 1.82 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
52
53
54
55
56
57
58
59
60
61
62
63
IMAGE_REGISTRY ?= ghcr.io
IMAGE_REPO ?= moolen/skouter
IMAGE_TAG ?= dev
CLANG ?= clang
STRIP ?= llvm-strip
CFLAGS := -O2 -g -Wall -Werror $(CFLAGS)
.PHONY: generate
generate: export BPF_CLANG := $(CLANG)
generate: export BPF_CFLAGS := $(CFLAGS)
generate:
go generate ./...
go run sigs.k8s.io/controller-tools/cmd/controller-gen object \
paths="./api/..."
go run sigs.k8s.io/controller-tools/cmd/controller-gen crd \
paths="./api/..." \
output:crd:artifacts:config="crds"
cp ./crds/* ./deploy/skouter/templates/crds
build: generate
mkdir -p bin
CGO_ENABLED=0 go build -ldflags='-extldflags=-static' -o bin/skouter main.go
docker.build:
docker build -t $(IMAGE_REGISTRY)/$(IMAGE_REPO):$(IMAGE_TAG) .
run: build
sudo -E ./bin/skouter \
--kubeconfig ~/.kube/config \
--node-ip 192.168.178.24 \
--net-device-name wlp61s0 \
--trusted-dns-endpoint 192.168.178.1:53 \
--node-name kind-worker \
--bpffs /sys/fs/bpf \
-v=5
lint.check: ## Check install of golanci-lint
@if ! golangci-lint --version > /dev/null 2>&1; then \
echo -e "\033[0;33mgolangci-lint is not installed: run \`\033[0;32mmake lint.install\033[0m\033[0;33m\` or install it from https://golangci-lint.run\033[0m"; \
exit 1; \
fi
lint.install: ## Install golangci-lint to the go bin dir
@if ! golangci-lint --version > /dev/null 2>&1; then \
echo "Installing golangci-lint"; \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) v1.49.0; \
fi
lint: lint.check ## Run golangci-lint
@if ! golangci-lint run; then \
echo -e "\033[0;33mgolangci-lint failed: some checks can be fixed with \`\033[0;32mmake fmt\033[0m\033[0;33m\`\033[0m"; \
exit 1; \
fi
@echo Finished linting
.PHONY: example
example: docker.build
kubectl apply -f ./crds/
kubectl apply -f ./deploy
kubectl delete po -l app=skouter